Repository navigation
fix(reset): confirm databases, not their transient WAL sidecars - #5810
Merged
Merged
Conversation
A SQLite -wal/-shm sidecar exists while any connection has its database open. The daemon's own pinned read opens the index between the CLI preview and the daemon's target resolution, so the resolved set gained sidecars the preview never listed and every reset of an open tier was refused as "reset targets changed since confirmation". reset_confirmation_paths now owns the confirmed identity for both the CLI and the daemon: a sidecar whose database is also a target is deleted with it but is not part of what the operator confirmed. The test daemon's coordinator loop now signals readiness from inside the running loop, as the production writer loop does, and waits on thread events rather than fixed 2-5 s wall clocks that fail under host load. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Sinity
enabled auto-merge (squash)
September 29, 2026 08:36
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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. |
Sinity
added a commit
that referenced
this pull request
Sep 29, 2026
## Summary Realigns 11 tests that fail on master. Each encodes a contract that a merged PR changed on purpose. Production code is unchanged. ## Problem These tests failed at master 1beb2e5 (baseline agentctl job 2441, `devtools test --on-default-branch`). Beads: polylogue-cp3z5 (lineage validation) and polylogue-bn8gg (facade `record_context_ledger`). The other items are in polylogue-6bhuy, which also lists items owned by sibling PRs. | Test | Contract change | | --- | --- | | `tests/unit/devtools/test_lineage_validation.py` (all 21) | The hand-built index lacks `messages.fields_digest` and the derived schema identity stamp. Every reader refuses an unstamped derived tier as `SchemaSkew` ("expected <digest>, found None"). | | `test_facade_contracts.py::test_no_undiscovered_async_methods` | `record_context_ledger` (#5722) and `get_session_summaries` are in no contract set. | | `test_facade_contracts.py::test_archive_facet_buckets_count_unique_sessions_for_duplicate_hits` | #5703 moved deduplication into the search-scope walk. The unscoped path yields each session once by construction, so the duplicate case is a search hit. | | `test_preamble.py::test_precompact_uses_scheduler_and_records_real_boundary_context` | The precompact path awaits `record_context_ledger` (#5722). The mock was a plain `MagicMock` attribute, and the other test in the file set it twice. | | `test_manual_contract.py::test_published_examples_use_live_operation_vocabularies_and_preconditions` | `read`'s `view` is now `Literal[...] \| None`. `typing.get_args` on the union yields the Literal and `NoneType`, not the members. | | `test_write_effects.py::test_deferred_insight_invalidation_follows_a_repointed_index` | #5727 moved profile invalidation into the admitted transaction, so no deferred reopen by path is left to follow. | | `test_mutation_actuators.py::...::test_production_tag_and_metadata_writes_use_user_overlay_policy` | #5727 made tag writes that change a row invalidate the search cache. | | `tests/unit/cli/test_status.py::...::test_sinex_status_reads_the_active_archive_file_set` | #5722: publication mode comes from the loaded config, and the file set from `resolve_runtime_config()`. | | `tests/unit/cli/commands/test_status.py::...::test_configured_override_url_is_not_refused` | #5722: a non-built-in daemon URL is read over HTTP `GET /api/status`. | ## Solution Each test now exercises the current contract and keeps its anti-vacuity condition: - **Lineage validation.** The fixture declares `fields_digest` and stamps the current identity with the production `stamp_derived_schema_identity`. - **Facade.** Both methods are classified. `get_session_summaries` gains coverage in `test_archive_tiers_api_reads_native_sessions`: requested ids key the result, and an unresolved id is omitted. The facet test drives two hits for one session through the search scope. - **Manual contract.** The vocabulary is read through unions, and the test asserts `"messages"` is in it, so an empty read cannot pass. - **Write effects.** The test now proves the invalidation commits and rolls back with the caller's transaction. An effect that opened its own connection would survive the rollback. - **Tag overlay.** Expects exactly one invalidation per changed tag write, and none for metadata writes or the no-op re-add. - **Status.** The URL-override test runs a real local HTTP server and asserts only `/api/status` was requested. ## Verification - `agentctl job start polylogue pytest_focused --workspace <wt> -- tests/unit/devtools/test_lineage_validation.py tests/unit/api/test_facade_contracts.py tests/unit/context/test_preamble.py tests/unit/agent_integration/test_manual_contract.py tests/unit/archive/test_write_effects.py tests/unit/operations/test_mutation_actuators.py tests/unit/cli/test_status.py tests/unit/cli/commands/test_status.py`: job 2632, `devtools test: PASSED exit=0`, 582 passed. Five tests passed only on rerun. Each failed first with `DaemonWriterOwnerLoopStopped ... daemon.operation_journals.startup` or a 5 s bridge `TimeoutError` in the test daemon stack; that race is fixed in #5810. - `agentctl job start polylogue verify_quick --workspace <wt>`: job 2633, succeeded. ## Self-review - **Production route.** Each rewritten test calls the production function (`stamp_derived_schema_identity`, `_invalidate_insights_effect` on a real connection, `_status_operation_result` against a real HTTP listener, `ArchiveStore` tag writes). None asserts a mock's own behaviour. - **Loosening.** No assertion was dropped. The facet and write-effects tests change input shape to match the current route, and each keeps a condition that fails if the named behaviour regresses. - **Scope.** Test-only; no derived-identity closure file changes. ## Residuals None known for these tests. The daemon-stack startup race behind the five reruns is addressed in #5810. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
polylogue resetrefused every reset of an open database tier. The confirmed target identity now names databases, not their transient WAL sidecars. Separately, the test daemon stack stops failing under host load.Problem
At master, 11
tests/unit/cli/test_reset.pycases (allTestReset*daemon-route cases) failed withreset targets changed since confirmation; preview the targets again(baseline agentctl job 2441; bead polylogue-6bhuy).The CLI previews the reset targets, then submits them as
expected_targets. The daemon re-resolves them in_reset_targetsand compares the two sets. Both lists include-wal/-shmsidecars that exist at the moment of listing. A sidecar exists exactly while some connection has its database open. The daemon's own pinned operation read opensindex.dbbetween the CLI preview and the daemon's resolution, so the daemon's set gainedindex.db-wal/-shmand the comparison refused. An operator hits the same refusal whenever anything has the tier open.Solution
reset_confirmation_pathsinpolylogue/operations/daemon_mutations.pyowns the confirmed identity for both sides. It includes a sidecar only when its database is not itself a target. The CLI submits that set, and the daemon compares against it. Sidecars are still resolved and deleted with their database; they are only left out of what the operator confirmed.tests/infra/daemon_operations.py: the coordinator loop now sets readiness from inside the running loop (loop.call_soon), as the production writer loop does. Before, a bridge admitted beforerun_forevercould seeis_running()false and refuse the startup write. The fixed 2-5 s startup and shutdown waits are replaced with waits on the thread or loop itself, bounded by pytest-timeout. The startup bridge uses the production bound. These waits failed on a loaded host (load average ~27 during these runs).Verification
agentctl job start polylogue pytest_focused --workspace <wt> -- tests/unit/cli/test_reset.py tests/unit/cli/test_daemon_client.py tests/unit/api/test_writer_boundary.py tests/unit/cli/test_archive_maintenance_cli.py: job 2599,devtools test: PASSED exit=0, 130 passed.agentctl job start polylogue verify_quick --workspace <wt>: job 2598, succeeded.test_confirmation_names_databases_not_their_transient_sidecars: a preview taken beforeindex.db-walexists is accepted after the sidecar appears. A preview that omits an added cache directory is still refused. Anti-vacuity: comparing sidecars as part of the identity refuses the first request.Self-review
_archive_database_targetsand the daemon's_reset_targetsboth list sidecars. Both now reduce through the one helper, so they cannot disagree about identity. The duplicated target listing itself predates this PR and is unchanged.Residuals
Other daemon-stack tests that were load-sensitive may have causes beyond these waits. They are tracked in the sibling master-health PRs.
🤖 Generated with Claude Code
https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg