Repository navigation
fix(storage): keep valid Home registry entries when one entry is invalid - #186
Conversation
The test writes two valid entries and one invalid entry, reads the registry, then upserts a third Home. On main the read returns an empty list and the upsert rewrites the file with only the new Home. _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
The registry schema validated the whole homes array at once. One invalid entry failed the parse, the read returned an empty list, and the next upsert rewrote homes.json with only the new Home. Home list, gc and the dashboard then lost every other registered Home. The read now checks each entry on its own and drops only the invalid ones, as the schema comment intended. The stale comment path now names src/storage/homeScope.ts. _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
|
@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 Review: Didn't find any major issues. Already looking forward to the next diff. 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. |
Why
ThomasK33 asked to fix the open code problems that the EGM drift review found in coder/agent-tty. One problem is in the Home registry. One invalid entry in
homes.jsonmade the read return no Homes. The nextcreatethen rewrote the file with only the new Home, sohome list,gcand the dashboard lost every other registered Home.What changed
versionmust be a number andhomesmust be an array.src/dashboard/homeScope.ts. It now namessrc/storage/homeScope.ts.src/storage/README.mdregistry read bullet now says the read drops only invalid entries.Scope
Blast Radius
Only the registry read changes. For a file with a bad entry,
create,home list,home forget,gcand the dashboard now see the valid Homes. For a valid, missing or corrupt file the result is the same as before.Verification
npx vitest run test/unit/storage/homeRegistry.test.ts: the new test fails on main (the read returns[]) and passes with the fix.XDG_STATE_HOMEon a temp folder: on main,upsertHome('/homes/gamma')rewrote the file with only gamma. With the fix, the file keeps alpha and beta and drops the bad entry.npx vitest run --maxWorkers=1over the homeRegistry, homeScope, create and home-list unit tests and the gc integration test: 38 passed.mise run format-check,mise run lintandmise run typecheckare clean.Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh