Repository navigation
fix(gate): keep each PID namespace's admissions in a ledger of its own - #703
Conversation
Quest-Claim: ece40e4c52c8533c
A gate in its own PID namespace, such as a bwrap --unshare-pid sandbox sharing the home directory, could not see other gates' processes and dropped their admissions a minute after admission. The ledger path now names the namespace and a format version, and a running gate re-records a dropped admission on every sample with a warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 55 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
There was a problem hiding this comment.
ℹ️ No critical issues — two minor suggestions inline.
Reviewed changes
I reviewed the ledger path split by PID namespace and format version, and the per-sample admission check in measure. The claimDirectory and measure tests pass locally (vitest -t "records|ledger|account without a home", plus test/admission.test.ts).
- Versioned, per-namespace ledger path —
claimDirectory()now returnsadmissions-v2/<host>[-pid<inode>], andpidNamespace()reads/proc/self/ns/pidon Linux. - Admission re-recorded instead of failing —
measurereads its admission on every sample. If another gate dropped it,measureadds the last known entry back and reports this through the newlostcallback, whichgated()turns into a stderr warning. - Docs and tests — the README ledger paragraph is updated, there is a new test for re-recording while the cores stay the same, and the
claimDirectorytests pin the namespace explicitly.
I checked one more thing: once the command ends, measure cannot add an admission back. stop.abort() runs synchronously while measure is waiting in sleep, and every fileHost ledger operation is synchronous.
claude-opus-5-5 | 𝕏
…EADME Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Reviewed the two commits since the prior pullfrog review. All three prior threads are already resolved.
- Versioned agents ledger —
agentsDirectoryinsrc/cli/admission.tsnow usesagents-v${LEDGER_VERSION}, and theLEDGER_VERSIONdoc comment covers both ledgers. The path still resolves to a sibling of the gate ledger directory. - README rewrap — the ledger paragraph wraps at 80 columns and mentions
agents-v2/<hostname>. - Quest file removal —
quest/m0/gate-ledger-compat.mdis deleted as the quest finishes.
The other "agents" paths in src/cli/agent.ts are separate spawn records, so they are unaffected.
claude-sonnet-5-5 | 𝕏

Finishes
quest/m0/gate-ledger-compat.md.Cause (reproduced)
On Linux, a gate checks whether another gate is still running by looking up its process ID. A gate in its own PID namespace that shares the home directory (here,
bwrap --dev-bind / / --unshare-pid --proc /proc quest gate true) can't see the host's processes. So it treats every admission older than a minute as finished and drops it. It also records itself aspid 3, and gates on the host drop that entry the same way. I reproduced this on the live ledger: the outer gate had been runningsleep 130for 70 s, and its admission disappeared once the sandboxed gate ran. The outer gate kept running without any error, because its measured cores stayed at 0. That's the silent case the quest describes. The quest build didn't matter: two unsandboxed gates, and the pinned build next to a current one, each running 80 s commands, never lost an admission.Changes
~/.cache/quest/admissions-v2/<host>[-pid<ns inode>], which adds a format version (LEDGER_VERSION) and the PID namespace. Gates that can't check each other's processes no longer share a ledger, and neither do builds with different ledger formats.measurechecks for its admission on every sample, not only when the cores change. If the admission is missing, it records it again (sameat, pid, and start) and warns on stderr. It no longer fails the command.quest agent's ledger is versioned too, asagents-v2/<host>[-pid<ns inode>], so oneLEDGER_VERSIONbump separates both ledgers.Choices made without asking
/proc/self/ns/pid. Other platforms keep the plain<host>name.Models
Suggested follow-ups
🤖 Generated with Claude Code
(Written by Claude Opus 5.5 with low)
Review
Rewritten by
quest reviewafter each round.Head: c102457
Base: origin/main at 1ac7193
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1d6e0-0921-7520-9f36-65b33bdd8c99, round 2Score: 9/10,
The incremental changes correctly version the agents ledger alongside the gate ledger, with no actionable bugs found; builds and tests were not run as instructed.Rounds: 2; findings 0: fixed 0, refuted 0, open 0
Findings: none
Reviewer: Codex, gpt-6.1-sol, low effort, shadow
Session:
01a1d6e0-0922-7151-9cca-e9a34e2e5044Rounds: 1; findings 0: fixed 0, refuted 0, open 0