Repository navigation
fix(host): remove the socket directory once it holds no socket - #239
Conversation
destroy, reconcile and the host's shutdown rmdir the Home's socket directory after they unlink a socket, and leave a directory that still holds one. The host retries its mkdir, chmod and bind when another session's destroy removed the directory in between. Refs #227
|
@codex review |
|
@codex security review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
Security findingsAdvisory findings (1)ℹ️ 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 Review: Didn't find any major issues. 👍 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. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af1b7ec7ea
ℹ️ 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".
…t directory listenInSocketDirectory (lifecycle.ts) now runs the mkdir, chmod and listen retry for the host and for doctor's socket check. doctor's cleanup also removes the Home's socket directory once it is empty.
# Conflicts: # .agents/skills/verify-session-lifecycle/coverage.json
|
@codex review |
|
@codex security review |
|
Codex Review: Didn't find any major issues. Bravo. 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". |
There was a problem hiding this comment.
🛡️ Codex Security Review
Here are some automated security review suggestions for this pull request.
Reviewed commit: 6acfc10b8f
ℹ️ About Codex security reviews in GitHub
This is an experimental Codex feature. Security reviews are triggered when:
- You comment "@codex security review"
- A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review
Once complete, Codex will leave suggestions, or a comment if no findings are found.
An unusual rmdir error (EBUSY, EPERM) at host shutdown or after doctor's socket check is logged at debug level instead of crashing the host after its final manifest write.
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! 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". |
Why
The operator wants the open issues he filed in coder/agent-tty fixed and landed. #227 reports that a harness with one throwaway Home per run leaves an empty folder under
/tmp/agent-tty/per run (11,005 on one shared host) and a stale Home Registry entry.What changed
removeSocketDirectoryIfEmptyrunsrmdiron the Home's socket folder after each socket unlink. It runs indestroy(recordDestroyed), inreconcileSessionafter a host crash, and in the host's own shutdown. A folder that still holds another session's socket (ENOTEMPTYorEEXIST) or is already gone (ENOENT) stays as it is.listenInSocketDirectoryrunsmkdir,chmodandlistenup to 5 times. It retries when the folder vanished in between, because a teardown in the same Home removed it. libuv reports a bind in a missing folder asEACCES. The host anddoctor's socket check both use it, anddoctoralso removes the folder after its check.Scope
gcderegisters registered Homes whose folder is gone, since feat(home-registry): Home Registry + dashboard Home picker #131. A live check on main showed the stale entry gone aftergcand the Home inderegisteredHomes.gc --homeandAGENT_TTY_HOMEstay scoped to one Home and do not touch the registry, by design.destroycleans it up, and changingreconcileSessionfor terminal manifests is a separate change.Blast Radius
Session start-up and teardown of every session. The removal never deletes a socket, because
rmdirfails on a folder that is not empty. The host's listen retry covers the one new window, where a folder vanishes betweenmkdirand the bind.Verification
test/integration/socket-directory.test.ts: 8 tests fail on main and pass here. They cover destroy with two sessions in one Home,destroy --force, a host whose program exits, a reconcile after a host crash,doctorwith and without a folder that vanishes before its bind, and a folder that a preload removes before the host'schmodor bind (on main,createexits 6).destroy: socket dir kept (0 entries) FAIL, this branch givesdestroy: socket dir removed PASS. 48 parallel create and destroy pairs in one Home all passed and left no folder.npm run typecheck,npm run lintandnpm run format:checkexit 0.vitest run test/unit: 1595 tests pass.vitest run --maxWorkers=1 --retry=2ontest/integration(4 shards, 268 tests) andtest/e2e(3 shards, 34 tests) pass. The e2e color-grid screenshot test, a known load flake, needed retry x2. The lifecycle skill'scheck.shpasses all 52 runs, andcoverage.jsonis synced after the merge of main.Closes #227
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh