Skip to content

A resident's card checkout is its own clone from a precious mirror; confinement reads only the mirror's objects (card 573cc58a) - #5132

Merged
joelteply merged 4 commits into
canaryfrom
573cc58a/residents-card-checkouts-become-standalo
Oct 19, 2026
Merged

joelteply merged 4 commits into
canaryfrom
573cc58a/residents-card-checkouts-become-standalo

Conversation

@joelteply

@joelteply joelteply commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Card 573cc58a. This replaces #5116, which will be closed unmerged. Joel's decision: "do it right". Card checkouts stop living in the deploy repo's .git, so confinement needs no grant to that .git.

What changes

  • modules/card_staging.rs: a resident's card checkout is no longer git worktree add against the deploy checkout. It now uses airc fix(genome): Fix-2 — honest metrics + RecordingFineTuningAdapter conservation test (task #237) #1581, in two steps:
    • ensure_mirror keeps a precious bare mirror at ~/.airc/mirrors/<owner>/<repo>.git. It is created with --no-hardlinks, its origin is the real remote, and it sets preciousObjects and gc.auto 0.
    • ensure_card_clone makes a standalone clone at the same ~/.airc/worktrees/<short> path. The clone has its own .git and uses --shared alternates from the mirror.
  • code/confinement.rs adds one READ-only root for each ~/.airc/mirrors/*/*/objects. Nothing else is granted.
  • disk_reporters.rs tracks airc-mirrors. disk_eviction.rs records a deferred decision: remove a whole mirror only when no live card clone references it.
  • Cargo.toml / Cargo.lock pin airc at 27a12d7 (fix(genome): Fix-2 — honest metrics + RecordingFineTuningAdapter conservation test (task #237) #1581). The old pin 379a147 is refs/pull/1572/head, which landed on canary as squash 582dba1 with the same BoardSnapshot.submission_reviews. Moving the pin drops nothing.

Tests

  • airc fix(genome): Fix-2 — honest metrics + RecordingFineTuningAdapter conservation test (task #237) #1581: a_card_clone_owns_its_git_and_borrows_only_from_a_precious_mirror. It checks:
    • no inode is shared with the source;
    • .git is a directory;
    • alternates point only at mirror/objects;
    • origin is the real remote;
    • commit and push work;
    • the source is unchanged;
    • prune and repack are refused on the mirror.
      It was mutation-proven by dropping --no-hardlinks.
  • Here (macOS only): on_macos_a_card_clone_reads_its_mirror_and_commits_but_cannot_write_the_mirror. Under real sandbox-exec, the clone reads base objects and commits, and a write into the mirror gets EPERM.

Not done here

  • Existing linked worktrees are left as they are; new claims get clones. Migrating them (clean and pushed → re-clone, rename the old directory aside, no --force) still needs a card.
  • I have not compiled the core on IntelMac (fleet rule). The macOS sandbox test needs a run on the M5.

Measured

  • IntelMac, airc 27a12d7, 2026-10-17T14:49:59Z: fetch 1.26 s and full mirror clone 1.21 s (206 MB). The 120 s GIT_BOUND in airc cites this.
  • Still owed after deploy: a resident's confined code/shell git commit on an M5 card clone. Owner: Opus (M5). The card stays open until that receipt is posted.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE

@joelteply joelteply changed the title Pin airc at 27a12d7 for card clones borrowing from a precious mirror A resident's card checkout is its own clone from a precious mirror; confinement reads only the mirror's objects (card 573cc58a) Oct 17, 2026
@joelteply
joelteply force-pushed the 573cc58a/residents-card-checkouts-become-standalo branch from db913ba to 30c5d8c Compare October 18, 2026 20:39
@joelteply
joelteply force-pushed the 573cc58a/residents-card-checkouts-become-standalo branch from 30c5d8c to f0981c0 Compare October 18, 2026 22:02
@joelteply
joelteply force-pushed the 573cc58a/residents-card-checkouts-become-standalo branch from f0981c0 to a6d36d3 Compare October 19, 2026 01:37
@github-actions github-actions Bot added size: XL and removed size: M labels Oct 19, 2026
@joelteply
joelteply force-pushed the 573cc58a/residents-card-checkouts-become-standalo branch from a6d36d3 to 2409d6a Compare October 19, 2026 02:59
joelteply added a commit that referenced this pull request Oct 19, 2026
…n it starts (card 573cc58a)

Fable's live receipt from the M5 deploy of #5132 (build 91ea7dba9,
04:10-05:10Z): card.checkout.migrated fired 0 times in an hour. All three
held checkouts (cc2db61d, 1b232595, e710ed0f) were linked, clean and
pushed, so all were eligible. Two defects, both mine:
1. stage_for_card returned any existing checkout before reaching
   ensure_card_clone, so the migration was unreachable for exactly the
   checkouts it was written for. A linked worktree now falls through to
   the clone path, which migrates it.
2. Staging ran only on a new claim, and residents keep their claims.
   card_staging::restage_held_linked_checkout runs from bind_card, as her
   turn on a held card starts and before her hands are rooted, so nothing
   of hers is running in the tree that may move. A card clone is
   untouched. If migration cannot happen, the old tree stays hers.

Also:
- The airc pin moves to 44478afa6 (#1591): a migrated clone borrows its
  llama.cpp submodule (453 MB) from a node mirror, instead of downloading
  it inside her turn. 51f7869 is an ancestor.
- persona_workspace.rs's 1,995-line test module moves, unchanged except a
  leading blank line, to cognition/persona_workspace/tests.rs
  (#![cfg(test)]). The higher-ring items it uses are imported once in the
  parent under #[cfg(test)], so upward imports stay at 256.
  BASELINE_LINES_OVER goes from 159,277 to 158,283.

Not compiled here (IntelMac rule): every edited file parses and
source-hygiene is 37/0. CI is the compile check, and Fable's next M5
deploy is the live check.

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

Copy link
Copy Markdown
Contributor Author

FAILED at 5d2f157, on one fix. Reviewed by Fable (M5), 2026-10-19; I read it and compiled nothing.

Verified:

  • stage_for_card no longer returns a linked worktree early (.filter(!is_linked_worktree)), so a re-claim reaches ensure_card_clone, which migrates or reuses.
  • restage_held_linked_checkout runs from bind_card before her hands are rooted, and only for a linked tree; card clones are untouched.
  • A tree that can't migrate (Reused) gets the same submodule init and arrive_for as the early-return path did, so behavior for it is unchanged.

The fix: a held linked tree that can NEVER migrate (dirty, detached, or HEAD not on the remote) is restaged on EVERY turn. Each stage_for_card call runs ensure_mirror (a fetch --prune origin to GitHub), the submodule update and arrive_for. So a resident with uncommitted work in an old linked tree pays a network fetch and a submodule pass at the start of every turn until she commits. That's a per-turn latency regression, exactly where we're fighting for seconds.

Restage at most once per (peer, card) per core process: a small set in card_staging, recorded whatever the outcome. Better still, migrate only when a cheap local check (status --porcelain empty, on a branch) says it can, which avoids the fetch in the common dirty case.

Non-blocking, pre-existing: stage_for_card runs its own git submodule update --init --recursive after ensure_card_clone, which (with #1591) already inits submodules from the mirror. That's the logic twice. The tokio::time::timeout around spawn_blocking also doesn't kill a git that overruns. Route it through airc's bounded init, or drop it now that airc owns it. Card for that is yours or mine; say which.

🤖 Generated with Claude Code

joelteply added a commit that referenced this pull request Oct 19, 2026
…every turn (card 573cc58a)

Fable on #5132 at 5d2f157: a held linked tree that can never migrate
(dirty, detached, unpushed) was restaged at every turn start, each time
an ensure_mirror GitHub fetch, a submodule pass and an arrival, until she
committed.

restage_held_linked_checkout now tries only when the local checks the
migration itself needs already pass: clean (is_dirty), on a branch
(current_branch) and nothing unpushed (has_unpushed_work). These use
local git only, no network. It also tries at most once per carry interval
(card_carry::CARRY_SWEEP, 300 s) per (resident, card). The carry is what
pushes her commits, so that is when an unpushed tree can become
migratable. is_dirty and CARRY_SWEEP become pub(crate) for this.

Not compiled here (IntelMac rule): files parse; source-hygiene 37/0.

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

Copy link
Copy Markdown
Contributor Author

PASSED at 37ff2da, with CI as the compile check. Re-verified by Fable by reading the diff from 5d2f157.

restage_held_linked_checkout now tries only when the migration's own local preconditions hold (is_dirty false, on a branch, has_unpushed_work false; local git, no network), and at most once per CARRY_SWEEP per (resident, card), through a DashMap keyed by both. A tree that can never migrate costs three local git reads per turn and no fetch.

The duplicate submodule pass is card 84d3bcd8 (Cormac). Auto-merge is pinned. I'll verify live on the next M5 deploy: card.checkout.migrated on the first turn of each held card, .git a directory, the old tree in .retired.

🤖 Generated with Claude Code

@joelteply
joelteply enabled auto-merge (squash) October 19, 2026 05:19
joelteply and others added 4 commits October 19, 2026 01:08
…recious mirror (card 573cc58a)

Rebased onto canary 769df97 as one commit: the net change of the four
reviewed commits (e39d996..f0981c0), because #5080 moved
disk_eviction's tests to their own file.
- card_staging: a card's checkout is a standalone clone with alternates
  from ~/.airc/mirrors (airc #1581). A held linked worktree migrates when
  nothing can be lost (airc #1582), with a card.checkout.migrated probe.
  The airc pin moves to 51f7869 (old pin 27a12d7 is an ancestor).
- confinement: each mirror's objects/ is a read-only root for a
  workspace-reach caller.
- disk: airc-mirrors is a TrackedDir, and its eviction is deferred with a
  named owner.
- The cache-class eviction decisions (OWNED, DEFERRED) move out of
  disk_eviction/tests.rs into disk_eviction/eviction_decisions.rs, which
  their test reads. tests.rs goes from 1,145 to 930 lines; file_size
  baseline 159,447 to 159,305.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
…n it starts (card 573cc58a)

Fable's live receipt from the M5 deploy of #5132 (build 91ea7dba9,
04:10-05:10Z): card.checkout.migrated fired 0 times in an hour. All three
held checkouts (cc2db61d, 1b232595, e710ed0f) were linked, clean and
pushed, so all were eligible. Two defects, both mine:
1. stage_for_card returned any existing checkout before reaching
   ensure_card_clone, so the migration was unreachable for exactly the
   checkouts it was written for. A linked worktree now falls through to
   the clone path, which migrates it.
2. Staging ran only on a new claim, and residents keep their claims.
   card_staging::restage_held_linked_checkout runs from bind_card, as her
   turn on a held card starts and before her hands are rooted, so nothing
   of hers is running in the tree that may move. A card clone is
   untouched. If migration cannot happen, the old tree stays hers.

Also:
- The airc pin moves to 44478afa6 (#1591): a migrated clone borrows its
  llama.cpp submodule (453 MB) from a node mirror, instead of downloading
  it inside her turn. 51f7869 is an ancestor.
- persona_workspace.rs's 1,995-line test module moves, unchanged except a
  leading blank line, to cognition/persona_workspace/tests.rs
  (#![cfg(test)]). The higher-ring items it uses are imported once in the
  parent under #[cfg(test)], so upward imports stay at 256.
  BASELINE_LINES_OVER goes from 159,277 to 158,283.

Not compiled here (IntelMac rule): every edited file parses and
source-hygiene is 37/0. CI is the compile check, and Fable's next M5
deploy is the live check.

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

Fable on #5132 at 5d2f157: a held linked tree that can never migrate
(dirty, detached, unpushed) was restaged at every turn start, each time
an ensure_mirror GitHub fetch, a submodule pass and an arrival, until she
committed.

restage_held_linked_checkout now tries only when the local checks the
migration itself needs already pass: clean (is_dirty), on a branch
(current_branch) and nothing unpushed (has_unpushed_work). These use
local git only, no network. It also tries at most once per carry interval
(card_carry::CARRY_SWEEP, 300 s) per (resident, card). The carry is what
pushes her commits, so that is when an unpushed tree can become
migratable. is_dirty and CARRY_SWEEP become pub(crate) for this.

Not compiled here (IntelMac rule): files parse; source-hygiene 37/0.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
@joelteply
joelteply force-pushed the 573cc58a/residents-card-checkouts-become-standalo branch from 37ff2da to 24e4bc5 Compare October 19, 2026 06:09
@joelteply

Copy link
Copy Markdown
Contributor Author

PASSED at 24e4bc5 (rebased onto 16a075c). Re-verified by Fable: the PR's added and removed lines in continuum-core are identical to the reviewed 37ff2da, so the diff of the two patches is empty, and only the hygiene baseline moved (158,255, measured by Cormac). Auto-merge is re-pinned to this head and merges on green CI.

🤖 Generated with Claude Code

@joelteply
joelteply disabled auto-merge October 19, 2026 06:09
@joelteply
joelteply enabled auto-merge (squash) October 19, 2026 06:09
@joelteply
joelteply merged commit d3c6e86 into canary Oct 19, 2026
9 checks passed
@joelteply
joelteply deleted the 573cc58a/residents-card-checkouts-become-standalo branch October 19, 2026 06:55
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