Repository navigation
fix(host): read a terminal session next to the destroy marker as destroyed - #284
Conversation
|
@codex review |
|
@codex security review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: aea5277ed1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…the session when the repair fails
… session whose repair fails
|
@codex review |
|
@codex security review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb4b7f839c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review |
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
# Conflicts: # .agents/skills/verify-session-lifecycle/SKILL.md # .agents/skills/verify-session-lifecycle/coverage.json # .agents/skills/verify-session-lifecycle/model/SessionLifecycle.tla # .agents/skills/verify-session-lifecycle/scripts/check.sh # src/host/README.md
# Conflicts: # .agents/skills/verify-session-lifecycle/SKILL.md # .agents/skills/verify-session-lifecycle/coverage.json # docs/USAGE.md
…ckets when the host check throws
…main and the socket check fix
|
@codex review |
|
@codex security review |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 90480ffae1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
# Conflicts: # .agents/skills/verify-session-lifecycle/SKILL.md # .agents/skills/verify-session-lifecycle/coverage.json # .agents/skills/verify-session-lifecycle/scripts/check.sh # src/host/README.md
Why
ThomasK33 asked to work every deferred follow-up of the first autopilot round until none is left. This PR closes #265, the follow-ups after #256. Since #256,
recordDestroyedwrites an empty<session>/destroyedmarker before its destroyed write, and a reconcile that wrote over that record writes destroyed again right after its own write. Three gaps stayed open, and all three reproduce on main71d1b0c2:failed. A reconcile killed between its own write and the repair write leftfailed, afterdestroy --forcehad printeddestroyed: true. Every later reconcile skipped the terminal manifest, so the session stayedfailed.failed, andscanHomecounted the session.home list --alland the dashboard picker then showed one extra session, and after a killed reconcile they kept showing it.destroyof an ended session that failed after its marker write left the marker next toexitedorfailed, and nothing repaired it.What changed
src/host/lifecycle.tsreconcileSessionfirst checks a terminal manifest other thandestroyedfor the marker. If the marker is there,writeMarkedDestroyedwritesdestroyedfrom that copy, withhostPidandchildPidnull, the exit code kept and no failure fields. The reconcile then unlinks the socket, which adestroywhose write failed left, removes the empty Home socket folder and returns. Only adestroywrites the marker, after it stopped the session and right before its destroyed write, so the marker means thatdestroychose destroyed.listSessionsreconciled only active sessions. It now also reconciles a terminal session that is notdestroyedwhen the marker exists, solistheals items 1 and 3 itself. When that repair throws,listreads the manifest again and shows it:destroyedwhen only the socket cleanup after the write failed, and the copy it read before when the write itself failed, for example on a full disk, as before this PR.inspectcallsreconcileSessionwhen the stored record is terminal, notdestroyed, and has the marker, soinspectshowsdestroyedaslistdoes. A running session with a live host and the marker staysrunning: the marker repairs only an ended session.src/storage/homeScope.ts.scanHomeskips a session whose folder holds the marker when its status is terminal, the same rule as the repair. It asks itsScanHomeDependencies.pathExistsfor the marker.home listand the dashboard picker stay read-only and no longer count such a session.ReconcileRepairsMarked.facts.mjsreads the guard, andwriteMarkedDestroyedis covered.WitnessMarkedRepairedshows that the branch is reachable: one reconcile's first read repairs thefailedthat the other reconcile wrote.mutant-ReconcileRepairsMarkedexpects pass. The model has no crash of a reconciling process, so the repair after the reconcile's own write always runs there. The unit tests cover the crash. SKILL.md says so.docs/USAGE.md,src/host/README.md,src/storage/README.md,src/dashboard/README.mdandsrc/cli/commands/home/README.mddescribe the repair, which commands run it (list,inspect,gc) and thehome listcount.Declined, as approved by the root: deleting the marker (item 4). A reconcile that read before a
destroy's write can still write after it, and no process knows when the last such reconcile has finished. So deleting the marker would reopen the #217 race. The marker is one empty file, andgcremoves it with the session folder.Behavior changes for CLI and JSON users
destroymarked readsdestroyedafter the nextlist, also when a reconcile was killed in the middle or when thatdestroyfailed after its marker write. Before, such a session stayedfailedorexited.gcrepairs it too before it removes the folder.home listand the dashboard picker no longer count such a session.Validation
Red first. At
35bce9d8(tests only), 3 tests failed: the tworeconcileSessionrepair tests and thescanHomemarker test. The control test (anexitedsession without the marker staysexited) passed. At7ddc041e, thelisttest failed. All pass on the head.Live repro with the CLI, a killed host and a held rename (
REPLAY_HOLD), each run in an isolatedAGENT_TTY_HOMEandXDG_STATE_HOME:71d1b0c2aea5277edestroy --forceprintsdestroyed: true, then the reconcile is killed before its repair write. The nextlistshowsfaileddestroyedhome list --allwhile the repair write is held{"activeSessions":0,"totalSessions":1}destroyof anexitedsession fails after the marker (STORAGE_WRITE_ERROR). The nextlistshowsexiteddestroyedLifecycle check (
.agents/skills/verify-session-lifecycle/scripts/check.sh --update-coverage): all 66 runs as expected.currentexplored 24,208,708 distinct states,current-no-token23,413,352.WitnessMarkedRepairedis reached.coverage.jsonis synced atcb4b7f83.CI-shaped gate on
aea5277e: typecheck, lint and format pass. Unit 1736/1736. Integration shards 2 and 4 and e2e shards 1 and 3 pass. Three files failed under the 7 parallel shards and pass alone on the head:backend-selection.test.tsandexport-fixtures.test.ts(12/12 together), andrun.test.ts(14/14, plus 3/3 runs ofdetects session exit during wait before timing out).backend-selectionand theexport-fixturescolor-grid test fail the same way on main under that load.Round 2 (Codex round 1 on
aea5277e): red2c47894e(2 tests failed: the marked repair left the socket, andlist --alldropped a markedfailedsession whose repair write failed), fix8a6695fd, modelc5482b20(the repair goes on to the socket unlink),facts.mjsd875e821(the guard pattern includes the unlink), coveragecb4b7f83. Unit tests ofsrc/host,src/storageand the commands: 368/368. Alone ond875e821:lifecycle.test.ts58/58,non-reaping-init.test.ts3/3,socket-directory.test.ts9/9. A full local gate ond875e821ran at host load 130 to 180 and timed out in files that this change does not reach, so CI on the head is the full gate.Round 3 (Codex round 2 on
cb4b7f83): red749795da(listshowedfailedwhen the socket cleanup threw after the repair write), fixe845dd71. Unit 1739/1739.facts.mjsdrift 0, so check.sh did not run again.Round 4 (Codex round 3 on
e845dd71, plus the root verifier notes N1 to N3): red35ae60d5(inspect left a markedfailedsessionfailed, andscanHomeread the marker from the real filesystem), fix18336a12. Modelb8b8dbb4splits the marked repair into its read ("r_marked") and its write (ReconcileWritesMarked).b23d1214pins the terminal-status rule (a running session with a live host and the marker staysrunning; I checked that the test fails without the rule) and adds a red test forscanHome, fixed in6e0a595c. Docsb08dad39. Coveragead17bf61. Lifecycle check: all 66 runs as expected,currentexplored 24,866,000 distinct states,current-no-token24,005,824. Unit 1743/1743.lifecycleintegration 58/58 andcliintegration 65/65.Round 5 (Codex round 4 on
ad17bf61, security clean): redd22e3df4(inspectfailed when the marked repair threw, thoughlistshowed the session), fix61e81f1c(inspectreads the manifest again, aslistdoes). Docseaae86e0(thescanHomeREADME line says "ended", USAGE and the commands README name theinspectfallback).facts.mjsdrift 0, so check.sh did not run again. Unit 1745/1745.lifecycleandcliintegration 123/123. Typecheck, lint and format pass.Merge of main
307c0e99(f7aad5b8, counts3868d3b0), no Codex round. Codex round 5 oneaae86e0was clean in both lanes. Main's fix(host): freeze a program group that no scan shows before the proven kill #283 changed the model,check.sh,facts.mjsand SKILL.md, and so did this PR. Conflicts: the guard list inSessionLifecycle.tla(both new guards kept), the run list incheck.sh, two SKILL.md hunks and twosrc/host/README.mdhunks (merged word by word), andcoverage.json(rewritten bycheck.sh --update-coverage).check.shon the merge: all 68 runs as expected,current24,866,000 distinct states andcurrent-no-token24,005,824. SKILL.md now counts 68 runs and thirty guards. Unit 1888/1888.lifecycleandcliintegration 138/138. Typecheck, lint and format pass.Merge of main
142f7793(fix(host): keep sockets under a per-uid root and remove a dead host socket #288,2371636a) and two follow-ups from the root's advisor (90480ffahead). Conflicts: the SKILL.md Scope line (only the state counts, now from this run), a USAGE hunk (merged word by word) andcoverage.json. Follow-up 1:removeDeadHostSocketreturns when the host check throws, so it removes neither socket of a host it cannot judge (red7e259ab7: destroy removed the old socket under/tmp/agent-ttywhenprocess.kill(pid, 0)threw EINVAL; fix30c71732). Follow-up 2: USAGE limit 2 names umask002, under which an older version made/tmp/agent-ttymode0775, which the old-socket check refuses untilchmod g-w(f452642d, with the host README).check.shon the head: all 68 runs as expected,current25,534,376 distinct states andcurrent-no-token24,675,744 (SKILL.md updated).facts.mjsdrift 0. Unit 1922/1922.lifecycle,cli,socket-directoryandsocket-permissionsintegration 153/153. Typecheck, lint and format pass.Merge of main
374937f9(fix(host): read a group out of the CLI's pid space as running #291, fix(release): raise the Communique response token limit so release notes are not cut off #295; merge8b2863b2, coverage91d7f744), no Codex round (root's GO for a merge-only delta). Conflicts: thecheck.shrun list and asrc/host/README.mdhunk (merged word by word and checked against both sides), the SKILL.md counts (now 71 runs,CHECK_JOBS=71, eight runs that explore the whole model, thirty-one guards) andcoverage.json.check.shon the merge: all 71 runs as expected,current25,534,376 distinct states andcurrent-no-token24,675,744.facts.mjsdrift 0. Unit 1929/1929.lifecycle,cliandsocket-directoryintegration 153/153. Typecheck, lint and format pass.Deferred to the root's parking issue: Codex round 6's P2 (the marked repair unlinks only the current socket, not the old
/tmp/agent-ttyone).Closes #265
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh