Repository navigation
mcpx: owner-only elicitation broker store (0700/0600) with migration on open (#1676) - #1724
Conversation
|
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 2 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. Comment |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ace892baa0
ℹ️ 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".
| for _, suffix := range []string{"", "-wal", "-shm"} { | ||
| src, dst := legacyPath+suffix, dest+suffix |
There was a problem hiding this comment.
Serialize migration before exposing the destination database
When a legacy store has uncheckpointed WAL data (for example, after a daemon crash), concurrent daemon and CLI opens can permanently lose pending questions. This loop publishes elicit.db before moving its -wal and -shm files; another OpenAt then sees the destination, skips migration, and calls Open(dest), which initializes the database without the legacy WAL. Moving the sidecars afterward does not repair that connection and can result in their contents being discarded on close. I reproduced this interleaving with SQLite: a committed pending row disappeared and remained missing after reopening. Protect migration and destination opening with a shared cross-process lock, and only expose a complete, consistent migrated store.
Useful? React with 👍 / 👎.
| return nil, err | ||
| } | ||
| return elicit.Open(filepath.Join(dir, "elicit.db")) | ||
| return elicit.OpenAt(a.Paths.State, filepath.Join(dir, "elicit.db")) |
There was a problem hiding this comment.
Update the e2e seeder to use the relocated store
TestElicitationsCanBeListedAndAnsweredFromTheCommandLine and TestACredentialQuestionIsRoutedToAHuman initialize the store with elicit list, then call seedElicitation in internal/e2e/e2e_test.go:2443–2457. That helper still opens state/logs/elicit.db, whereas this call now initializes only state/elicit/elicit.db. Consequently, both tests fail during seeding because the legacy directory or its elicitations table does not exist, before reaching their assertions. Update the helper to resolve the database through elicit.StorePath; the full test suite run by .github/workflows/mcpx.yml includes these tests.
Useful? React with 👍 / 👎.
…t-store # Conflicts: # pkgs/mcpx/docs/spec/conformance-matrix.md
…ed e2e via StorePath (#1676) Codex review on #1724: (P1) concurrent daemon+CLI opens could see the destination DB before its WAL sidecar moved and lose questions that live only in the legacy WAL - OpenAt now holds an flock on the store directory across migration and first open, with a regression test racing concurrent opens against an uncheckpointed-WAL legacy store. (P2) the e2e elicitation seeder still opened state/logs/elicit.db, failing both elicitation e2e tests in CI - it now resolves the store through elicit.StorePath.
|
🤖 Agent note · fixes pushed (queue task 1893, lane B resume) Addressing both Codex findings + the merge conflict, in
Local (laptop) verification: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: badb3628d2
ℹ️ 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".
| if err := migrateStore(legacyPath, dest); err != nil { | ||
| if _, derr := os.Stat(dest); derr != nil { |
There was a problem hiding this comment.
Preserve the complete store when a migration step fails
If migrating the main database succeeds but copying its WAL fails—for example, because a cross-filesystem destination runs out of space—dest already exists, so this branch suppresses the migration error and proceeds to open an incomplete store. Committed questions present only in the WAL can then disappear, and subsequent opens skip migration because the destination exists. Reproducing an interrupted WAL copy with SQLite produced a destination that opened successfully but contained no pending rows, including after reopening. Preserve a recoverable complete source and only open the destination after every required migration step succeeds; destination existence alone does not establish success.
Useful? React with 👍 / 👎.
…t-store # Conflicts: # pkgs/mcpx/docs/spec/conformance-matrix.md
Implements #1676 — Phase 1 of #1675, per triage task 1884 ruling. Landing this also clears the Phase 1 gate for #1677 (task 1885) and half the #1678 gate (task 1886).
Change
elicit.StorePath(stateDir)— the single helper resolving the broker store:<state>/elicit/elicit.db. Both open sites use it via the new sharedelicit.OpenAt(stateDir, legacyPath):OpenBroker(legacy source:<state>/logs/elicit.db)broker()(legacy source:<effective logging.dir>/elicit.db— logging.dir honoured for the migration source only, destination is always<state>/elicit/)officialclientharness is swapped too, so it keeps answering questions from the store the daemon actually uses.defaults.DirMode(0700), DB/WAL/SHM at 0600, chmod-if-looser, idempotent under concurrent daemon+CLI open; a tightening failure is a returned error. The shared logs directory mode is unchanged.elicitation-state-storage-protectedretired — registered as covered by the new tests;docs/spec/conformance-matrix.mdregenerated (diff is exactly that requirement).Tests (laptop)
go test ./internal/elicit/— pass, including 4 new tests: fresh-open modes by stat (0700 dir / 0600 file), legacy migration with a pending question preserved and answerable, pre-loosened modes re-tightened on open, concurrent opens.go test ./internal/daemon/ ./internal/cli/— pass.go test ./internal/conformance/ -run TestMatrix— pass after regen.go build ./...— pass.Queue task 1893 · branch
queue/1893-1676-elicit-storeNeed help on this PR? Tag
@codesmith-botwith what you need.