Repository navigation
fix(daemon): name the archive at every write under a root-bound lease - #5782
Conversation
#5727 made a root-bound writer lease refuse any write that omits its archive identity. #5769 fixed the lifecycle and several daemon ops writers; the routes below still refused or wrote to a re-resolved root. - Pass archive_root at the remaining daemon, schema, security and storage write opens. - Daemon-emitted lifecycle and live-batch events name the daemon's archive instead of re-resolving the ambient root. - Nested write_lease re-entry checks the held lease's own identity; it raised "omitted archive identity" under any root-bound lease. - SQLiteBackend over an established archive admits it through the read-only format-marker proof when the caller holds no lease, so the live batch probing Polylogue.backend is not refused (#5727 made the constructor run the lease-gated active-root bootstrap every time). - A process-wide arming no longer saves and restores the thread-local flag, which left a thread armed after out-of-order exits (#5722). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
…acts The run route reads operation_runtime.embedding_convergence from the API server (#5727), so the fake server declares it. Since #5691 a cancelled compute owner stops its retained preparation, so the raw owner test asserts nothing is published on cancel and the next pass publishes the session and its FTS rows. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
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: d234fefbcd
ℹ️ 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".
…luded The unleased SQLiteBackend branch now makes no filesystem change: the directory creation and index chmod move to the writer-admitted branch. It also opens the index read-only with schema validation, so a stale derived identity raises SchemaSkew instead of being served. _emit_live_batch_event requires the daemon's archive root; its tests name an isolated archive whose ops.db the readers resolve. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Summary
tests/unit/daemon/test_daemon_cli.pyfailed on master because of a production defect, not the dependency bump. #5727 made a root-bound writer lease refuse any write that omits its archive identity, but it left callers that open without one. On fddc7a1 the daemon could not start:DaemonLifecycle.startopenedops.dbunnamed underpolylogued's root-bound lease. #5769 has since fixed the lifecycle and several daemon ops writers. This PR fixes the routes that were still refused and realigns three tests with contracts that later PRs changed.Problem (evidence)
devtools test tests/unit/daemon/test_daemon_cli.pyon plain origin/master 4cbf83b, with no lockfile bump:29 failed, the same set as the bumped run. That rules out starlette, uvicorn, watchfiles, ruff, hypothesis and networkx.UnleasedWriteError: open_daemon_connection(.../ops.db) omitted archive identity for writer daemon.lifecycle.start, raised while the daemon started. The tests' ownwatch stopped,server stoppedandshutdown marker failedexpectations never ran. The 29th was the fix: Codex review debt: surfaces (51 findings) #5727 pidfile message change.SQLiteBackend.__init__now runs the lease-gatedinitialize_active_archive_rooton every construction, even for an established archive. The live batch readsPolylogue.backendoutside the lease, so each intake item came backretryable: UnleasedWriteError: active archive bootstrap requires the daemon write lease.write_lease(actor)re-entry calledrequire_write_leasewithout a root, so any derivation publish under a root-bound lease raised "omitted archive identity".devtools test --on-default-branch tests/unit/daemon/test_daemon_cli.py tests/unit/daemon/test_daemon_lifecycle.py tests/unit/storage/test_write_lease.pygives151 passed, 14 failed.Solution
Production (
fix(daemon)commit):archive_rootat the write opens that still omitted it. These are the FTS automerge, judgment automation, daemon assertion mutation, schema drift sampling, schema sampling and verification, secret scan, blob GC history, sqlite-vec runtime, the non-daemon branch ofopen_initialized_tier_connection, andconnection_context, which gains the parameter.archive_root_path.write_leasere-entry checks the held lease's own identity. It no longer checks an absent one.initialize_backend_stateruns the active-root bootstrap only when the caller may write: the bootstrap is needed, a lease is held, or enforcement is off. A daemon-armed caller without a lease gets the read-onlyassert_archive_format_lineageproof. An established archive therefore still has to prove its lineage marker, as fix: Codex review debt: surfaces (51 findings) #5727 intended.arm_write_lease_enforcement(process_wide=True)no longer saves and restores the thread-local flag. fix: Codex P2 review debt: polylogue/cli part 1 (25 findings) #5722's overlapping-arming test exits out of order, which restored a stalearmed=Trueand left the pytest thread armed for every later test intest_write_lease.py.Tests, each disposition against the PR that changed the contract:
UnleasedWriteErrorplus 13watch/server stoppedandshutdown marker failedtest_pidfile_remains_locked_until_admitted_writers_are_drainedtest_an_orphaned_service_retains_archive_ownership_on_the_production_route(TimeoutError)health_checkbecause the lifecycle start raisedtest_daemon_watcher_hints_wake_fair_intake_and_canonical_derivation×4test_cold_build_*×4,test_daemon_startup_catch_up_and_restart_repair_session_profilestest_run_daemon_services_waits_for_fts_startup_before_watcher×2operation_runtime.embedding_convergencetest_raw_owner_cancellation_settles_publication_and_fts(fails on the current tip)..._stops_preparation_and_the_next_pass_publishes: cancellation publishes nothing, and the next pass publishes the session and its FTS rowstest_archive_bound_lease_can_delegate_without_dropping_identityadopted is lease, but adoption returns a per-thread view by designNew regression tests, each naming its anti-vacuity condition: nested re-entry inherits the outer archive identity; an unleased backend admits an established archive read-only and still refuses one without a marker; lifecycle start and the signal marker persist under a root-bound lease.
Verification
devtools test tests/unit/daemon/test_daemon_cli.py tests/unit/daemon/test_daemon_lifecycle.py tests/unit/storage/test_write_lease.py tests/unit/cli/test_cli_write_authority.py tests/unit/daemon/test_daemon_events_endpoint.py tests/unit/storage/test_write_guard.py tests/unit/daemon/test_write_coordinator.py tests/unit/daemon/test_judgment_automation.py tests/unit/daemon/test_secret_scan_sweep.py tests/unit/daemon/test_standing_queries.py tests/unit/daemon/test_standing_queries_default_evaluator.py tests/unit/daemon/test_standing_query_clock.py tests/unit/mcp/test_mcp_call_log.py tests/unit/pipeline/test_schema_drift_sentinel_ingest.py tests/unit/schemas/test_drift_sentinel.py tests/unit/schemas/test_drift_sentinel_sampling.py tests/unit/security/test_secret_scan.pyat 3a56a1e:devtools test: PASSED,445 passed.devtools verify --quickat 3a56a1e:verify: PASSED.Residuals
devtools schema closurereports these touched files as IN:write_lease.py,async_sqlite.py,connection_profile.py,bootstrap.py,blob_gc.py,sqlite_vec_runtime.pyandsampling_db.py. The derived schema identity may move, so this must land before a fresh build starts.polylogue.daemon.eventsis first imported under apatch("polylogue.paths.archive_root"), which binds the mock into the module.open_profiled_connectionstill has noarchive_rootfor write profiles. Every current caller uses a read profile.arm_write_lease_enforcement(armed=False, process_wide=True)suppressor no longer clears a thread-local arming. Nothing calls that combination.🤖 Generated with Claude Code
https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg