CB0: registry incarnation minted at reserve (legacy entries get one at the first binding proposal, under the registry lock); copyId, source and definition pin, binding generation; a pure resolver where effective = role intersect approved and only a bound, matching, unshadowed record resolves. CB1: copyBindings in the organization file (ids, scope names, project ids and integers only). applyCopyBindingDecision is its only writer, behind a module-private capability every other commit is fenced against. A binding is an owner-only subtype of the hire decision: only the chief raises it, no autonomy level, resolver agent, member right, tester or reader resolves it. Digest, expiry, single consumption, revision, generation, incarnation and definition pin are rechecked before any effect; a bind writes pending, an unbind the unbound tombstone, receipts are paths only. Nothing writes bound, so nothing launches on a binding yet (CB2/CB3). The org service and the Console update path keep copyBindings server-held. Eight new refusal codes with next steps.
270 lines
23 KiB
JavaScript
270 lines
23 KiB
JavaScript
// Static refusal table: each listed code maps to one rail and next step. These strings
|
||
// never interpolate caller arguments, credential references, policy values or file bytes.
|
||
const entries = [];
|
||
|
||
const group = (codes, rail, nextStep) => {
|
||
const guidance = Object.freeze({ rail, nextStep });
|
||
for (const code of codes.split(' ')) {
|
||
if (entries.some(([known]) => known === code)) throw new Error('duplicate refusal guidance');
|
||
entries.push([code, guidance]);
|
||
}
|
||
};
|
||
group("authority-limits-unavailable", "R3/R12: future authority spend coverage", "Use authority near the loop with an enforced organization budget. Out of the loop waits for enforceable per-agent limits in every approvable definition; current-instance limits do not cover future hires.");
|
||
group("policy-reverse-unavailable", "R3/R12: policy inverse unavailable", "Choose policy in the loop or out of the loop. Near the loop waits for a policy effect executor and a tested reverse.");
|
||
group("invalid-autonomy autonomy-precondition reversal-unavailable", "R3/R12: validated owner autonomy and reversible effects", "Use only the four decision classes and three levels. Keep work in the loop until the class has a distinct resolver, tested inverse, notices, review and spend prerequisites; an unsupported effect needs an ordinary new decision. Authority near needs enabled limit checks and aggregate coverage of new agents. Moving out needs a near-loop resolution followed by the owner’s trail review. A failed inverse may have stopped an agent; inspect its writer receipt and use the normal launch or decision path.");
|
||
group("confirmation-required", "R5/R12: person confirms the arbiter resolution", "The arbiter remains the resolver. Confirm its pending resolution in the owner Console, or return it with a reason for a fresh resolution.");
|
||
group("decision-reversed reverse-window-closed", "R2/R12: one-use reverse within the owner's window", "Inspect the reversal trail. After the window, raise an ordinary new decision through the normal approval path; never replay the old approval.");
|
||
group("definition-shared hire-resolution-required hire-owner-required decision-expired right-required", "R5/R8/R9: digest-bound hire approval by a permitted person", "Use the hire Console path with org.hire. Flagged, credential and root decisions need their owner; expired decisions need a fresh proposal.");
|
||
group("root-fire-shared", "R3/R8: root fire must revoke every copy's grants", "Other organizations may retain running copies and grants. Ask the owner to coordinate revocation across those organizations before removing the root agent.");
|
||
// #1873 CB1: copy credential bindings (design sections 4 and 6). Approval is owner-only; nothing here
|
||
// names a token, a slot path or a file path.
|
||
group("organization-bindings-protected", "R1/R8: copy bindings change only through an owner-approved decision", "Ask the chief to raise a binding decision for the copy; only the organization owner approves it. No other write path changes copyBindings.");
|
||
group("credential-binding-changed credential-role-changed credential-definition-unpinned", "R1/R8: binding approval pinned to the current copy, definition and generation", "Read the copy's current binding and definition, then ask the chief to raise a fresh binding decision for the owner; an old approval never carries over.");
|
||
group("credential-scope-exceeded", "R1/R8: effective access is the role intersected with the approval", "Narrow the requested scopes and projects to what the copy's role and admitted projects allow, or change the role through its own decision first.");
|
||
group("credential-unbound", "R1/R8: launch needs an approved, verified binding", "Ask the chief to raise a binding decision for the missing service; the owner approves it. A pending binding is not usable until verification exists.");
|
||
group("copy-unavailable copy-refused", "R3/R8: one active, unambiguous copy identity", "Read the organization's copies. Ask the owner to resolve the definition collision or restore the copy's source before raising a binding decision.");
|
||
group("copy-stale", "R3: root policy changed since this bus booted", "Ask the owner to restart the organization bus to load the approved root policy, then launch a fresh copy.");
|
||
group("root-policy-unreadable", "R3: root policy evidence must be readable", "Ask the owner to inspect root agent receipt metadata and restart the bus after repairing the read failure.");
|
||
group("plugin-disabled", "R3/R6/R10: installed, pinned and enabled plugin capabilities", "Ask the instance owner to verify the installed plugin and the organization owner to enable it. A replacement of an already loaded package needs a host restart; then relaunch the agent.");
|
||
group("plugin-restart-required", "R3/R10: one imported package pin per host process", "Ask the instance owner to restart the host after replacing an already loaded package, then retry through the supported path.");
|
||
group(
|
||
"access-refused access-revoked share-exists share-not-covered share-not-found tester-dev-only tester-off tester-refused tester-required tester-target-not-running thread-not-allowed thread-not-owned",
|
||
"R7: caller access and scoped session boundary",
|
||
"Use only the caller's own permitted scope. Ask the owner to inspect access or sharing through the supported controls; never borrow another identity."
|
||
);
|
||
group(
|
||
"adapter-failed check-threw duplicate-run malformed-answer no-verdict not-a-merge not-approved not-collected not-human not-merge-option not-resolved not-thread-launch peercred-required reply-limits-unreadable socket-exists store-unreadable target-branch workspace-rename-failed",
|
||
"R3: fail closed on an unsatisfied operation precondition",
|
||
"Inspect the supported status and report the refusal code to the responsible owner; do not bypass it or retry an uncertain side effect."
|
||
);
|
||
group(
|
||
"addressee-ambiguous invalid-approval-choice invalid-arbiter invalid-authority invalid-business invalid-choice invalid-class invalid-domain invalid-envelope invalid-harness invalid-messaging invalid-options invalid-plugins invalid-recommendation invalid-request invalid-snapshot invalid-spec-citation invalid-state invalid-task-ref invalid-timestamp name-is-instance name-is-role name-taken project-name-is-repo thread-instance-ambiguous unknown-action unknown-addressee unknown-business unknown-commit unknown-model unknown-plugin unknown-repo unknown-request unknown-requirement unknown-role unknown-run unknown-verb",
|
||
"R3: validated vocabulary and request shape",
|
||
"Check the tool schema and permitted identifiers, correct the request, then retry; do not guess around a refusal."
|
||
);
|
||
group(
|
||
"agent-required",
|
||
"Role/session: agent identity required",
|
||
"Use this tool only from an authorized managed agent session."
|
||
);
|
||
group(
|
||
"agent-running fire-in-progress instance-fired instance-firing instance-not-listed instance-retired instance-running instance-starting launch-record-mismatch launch-revoked launcher-released not-drained not-drained-run not-exited not-held not-holder not-recipient not-retired revoke-refused revoked role-already-held room-not-open room-thread-name-taken run-ended run-not-ended run-revoked session-clear session-clear-cancelled session-clear-complete session-clearing session-exists session-name-too-long session-not-found session-op-conflict session-retired session-revision-stale thread-already-held thread-exists thread-instance-mismatch thread-instance-missing thread-not-found thread-required thread-required-reply-to-thread-message thread-required-use-thread-send thread-revoked",
|
||
"Role/session: current holder and lifecycle fence",
|
||
"Read current session/status and ask the launcher or owner to finish the supported lifecycle transition. A stale or ended run must not reclaim another holder's identity."
|
||
);
|
||
group(
|
||
"apikey-invalid callback-url-invalid harness-off harness-refused key-quota-no-model-key login-state-unknown model-catalogue-unavailable model-harness-incompatible model-key-collision model-provider-unavailable models-ambiguous models-invalid models-unconfirmed models-write-refused priority-invalid priority-unconfirmed priority-write-refused provider-not-allowed proxy-config-invalid proxy-down proxy-first-output-invalid proxy-init-failed proxy-key-invalid proxy-key-issue-failed proxy-key-refused proxy-key-revoking proxy-open proxy-revoke-revision-conflict proxy-rotate-grace-invalid proxy-uncertain thinking-unsupported",
|
||
"R1/R3: owner-managed model and provider configuration",
|
||
"Ask the owner to inspect the provider configuration through its supported controls; never put keys or callback contents in messages."
|
||
);
|
||
group(
|
||
"block-recipient block-reply-required block-sender message-recipient-refused message-sender-refused tester-reply-required tester-thread-human user-reply-required user-thread-human",
|
||
"Role messaging: permitted sender, recipient and reply context",
|
||
"Read my_rails and use only a permitted target and the required reply context. Ask the owner if the permitted route is unavailable."
|
||
);
|
||
group(
|
||
"command-not-granted credential-file credential-revoke-failed credential-unknown credential-leak gitea-reach-unknown gitea-reach-wider gitea-user-admin gitea-user-disabled gitea-user-foreign gitea-user-gone gitea-user-orphan grant-admin-missing grant-admin-nothing-left grant-admin-rotation-due grant-busy grant-chief-only grant-lost grant-revoke-failed grant-revoke-running grant-token-unknown grants-revoking remote-not-granted remote-host-mismatch remote-not-fork scope-changed",
|
||
"R1/R8: scoped and revocable access",
|
||
"Ask the owner to inspect the scoped access and binding state through the supported access controls; do not supply credentials in a call or widen your own grants."
|
||
);
|
||
group(
|
||
"outcome-unknown outcome-unknown-revoked revision-conflict revision-conflict-revoked",
|
||
"R2/R3: current revision and verified effect",
|
||
"Read the latest status, revision and receipts before retrying. Verify whether an uncertain effect already happened, and use the current revision for any new attempt."
|
||
);
|
||
group(
|
||
"confirm-required",
|
||
"R2/R3: explicit confirmation of the current operation",
|
||
"Read the current status and obtain the required confirmation through the supported human path."
|
||
);
|
||
group(
|
||
"decision-closed decision-consumed decision-mismatch decision-not-approved decision-not-eligible decision-not-found decision-not-held decision-stale supersede-refused",
|
||
"Role decisions: current, matching, approved and single-use decision",
|
||
"Read the current decision, its route and its resolution and consumption receipts. Obtain the operation's matching approval from the permitted resolver before acting; a consumed approval cannot be reused."
|
||
);
|
||
group(
|
||
"decision-not-allowed",
|
||
"Role authority: no free-text decision channel",
|
||
"Use the role's permitted message path to report the need to a person; do not use another decision channel."
|
||
);
|
||
group(
|
||
"decision-required",
|
||
"Role authority and R4: approval before acting",
|
||
"Read my_rails. Raise a decision for the action and its permitted arbiter; hard waits go to a person. Use blocking false when there is no task."
|
||
);
|
||
group(
|
||
"decision-route-refused",
|
||
"Role messaging: decision close route",
|
||
"Ask the owner to inspect the raiser and resolver messaging policy; do not route around the refused close path."
|
||
);
|
||
group(
|
||
"definition-not-hireable instance-kept launch-not-configured no-chief-of-staff organization-busy organization-definition-refused organization-instance-referenced organization-instance-retired role-end-refused staff-request-refused",
|
||
"Role configuration and protected instance controls",
|
||
"Read the permitted configuration/status and ask the owner or configured chief to repair it through the supported path. Do not edit policy to bypass the refusal."
|
||
);
|
||
group(
|
||
"definition-holds-credential",
|
||
"R1: no held credential in an organization definition's role text",
|
||
"Ask the organization owner to remove the credential from the named definition and key, then restart the bus, relaunch the agent or issue the credential again. For a hire, deny it and have the chief raise it again without that text. Do not copy the text anywhere to inspect it."
|
||
);
|
||
group(
|
||
"definition-scan-unreadable",
|
||
"R1/R3: a credential is issued only after every organization's definitions are checked",
|
||
"Ask the instance owner to repair the organization file the bus cannot read, then issue the credential again. Nothing was stored."
|
||
);
|
||
group(
|
||
"field-writer task-already-archived task-archived task-conflict task-create-conflict task-create-uncertain task-not-archived task-not-found task-position-full task-project-refused task-scope-required task-subject-required",
|
||
"Role task ownership, allowed fields and current task state",
|
||
"Read the current task and assigned role. Use the permitted task operation with current evidence; ask the PM for scope or assignment changes through the decision path."
|
||
);
|
||
group(
|
||
"task-required",
|
||
"Role decisions: a blocking decision belongs to a task",
|
||
"Supply the task_ref for this work, or raise with blocking false when there is no task."
|
||
);
|
||
group(
|
||
"fork-foreign gitea-admin-unavailable gitea-failed gitea-not-configured gitea-not-declared host-busy host-changed host-creative-role host-enrolled host-failed host-in-use host-key-mismatch host-line-left host-not-configured host-not-declared host-not-enrolled host-not-granted host-not-ready host-remove-failed host-unknown publish-busy publish-unknown",
|
||
"Role access: declared service, host or remote and verified outcome",
|
||
"Check the supported access/status read and ask the owner to repair the declared service or grant. If an effect is uncertain, verify its receipt before retrying."
|
||
);
|
||
group(
|
||
"human-required",
|
||
"R4/R8: person-only operation",
|
||
"A person must perform or approve this operation through its supported human path; an agent must not retry as a person."
|
||
);
|
||
group(
|
||
"land-unknown no-push not-a-reviewer ref-moved self-review stale-commit verdict-exists verdict-not-approve verdict-not-found verdict-stale work-not-yours work-ref",
|
||
"Role review and landing: independent verdict on the current work",
|
||
"Read the latest work and review receipts. Obtain the required independent review or matching merge decision for the current commit before retrying."
|
||
);
|
||
group(
|
||
"library-fetch-no-grant library-not-configured library-notice-store-failed library-write-no-grant library-write-refused web-failed web-not-configured web-not-granted",
|
||
"Role tools: granted and configured web/library access",
|
||
"Read my_rails and the permitted service status. Use only granted tools; ask the owner to repair unavailable service configuration."
|
||
);
|
||
group(
|
||
"message-not-found no-subject not-assistant operation-not-found operation-not-open",
|
||
"R7/role scope: visible object and allowed operation",
|
||
"Use the caller's permitted reads to locate current context, then retry only the supported operation. Ask the owner if it remains unavailable."
|
||
);
|
||
group(
|
||
"not-authorized",
|
||
"Role authority: held action or approved decision",
|
||
"Read my_rails and use the applicable decision path; ask the owner to inspect grants if no supported path exists."
|
||
);
|
||
group(
|
||
"not-configured project-already-archived project-archived project-exists project-not-archived project-not-configured project-not-found project-record-invalid project-remote-configured project-remote-invalid project-remote-library project-remote-protected project-remote-unknown project-spec-human-only system-type-not-enabled tracker-not-store usage-not-configured",
|
||
"R3/role scope: configured project and service state",
|
||
"Read the supported project/service status and ask its owner to repair missing configuration or state before retrying."
|
||
);
|
||
group(
|
||
"not-resolver",
|
||
"Role resolve right and decision route",
|
||
"Only the routed resolver holding the matching decision.resolve right may resolve. Read my_rails and notify that resolver."
|
||
);
|
||
group(
|
||
"prd-arbiter-unavailable prd-authority-refused prd-changes-requested prd-decision-closed prd-not-approved prd-self-approval request-access-refused request-closed request-evidence-required request-expired request-failed request-not-configured request-not-found request-not-taken request-origin-refused request-project-refused request-revision-conflict request-selection-refused request-tracker-refused request-verification-refused requirement-snapshot-refused requirement-snapshot-required requirement-snapshot-revoked spec-unconfirmed stale-spec",
|
||
"Role workflow: current admitted request and approved requirements",
|
||
"Read the current request, requirements and decision state. Ask the responsible PM or routed arbiter to supply the missing current evidence before continuing."
|
||
);
|
||
group(
|
||
"processing-audit-conflict processing-control-unsafe processing-uninitialized processing-generation-changed processing-halted processing-state-invalid storage-refused storage-unavailable",
|
||
"R2/R3: available audited storage and processing state",
|
||
"Stop the refused operation and report the processing or storage state to the owner. Resume only after the supported status shows the condition is repaired."
|
||
);
|
||
group(
|
||
"read-only",
|
||
"Role/session: read-only capability",
|
||
"Use the permitted reads. Ask the owner or an authorized writer to perform the change."
|
||
);
|
||
group(
|
||
"reserved-event",
|
||
"R2: trusted append-only evidence",
|
||
"Use the typed operation that records its own evidence; never emit a reserved event directly."
|
||
);
|
||
group(
|
||
"role-not-chief",
|
||
"R9: only the configured chief manages hires",
|
||
"Send the staffing need to the configured chief through an allowed message path."
|
||
);
|
||
group(
|
||
"unauthenticated",
|
||
"R7: authenticated caller identity",
|
||
"Ask the launcher to restore the caller's own authenticated session; never borrow another capability."
|
||
);
|
||
group(
|
||
"request-timeout request-too-large incomplete-request invalid-response response-too-large unknown-tool tool-failed capacity-full",
|
||
"R3/role tools: bounded protocol and available capacity",
|
||
"Check the tool schema and narrow oversized requests. For a timeout, inspect status and receipts before retrying; never assume an uncertain operation did not happen."
|
||
);
|
||
// Finite error vocabularies forwarded by the project's, library's and request's
|
||
// typed adapters are part of the same table, not an unhelpful unknown-code path.
|
||
group(
|
||
"project-busy library-sync-busy",
|
||
"Role storage: exclusive write or sync already in progress",
|
||
"Wait for the current operation to finish, read its status, then retry once the lock is clear."
|
||
);
|
||
group(
|
||
"stale-base library-accept-stale",
|
||
"R2/R3: current file or served revision",
|
||
"Read the latest file or library status and its current revision. Reconcile the intended change before retrying with that base; never overwrite a newer change blindly."
|
||
);
|
||
group(
|
||
"citation-cross-universe citation-invalid citation-missing citation-unavailable citation-unfetched citations-over-limit playground-cited-as-canon reply-invalid",
|
||
"Role replies: validated citations, provenance and scope",
|
||
"Use permitted library, spec or web reads and supply a valid reply with current citations in the allowed universe and scope. Narrow oversized citation lists; never invent provenance."
|
||
);
|
||
group(
|
||
"invalid-request-admission invalid-request-effect invalid-request-event invalid-request-plan invalid-request-projects artifact-path-invalid artifact-type-refused",
|
||
"R3: typed request plan, delivery and evidence schema",
|
||
"Check the current request's tool schema and correct the plan, artifact path or evidence. Delivery requires the supported self-contained HTML artifact and matching verification evidence."
|
||
);
|
||
group(
|
||
"prd-admission-revoked prd-author-invalid prd-candidate-invalid prd-candidate-required prd-candidate-size prd-candidate-stale prd-requirement-invalid",
|
||
"Role PRD workflow: current candidate, authors and admission",
|
||
"Read the current request, candidate, requirements, mode and approval. Ask the PM to correct or submit the current candidate through the supported workflow; never approve your own authorship."
|
||
);
|
||
group(
|
||
"request-question-open request-question-closed request-question-mismatch request-phase-refused request-attachment-mismatch request-delivery-required request-document-refused",
|
||
"Role request workflow: current phase, question and selected attachment",
|
||
"Read intake_status and follow its current question, wait or delivery step. A pending question needs its answer before another question; use only the operation and attachment valid for the current phase."
|
||
);
|
||
group(
|
||
"request-effect-conflict request-effect-unprepared request-mode-revision-conflict request-operation-conflict request-plan-binding-refused request-plan-path-collision request-plan-path-refused request-project-collision",
|
||
"R2/R3: current request revision and bound operation",
|
||
"Read the current request status, plan and operation receipts. Recover an existing operation before retrying; use a new operation ID only for a new intended operation, and never bypass a path or project collision."
|
||
);
|
||
group(
|
||
"request-notification-unavailable request-services-unavailable library-credential-missing library-human-missing library-mapping-invalid library-problem-code library-remote-invalid library-state-invalid library-diverged library-accept-invalid",
|
||
"R1/R3: owner-configured service, mapping and accepted library state",
|
||
"Read the supported service or library status and ask the owner to repair the missing binding, mapping or accepted state. Check existing operation receipts before retrying an uncertain effect."
|
||
);
|
||
group(
|
||
"library-commit library-git library-push-failed project-commit-uncertain project-init-cleanup",
|
||
"R2/R3: verified repository effect and recovery",
|
||
"Read current repository status and receipts to determine what already happened. Report an uncertain commit, push or cleanup to the owner before any new write; do not retry an uncertain effect blindly."
|
||
);
|
||
group(
|
||
"project-author project-dirty project-git project-id project-invalid project-no-commit project-not-declared project-not-empty project-path project-read-commit project-read-content project-read-missing project-read-path project-record-path project-records-conflict project-records-missing project-remote project-repository tester-project-area",
|
||
"Role project scope: declared repository, clean state and allowed paths",
|
||
"Read the permitted project status and file metadata. Correct the declared project or allowed path when possible; ask the owner to repair repository state or identity. Preserve existing changes and never bypass repository or path checks."
|
||
);
|
||
group(
|
||
"project-record-unchanged",
|
||
"R2: no new record effect for unchanged content",
|
||
"Read the current record and its existing commit receipt. If it already matches the intended content, use that evidence instead of retrying the same write."
|
||
);
|
||
group(
|
||
"library-write-story-path library-revert-not-agent",
|
||
"Role library writes: supporting paths and permitted agent-owned commits",
|
||
"Use only the supporting paths and agent-owned commit reversals permitted by the library tool. Preserve story and canon files; ask the owner when the requested edit is outside that scope."
|
||
);
|
||
group(
|
||
"query-argument-invalid query-chapter-ambiguous query-item-too-large query-universe-unknown",
|
||
"Role library reads: known universe, unambiguous selection and bounded result",
|
||
"Read the permitted library index, choose a known universe and an unambiguous book or chapter, and narrow the query or requested range before retrying."
|
||
);
|
||
export const REFUSALS = Object.freeze(Object.fromEntries(entries));
|
||
const UNKNOWN = Object.freeze({ rail: "R3: fail closed", nextStep: "Report the refusal code to the responsible owner and inspect supported status; do not bypass the refusal." });
|
||
export const refusalGuidance = code => Object.hasOwn(REFUSALS, code) ? REFUSALS[code] : UNKNOWN;
|