Skip to content

fix(bin): let captain-hold complete inventory an existing call held for another origin - #123

Merged
Pibomeister merged 2 commits into
mainfrom
fm/fm-hold-cross-origin-existing-call
Nov 3, 2026
Merged

Pibomeister merged 2 commits into
mainfrom
fm/fm-hold-cross-origin-existing-call

Conversation

@Pibomeister

Copy link
Copy Markdown
Owner

Intent

bin/fm-captain-hold.sh complete exits 1 when a report inventories an existing captain call whose origin is a different task. AgentKit example: existing call agent-kit-unattended-operator-setup has origin agent-kit-unattended-audit, and the resume report lists it (agent-kit-mate data/ak-resume-council-20261102/main-actions.md under ~/orca/workspaces/firstmate/). captain-hold-lifecycle forbids registering the same question twice, so the report cannot complete honestly.

What Changed

  • bin/fm-captain-hold.sh complete now takes --cross-origin <task-id>. A report can list a captain call that is already held for a different origin, so nobody has to register the same question twice. The flag accepts only an exact task id for a call that is still open, still held for the captain, and recorded under a different origin. The flag never changes the call or its recorded origin.
  • These entries join decision_keys= and are also written to a new cross_origin_keys= metadata line. Later complete and verify passes check them for durability only and skip the origin comparison. A later answer or a move of the call to another origin keeps the gate green. The refusal for a mismatched origin now names --cross-origin as a fix. The complete output lists the cross-origin calls.
  • docs/captain-hold-lifecycle.md and the captain-hold-lifecycle skill document the new flag. tests/fm-captain-hold-lifecycle.test.sh adds coverage for the new behavior.

Risk Assessment

✅ Low: The fix round does what the user decided. It removes the origin pin and the re-label guard, and it records cross-origin entries by id only. It keeps every attestation refusal the user asked for: unknown ids, closed calls, same-origin calls, calls with no recorded origin, and the origin itself. I traced the moved-call and repair sequences through the code, and both now complete and verify without rewriting the call's origin.

Testing

I made a disposable lab home and built the AgentKit case in it with the real script and the real tasks-axi backlog: the call agent-kit-unattended-operator-setup is held for agent-kit-unattended-audit, and ak-resume-council-20261102 inventories it. A plain complete still exits 1, and its message now names the --cross-origin path. complete --cross-origin exits 0 and writes cross_origin_keys= to the metadata. The backlog keeps one row for the call, and the call's origin stays the same. verify passes. Unknown ids, closed calls, the origin's own calls, calls with no origin, and the origin itself are all refused, and a refusal writes no attestation. After the call moves to another origin and then gets an answer, verify and a repeat complete both still pass. An ordinary entry whose call moved fails verify with the repair advice, and the advised --cross-origin repair then works. I also ran the two focused regression tests, and both pass. I removed the lab home afterwards. This change has no UI, so the evidence is CLI transcripts.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Resume report that lists another origin's call as a plain entry is refused, and the message names the --cross-origin path ✅ pass live live-lab-transcript.txt, section S1: exit 1, message 'list an existing call from another origin with --cross-origin agent-kit-unattended-operator-setup'
Resume report completes with --cross-origin on the existing call, with no second registration and the call's origin unchanged ✅ pass live live-lab-transcript.txt, section S2: exit 0; metadata has cross_origin_keys; one backlog row; 'Captain hold origin: agent-kit-unattended-audit' unchanged; verify exit 0
Adversarial: --cross-origin refuses an unknown id, the origin's own call, the origin itself, a call with no origin, and a closed call, and writes no attestation ✅ pass live live-lab-transcript.txt, section S3: every refusal exits 1 with a specific message; the third-review metadata has 0 decisions_reviewed lines
After the cross-origin call moves to another origin and is then answered, verify and a repeat complete stay green (no pin dead end) ✅ pass live live-lab-transcript.txt, section S4: verify exit 0 after the move, complete exit 0, verify exit 0 after the answer
An ordinary entry whose call moved fails verify with repair advice, and the advised --cross-origin repair works ✅ pass live live-lab-transcript.txt, section S5: verify exit 1 naming --cross-origin ak-resume-own; complete --cross-origin exit 0; verify exit 0
Evidence: Live lab-home CLI transcript (AgentKit scenario)

Source: Live lab-home CLI transcript (AgentKit scenario)

## Setup: the audit holds the operator-setup call
$ fm-captain-hold.sh hold agent-kit-unattended-operator-setup --title Operator setup call --reason captain must choose the unattended operator setup --repo agent-kit --origin agent-kit-unattended-audit
agent-kit-unattended-operator-setup
[exit 0]

## S1 resume report lists it as an ordinary entry (the original failure)
$ fm-captain-hold.sh complete ak-resume-council-20261102 agent-kit-unattended-operator-setup
fm-captain-hold: captain-held task agent-kit-unattended-operator-setup was held for origin agent-kit-unattended-audit, not ak-resume-council-20261102; list an existing call from another origin with --cross-origin agent-kit-unattended-operator-setup, hold a task for ak-resume-council-20261102, or list the right one
[exit 1]

## S2 resume report lists it as --cross-origin
$ fm-captain-hold.sh complete ak-resume-council-20261102 --cross-origin agent-kit-unattended-operator-setup
complete: ak-resume-council-20261102 captain-call inventory reviewed (agent-kit-unattended-operator-setup) [existing calls held for other origins: agent-kit-unattended-operator-setup]
[exit 0]

--- resume meta tail
decisions_reviewed=1
decision_keys=agent-kit-unattended-operator-setup
cross_origin_keys=agent-kit-unattended-operator-setup
--- call origin unchanged:
  body: "Captain hold set: 2026-11-03T02:22:06Z\nCaptain hold origin: agent-kit-unattended-audit\n\nOrigin: agent-kit-unattended-audit"
--- backlog count of operator-setup rows:
1
$ fm-captain-hold.sh verify ak-resume-council-20261102
verified: ak-resume-council-20261102 captain-call inventory
[exit 0]

## S3 adversarial refusals
$ fm-captain-hold.sh complete agent-kit-third-review --cross-origin agent-kit-no-such-call
fm-captain-hold: no captain call agent-kit-no-such-call exists in this home's configured backlog (data directory /var/folders/93/6w1bxqxn2yb92mt6rmt5zbzw0000gn/T//fm-lab.ivFp2c/data); --cross-origin lists only an existing call held for another origin
[exit 1]

$ fm-captain-hold.sh hold ak-own-call --title Own --reason captain must decide --repo agent-kit --origin agent-kit-third-review
ak-own-call
[exit 0]

$ fm-captain-hold.sh complete agent-kit-third-review --cross-origin ak-own-call
fm-captain-hold: captain call ak-own-call is held for agent-kit-third-review itself; list it without --cross-origin
[exit 1]

$ fm-captain-hold.sh complete agent-kit-third-review --cross-origin agent-kit-third-review
fm-captain-hold: origin agent-kit-third-review cannot be its own captain-call inventory entry; hold a separate captain task for the call and list that task
[exit 1]

$ fm-captain-hold.sh hold ak-noorigin --title No origin --reason captain must decide --repo agent-kit
ak-noorigin
[exit 0]

$ fm-captain-hold.sh complete agent-kit-third-review --cross-origin ak-noorigin
fm-captain-hold: captain call ak-noorigin records no origin; list it without --cross-origin
[exit 1]

$ fm-captain-hold.sh hold ak-closed --title Closed --reason captain must decide --repo agent-kit --origin agent-kit-unattended-audit
ak-closed
[exit 0]

$ fm-captain-hold.sh answer ak-closed --decision-file /var/folders/93/6w1bxqxn2yb92mt6rmt5zbzw0000gn/T//fm-lab.ivFp2c/d1
answered: ak-closed
[exit 0]

$ fm-captain-hold.sh complete agent-kit-third-review --cross-origin ak-closed
fm-captain-hold: captain call ak-closed is closed or no longer held for the captain; --cross-origin inventories only a call that is still open
[exit 1]

--- third-review meta has no attestation:
0
## S4 call moves to another origin, then is answered; resume gate stays green
$ fm-captain-hold.sh hold agent-kit-unattended-operator-setup --reason captain must choose the unattended operator setup --origin agent-kit-third-review
agent-kit-unattended-operator-setup
[exit 0]

$ fm-captain-hold.sh verify ak-resume-council-20261102
verified: ak-resume-council-20261102 captain-call inventory
[exit 0]

$ fm-captain-hold.sh complete ak-resume-council-20261102 --cross-origin agent-kit-unattended-operator-setup
complete: ak-resume-council-20261102 captain-call inventory reviewed (agent-kit-unattended-operator-setup) [existing calls held for other origins: agent-kit-unattended-operator-setup]
[exit 0]

  body: "Captain hold set: 2026-11-03T02:22:06Z\nCaptain hold origin: agent-kit-third-review\n\nOrigin: agent-kit-unattended-audit"
$ fm-captain-hold.sh answer agent-kit-unattended-operator-setup --decision-file /var/folders/93/6w1bxqxn2yb92mt6rmt5zbzw0000gn/T//fm-lab.ivFp2c/d2
answered: agent-kit-unattended-operator-setup
[exit 0]

$ fm-captain-hold.sh verify ak-resume-council-20261102
verified: ak-resume-council-20261102 captain-call inventory
[exit 0]

## S5 ordinary entry whose call moved is repaired via --cross-origin
$ fm-captain-hold.sh hold ak-resume-own --title Resume own --reason captain must decide --repo agent-kit --origin ak-resume-council-20261102
ak-resume-own
[exit 0]

$ fm-captain-hold.sh complete ak-resume-council-20261102 ak-resume-own
complete: ak-resume-council-20261102 captain-call inventory reviewed (agent-kit-unattended-operator-setup,ak-resume-own) [existing calls held for other origins: agent-kit-unattended-operator-setup]
[exit 0]

$ fm-captain-hold.sh hold ak-resume-own --reason captain must decide --origin agent-kit-unattended-audit
ak-resume-own
[exit 0]

$ fm-captain-hold.sh verify ak-resume-council-20261102
fm-captain-hold: captain-held task ak-resume-own was held for origin agent-kit-unattended-audit, not ak-resume-council-20261102; list an existing call from another origin with --cross-origin ak-resume-own, hold a task for ak-resume-council-20261102, or list the right one
[exit 1]

$ fm-captain-hold.sh complete ak-resume-council-20261102 --cross-origin ak-resume-own
complete: ak-resume-council-20261102 captain-call inventory reviewed (agent-kit-unattended-operator-setup,ak-resume-own) [existing calls held for other origins: agent-kit-unattended-operator-setup ak-resume-own]
[exit 0]

$ fm-captain-hold.sh verify ak-resume-council-20261102
verified: ak-resume-council-20261102 captain-call inventory
[exit 0]

decisions_reviewed=1
decision_keys=agent-kit-unattended-operator-setup,ak-resume-own
cross_origin_keys=agent-kit-unattended-operator-setup,ak-resume-own
Evidence: Focused cross-origin regression tests

Source: Focused cross-origin regression tests

ok - complete refuses an entry held for another origin and flags one with none recorded
ok - complete attests an existing call held for another origin without re-registering it

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 2 issues found → auto-fixed ✅
  • ⚠️ bin/fm-captain-hold.sh:1059 - The origin-pin enforcement is not required by the intent, and it creates a permanent dead end whose error message gives a remedy that cannot work. The intent only needs a report to inventory an existing call held for another origin without registering it twice. It does not ask for later origin changes to be refused. Sequence: complete R --cross-origin X pins X=A. Then hold X --reason ... --origin B runs, which is a supported move exercised by the new test. verify R now fails with 'review the call again and re-run complete'. Re-running can never succeed. bin/fm-captain-hold.sh:1981 skips re-attestation for an already pinned entry, bin/fm-captain-hold.sh:1988 keeps the old pin because pins only grow, and bin/fm-captain-hold.sh:1993 refuses again. The test confirms this at tests/fm-captain-hold-lifecycle.test.sh, where complete --cross-origin sample-moved-call must fail. Scout teardown calls verify before removing state (bin/fm-teardown.sh:3635), so R's teardown stays blocked until someone hand-edits the metadata, and docs/captain-hold-lifecycle.md documents no such repair for this case. Recommended remedy: remove the pin comparison and record only which entries are cross-origin (for example cross_origin_keys=&lt;id&gt;,...), so verify applies the durability check alone. If the pin stays, the captain must decide what re-attestation does, and complete --cross-origin must then be able to re-pin after a fresh review. Same invariant also at bin/fm-captain-hold.sh:1905 (pin parsing), bin/fm-captain-hold.sh:1939 (pin creation) and bin/fm-captain-hold.sh:2066 (verify's pin check).
  • ⚠️ bin/fm-captain-hold.sh:1983 - The guard that refuses to re-attest an ordinary entry as cross-origin is not required by the intent, and it contradicts the new refusal advice. bin/fm-captain-hold.sh:1066 now tells the operator to 'list an existing call from another origin with --cross-origin $entry'. Sequence: complete R X attests X with no recorded origin or with origin R. Then hold X --reason ... --origin B moves it. verify R and complete R both fail with the new advice. Following it, complete R --cross-origin X, fails here with 'X is already attested as a call held for R', which is also false because X is now held for B. Removing the guard loses no safety: attest_cross_origin_entry already refuses same-origin calls (bin/fm-captain-hold.sh:1937) and calls with no origin (bin/fm-captain-hold.sh:1934). Without the guard, this path becomes a working repair for the moved call. Recommended remedy: remove the guard and its test block.

🔧 Fix applied.
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • Live validation: ✅ go - 5 of 5 scenarios driven live against the product
Scenario Result Live Evidence
Resume report that lists another origin's call as a plain entry is refused, and the message names the --cross-origin path ✅ pass live live-lab-transcript.txt, section S1: exit 1, message 'list an existing call from another origin with --cross-origin agent-kit-unattended-operator-setup'
Resume report completes with --cross-origin on the existing call, with no second registration and the call's origin unchanged ✅ pass live live-lab-transcript.txt, section S2: exit 0; metadata has cross_origin_keys; one backlog row; 'Captain hold origin: agent-kit-unattended-audit' unchanged; verify exit 0
Adversarial: --cross-origin refuses an unknown id, the origin's own call, the origin itself, a call with no origin, and a closed call, and writes no attestation ✅ pass live live-lab-transcript.txt, section S3: every refusal exits 1 with a specific message; the third-review metadata has 0 decisions_reviewed lines
After the cross-origin call moves to another origin and is then answered, verify and a repeat complete stay green (no pin dead end) ✅ pass live live-lab-transcript.txt, section S4: verify exit 0 after the move, complete exit 0, verify exit 0 after the answer
An ordinary entry whose call moved fails verify with repair advice, and the advised --cross-origin repair works ✅ pass live live-lab-transcript.txt, section S5: verify exit 1 naming --cross-origin ak-resume-own; complete --cross-origin exit 0; verify exit 0
  • Live run in a disposable lab home made with bin/fm-lab-home.sh create, using the real bin/fm-captain-hold.sh and the real tasks-axi markdown backlog. Fleet override env vars were unset. Steps: hold, complete (plain and --cross-origin), verify, refusal cases, move, answer and the repair path.
  • tests/fm-captain-hold-lifecycle.test.sh, limited to test_complete_refuses_an_entry_held_for_another_origin and test_complete_accepts_an_existing_call_held_for_another_origin
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

…or another origin

complete --cross-origin <task-id> attests an existing, still-open captain call whose recorded origin is a different task, so a report that lists it no longer has to register the same question twice. Unknown ids, closed or released calls, same-origin calls, and calls with no recorded origin are refused, and the call itself is never changed. The entry's origin is pinned in cross_origin_keys= metadata, and both complete and verify refuse a pinned entry whose recorded origin later changes.
@Pibomeister
Pibomeister marked this pull request as ready for review November 3, 2026 03:04
@Pibomeister
Pibomeister merged commit a897e0e into main Nov 3, 2026
27 checks passed
cursor Bot pushed a commit that referenced this pull request Nov 3, 2026
Bring in #122, #124, #123, and #121. No textual conflicts; keep the
published-head resync owner on main's driving-block signature,
freshen_spawn_worktree_base, and t3code skip.

Co-authored-by: Eduardo Picazo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant