Skip to content

fix(storage): keep valid Home registry entries when one entry is invalid - #186

Merged
ThomasK33 merged 5 commits into
mainfrom
fix/storage-home-registry-entries
Oct 29, 2026
Merged

ThomasK33 merged 5 commits into
mainfrom
fix/storage-home-registry-entries

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

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.json made the read return no Homes. The next create then rewrote the file with only the new Home, so home list, gc and the dashboard lost every other registered Home.

What changed

  • The registry read checks each entry on its own and drops only the invalid ones. The file-level check stays: version must be a number and homes must be an array.
  • A comment named src/dashboard/homeScope.ts. It now names src/storage/homeScope.ts.
  • A unit test writes two valid entries and one invalid entry, reads the registry, upserts a third Home, and reads the file back.
  • The src/storage/README.md registry read bullet now says the read drops only invalid entries.

Scope

  • Covers the per-entry check on the registry read.
  • Keeps the entry schema strict, so an entry with an unknown field still drops out.

Blast Radius

Only the registry read changes. For a file with a bad entry, create, home list, home forget, gc and 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.
  • A probe with XDG_STATE_HOME on 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=1 over the homeRegistry, homeScope, create and home-list unit tests and the gc integration test: 38 passed. mise run format-check, mise run lint and mise run typecheck are clean.

Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: xhigh

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`_
@ThomasK33
ThomasK33 marked this pull request as ready for review October 29, 2026 22:55
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T22:56:47.715529Z a145862 Manual request
🔒 Security Review ✅ Completed 2026-10-29T22:57:36.878507Z a145862 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: a1458620f9

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: a1458620f9

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ 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.

@ThomasK33
ThomasK33 added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit 057cb33 Oct 29, 2026
12 checks passed
@ThomasK33
ThomasK33 deleted the fix/storage-home-registry-entries branch October 29, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant