Repository navigation
fix: close Codex review findings from the #5722 landing - #5778
Conversation
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: 8bd4f763b1
ℹ️ 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".
…framing Answers the Codex review on #5778: an event-only work-event write also runs inside a cold build, a cancelled MCP submission is cancelled by id before its transport thread is joined, and configuration history tells paths from commit hashes by git's record structure rather than a text prefix. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
8bd4f76 to
5657c3c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5657c3c3f9
ℹ️ 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".
Answers the second Codex round on #5778. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 091bb6f254
ℹ️ 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".
polylogue-2mw8c. - Work events: a retained agent-work-event raw is written event-only. write_parsed_session_to_archive recognizes the raw identity, keeps every stored session-owned header column, skips identity claims, active-leaf moves and header side tables, and appends instead of replacing, so live appends and replay of already-retained events keep the reconstructed session. The live producer no longer copies the header itself. - Continuations: a narrower limit keeps the token's offset and selection. - Configuration evidence: an unmapped invocation matches by its own name; history follows each commit's historical path across renames and never emits an inverted same-second interval. - Truncated orchestration topology keeps unresolved edges of retained children. - Status: only the bare-invocation probe bounds a custom endpoint's latency. - session.read exposes decoded tool_input objects. - MCP: a cancelled daemon submission waits for its transport thread and cancels the same request id before re-raising. - Manual continuations refuse an edge that would close a cycle. - Search authority counters match the API builder (matched = total, analyzed = returned window). - Stale tests fixed forward: same-second history, manual continuation route, work-event raw lookup. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
…framing Answers the Codex review on #5778: an event-only work-event write also runs inside a cold build, a cancelled MCP submission is cancelled by id before its transport thread is joined, and configuration history tells paths from commit hashes by git's record structure rather than a text prefix. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Answers the second Codex round on #5778. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg
091bb6f to
bc24cf5
Compare
…#5782) ## Summary `tests/unit/daemon/test_daemon_cli.py` failed 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.start` opened `ops.db` unnamed under `polylogued`'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.py` on 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. - 28 of the 29 were `UnleasedWriteError: open_daemon_connection(.../ops.db) omitted archive identity for writer daemon.lifecycle.start`, raised while the daemon started. The tests' own `watch stopped`, `server stopped` and `shutdown marker failed` expectations never ran. The 29th was the #5727 pidfile message change. - With the lifecycle fixed, nine more failures appeared. The same tests pass on 841bbb3, the commit before #5727. Traced causes: - `SQLiteBackend.__init__` now runs the lease-gated `initialize_active_archive_root` on every construction, even for an established archive. The live batch reads `Polylogue.backend` outside the lease, so each intake item came back `retryable: UnleasedWriteError: active archive bootstrap requires the daemon write lease`. - Nested `write_lease(actor)` re-entry called `require_write_lease` without a root, so any derivation publish under a root-bound lease raised "omitted archive identity". - Daemon-emitted events re-resolved the ambient archive root instead of the daemon's own. - On master tip 14a63dc, the three touched test files still fail 14 tests: `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.py` gives `151 passed, 14 failed`. ## Solution Production (`fix(daemon)` commit): - Pass `archive_root` at 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 of `open_initialized_tier_connection`, and `connection_context`, which gains the parameter. - Daemon lifecycle, parked-loop and live-batch events name `archive_root_path`. - Nested `write_lease` re-entry checks the held lease's own identity. It no longer checks an absent one. - `initialize_backend_state` runs 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-only `assert_archive_format_lineage` proof. An established archive therefore still has to prove its lineage marker, as #5727 intended. - `arm_write_lease_enforcement(process_wide=True)` no longer saves and restores the thread-local flag. #5722's overlapping-arming test exits out of order, which restored a stale `armed=True` and left the pytest thread armed for every later test in `test_write_lease.py`. Tests, each disposition against the PR that changed the contract: | Test(s) | Cause | Disposition | | --- | --- | --- | | 14 `UnleasedWriteError` plus 13 `watch/server stopped` and `shutdown marker failed` | lifecycle start under the root-bound lease (#5727) | production bug. #5769 fixed the lifecycle, and this PR fixes the remaining writers | | `test_pidfile_remains_locked_until_admitted_writers_are_drained` | #5727 widened the refusal wording | superseded contract. #5769 already realigned it | | `test_an_orphaned_service_retains_archive_ownership_on_the_production_route` (TimeoutError) | never reached `health_check` because the lifecycle start raised | production bug, same root cause | | `test_daemon_watcher_hints_wake_fair_intake_and_canonical_derivation` ×4 | backend bootstrap outside the lease (#5727) | production bug, fixed | | `test_cold_build_*` ×4, `test_daemon_startup_catch_up_and_restart_repair_session_profiles` | nested-lease re-entry, event root, and state leaked from the failing watcher test | production bug, fixed | | `test_run_daemon_services_waits_for_fts_startup_before_watcher` ×2 | #5727 reads `operation_runtime.embedding_convergence` | superseded test stub. The fake server declares the attribute | | `test_raw_owner_cancellation_settles_publication_and_fts` (fails on the current tip) | #5691 made a cancelled compute owner stop its retained preparation | superseded contract. Renamed to `..._stops_preparation_and_the_next_pass_publishes`: cancellation publishes nothing, and the next pass publishes the session and its FTS rows | | `test_archive_bound_lease_can_delegate_without_dropping_identity` | asserted `adopted is lease`, but adoption returns a per-thread view by design | the test was wrong when #5727 added it. It now asserts that the adopted view carries the archive identity and authorizes a write for that archive | New 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.py` at 3a56a1e: `devtools test: PASSED`, `445 passed`. - `devtools verify --quick` at 3a56a1e: `verify: PASSED`. - The head was then rebased over #5778, which touches none of these files. ## Residuals - `devtools schema closure` reports these touched files as IN: `write_lease.py`, `async_sqlite.py`, `connection_profile.py`, `bootstrap.py`, `blob_gc.py`, `sqlite_vec_runtime.py` and `sampling_db.py`. The derived schema identity may move, so this must land before a fresh build starts. - Some writers outside the daemon still resolve the ambient root: the HTTP reset event, browser capture and judgment receipt events. In production that root equals the lease root. In tests it can differ when `polylogue.daemon.events` is first imported under a `patch("polylogue.paths.archive_root")`, which binds the mock into the module. - `open_profiled_connection` still has no `archive_root` for write profiles. Every current caller uses a read profile. - An `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.com/claude-code) https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
## Summary This lands the worker-13 batch on current master. The batch covers beads polylogue-1tyq5.77, .110, .63, .53, .54 and .88. I checked each of the worker's 24 proposed fixes against master and kept 22. CTX-07 was dropped because #5778 already fixed it, and SURF-03 was dropped after master merged #5793, which fixes it the same way. Of the 74 findings, 22 are fixed here, 39 were already fixed on master, and 13 were not reached. ## Problem All 22 kept defects still reproduce on master (re-checked after merging master at 1beb2e5): - MCP search resumed from a continuation alone reported `query: ""` and lost `sort`. It also sent the default limit, which the continuation guard refuses as widening. - Personal-state pages that exceeded the response budget came back with no continuation. - Reference pipelines, list read views and completions ignored `offset`. - `read(view="messages")` for a missing session returned `internal_error`. - Discovery did not advertise the `messages` view, the `precompact` intent, the `clear_corrections` confirmation or the single-candidate evidence digest. - Compaction had three defects: - it invented a text-only hash when the archive gave none; - `pack_ref` hashed only the kept anchor refs; - the Markdown rendering showed only the aggregate drop counts. - Read overrides used `bool("false")`, so `"false"` meant true. JSON-only views also defaulted to Markdown. - Windows working-directory paths were not shortened on POSIX hosts. - Envelopes built from domain sessions had no relative time. - Orchestration `children` could point at nodes removed by topology truncation. - Excision had three defects: - marker tombstones used an `excision-marker:` ref, which fails ObjectRef validation; - excising a watch baseline left its watch enabled; - `INSERT OR IGNORE` hid ledger CHECK failures, and the content was deleted anyway. ## Solution The worker's commit is cherry-picked, with these corrections: - The compaction identity is moved into #5758's fixed-point budget loop. A fixed-width placeholder means filling in `pack_ref` does not change the measured size. - `message_transcript_window` already raises the typed `SessionNotFoundError` on master (#5728), so `read(view="messages")` maps it to `not_found`. The now-dead string-matching translation in `get_messages_paginated` is removed. - The query-excision ledger keeps only `ON CONFLICT(ledger_id) DO NOTHING`. The schema CHECKs already refuse bad rows, so the worker's extra checks before and after the insert are removed. - Repo basenames now split on both path separators, the same as working directories. - A list view's outcome now counts the whole collection, not only the returned page. - After #5793 made orchestration children a streamed section, the truncation filter narrows `children.rows`, and its test uses the new builder signature. - The worker's tests are corrected: - the relative-time and tombstone tests could not pass as written and are fixed; - the test file is renamed; - tests that only checked prose are narrowed. ## Verification After merging master at 1beb2e5 (merge commit 88afebc): - `agentctl job start polylogue verify_quick --workspace /realm/worktrees/salvage-w13` (job 2474): `verify: PASSED exit=0 ... head=88afebc6e16e`. - `agentctl job start polylogue pytest_focused --workspace /realm/worktrees/salvage-w13 -- tests/unit/mcp/test_capability_pointer_routes.py tests/unit/mcp/test_privileged_tools.py tests/unit/mcp/test_session_orchestration.py tests/unit/mcp/test_session_projection_table.py tests/unit/mcp/test_tool_discovery_contracts.py tests/unit/security/test_excision.py tests/unit/security/test_query_excision_scope.py tests/unit/surfaces/test_compaction.py tests/unit/surfaces/test_read_contract.py tests/unit/surfaces/test_session_envelope_derivation.py tests/unit/operations/test_read_view_compact.py tests/unit/agent_integration` (job 2475): after the isolated rerun, `1 failed, 7 passed`. The one failure, `test_published_examples_use_live_operation_vocabularies_and_preconditions`, fails the same way on origin/master 1beb2e5 (job 2530: `1 failed`). Before the merge, on 967e01e: - verify_quick (job 2071) passed; pytest_focused (job 2070) had 4 failures that also failed on the base (job 2056). - Anti-vacuity (job 2028): with every production file in this PR reverted to the base and the new tests kept, `36 failed`. Every new test case failed without its fix. The merge changes only the orchestration filter's target (`children.rows`), and that test still checks the same condition. ## Self-review - **Sibling sites:** the repo basename had the same separator bug as the working directory and is fixed too. The MCP `not_found` relies on the typed error master's transcript-window owner now raises (#5728). The `get` list projections are still unpaged, but no finding covers them. - **Cancellation and loops:** no new loops. In the compaction loop, only the identity assigned at return changes. - **Unbounded reads:** list views, reference members and completions now page. The facade calls behind them still load whole lists (see Residuals). - **Fail-open:** boolean overrides with an unknown spelling are refused, and a ledger CHECK failure now raises before any deletion. - **Compatibility shims:** none added. The `ValueError` string-match translation is removed. - **Removed symbols:** `_PERSONAL_STATE_PROJECTIONS` moved to `query_contracts.PERSONAL_STATE_PROJECTIONS`, with every reference updated. `session_list_projection_names` is still used elsewhere. - **Production route:** the MCP tests call the registered tools, and the excision and compaction tests call the real functions. ## Findings | key | disposition | evidence | test | |---|---|---|---| | MCP-01 / #4580:polylogue/mcp/archive_support.py:436 | fixed-already | polylogue/mcp/archive_support.py:439-483 | — | | MCP-02 / #4353:polylogue/mcp/declarations/registry.py:178 | fixed-already | polylogue/mcp/declarations/registry.py:208-233 | — | | MCP-03 / #4698:polylogue/mcp/declarations/registry.py:236 | fixed-already | polylogue/mcp/declarations/registry.py:270-285; polylogue/agent_integration/spec.py:683-710 | — | | MCP-04 / #4786:polylogue/mcp/query_contracts.py:154 | fixed-already | polylogue/mcp/server_cutover.py:325-391 | — | | MCP-05 / #5480:polylogue/mcp/server_cutover.py:87 | fixed-already | polylogue/mcp/server_cutover.py:90-92 | — | | MCP-06 / #5480:polylogue/mcp/server_cutover.py:95 | fixed-already | polylogue/mcp/server_cutover.py:100-108 | — | | MCP-07 / #4996:polylogue/mcp/server_cutover.py:326 | fixed | this PR | `tests/unit/mcp/test_privileged_tools.py::test_search_continuation_preserves_query_sort_and_omitted_limit` | | MCP-08 / #4410:polylogue/mcp/server_cutover.py:583 | not reached | polylogue/mcp/server_cutover.py:839-979 | — | | MCP-09 / #4295:polylogue/mcp/server_cutover.py:770 | fixed | this PR | `tests/unit/mcp/test_tool_discovery_contracts.py::test_personal_state_byte_budget_continuation_advances_from_nonzero_offset` | | MCP-10 / #4777:polylogue/mcp/server_cutover.py:830 | fixed | this PR | `tests/unit/mcp/test_privileged_tools.py::test_reference_relation_query_advances_requested_offset` | | MCP-11 / #4297:polylogue/mcp/server_cutover.py:856 | not reached | polylogue/mcp/server_cutover.py:1402-1404 | — | | MCP-12 / #4424:polylogue/mcp/server_cutover.py:879 | fixed | this PR | `tests/unit/mcp/test_capability_pointer_routes.py::test_capability_discovery_includes_messages` | | MCP-13 / #4424:polylogue/mcp/server_cutover.py:885 | fixed-already | polylogue/mcp/server_cutover.py:1317-1390 | — | | MCP-14 / #4424:polylogue/mcp/server_cutover.py:885 | fixed | this PR | `tests/unit/mcp/test_privileged_tools.py::test_missing_messages_session_is_not_found` | | MCP-15 / #4190:polylogue/mcp/server_cutover.py:926 | fixed-already | polylogue/agent_integration/spec.py:453-475 | — | | MCP-16 / #4190:polylogue/mcp/server_cutover.py:959 | not reached | polylogue/mcp/server_cutover.py:1585 | — | | MCP-17 / #4190:polylogue/mcp/server_cutover.py:959 | not reached | polylogue/mcp/server_cutover.py:1585 | — | | MCP-18 / #4256:polylogue/mcp/server_cutover.py:1035 | fixed | this PR | `tests/unit/mcp/test_tool_discovery_contracts.py::test_precompact_is_in_the_published_context_contract` | | MCP-19 / #4256:polylogue/mcp/server_cutover.py:1036 | fixed-already | polylogue/mcp/server_cutover.py:1680; polylogue/mcp/server_cutover.py:1007 | — | | MCP-20 / #4419:polylogue/mcp/server_cutover.py:1119 | not reached | polylogue/mcp/server_cutover.py:1702-1711 | — | | MCP-21 / #4362:polylogue/mcp/server_cutover.py:1251 | not reached | polylogue/mcp/server_cutover.py:1830-1867; polylogue/config.py:79-175 | — | | MCP-22 / #5248:polylogue/mcp/server_cutover.py:1273 | fixed | this PR | `tests/unit/mcp/test_session_projection_table.py::test_read_list_views_honor_limit_offset_and_next_page` | | MCP-23 / #5355:polylogue/mcp/server_cutover.py:1467 | fixed | this PR | `tests/unit/mcp/test_capability_pointer_routes.py::test_completions_page_against_shared_owner` | | MCP-24 / #4213:polylogue/mcp/server_cutover.py:2219 | fixed | this PR | `tests/unit/mcp/test_tool_discovery_contracts.py::test_clear_corrections_confirmation_is_discoverable_and_enforced` | | MCP-25 / #5311:polylogue/mcp/server_cutover.py:2811 | fixed | this PR | `tests/unit/mcp/test_privileged_tools.py::TestJudgeTool::test_single_candidate_shorthand_builds_a_one_item_bulk_call` | | SURF-01 / #4539:polylogue/surfaces/authority.py:65 | not reached | polylogue/surfaces/authority.py:65; polylogue/mcp/server_cutover.py:1382-1385 | — | | SURF-02 / #4197:polylogue/surfaces/compaction.py:150 | fixed | this PR | `tests/unit/surfaces/test_compaction.py::test_compaction_does_not_invent_canonical_content_hashes` | | SURF-03 / #4197:polylogue/surfaces/compaction.py:223 | fixed-already | #5793 (d1abc18): polylogue/surfaces/compaction.py:273-275; covered by tests/unit/operations/test_read_view_compact.py | — | | SURF-04 / #4197:polylogue/surfaces/compaction.py:263 | not reached | polylogue/surfaces/compaction.py:271-331 | — | | SURF-05 / #4197:polylogue/surfaces/compaction.py:276 | not reached | polylogue/surfaces/compaction.py:276-299 | — | | SURF-06 / #4197:polylogue/surfaces/compaction.py:292 | fixed | this PR | `tests/unit/surfaces/test_compaction.py::test_compaction_identity_commits_to_content_projection_and_provenance` | | SURF-07 / #4197:polylogue/surfaces/compaction.py:331 | fixed | this PR | `tests/unit/surfaces/test_compaction.py::test_compaction_markdown_preserves_fidelity_manifest_and_omission_anchors` | | SURF-08 / #4201:polylogue/surfaces/payloads.py:1064 | not reached | polylogue/surfaces/payloads.py:1172-1176 | — | | SURF-09 / #4201:polylogue/surfaces/payloads.py:1196 | fixed | this PR | `tests/unit/surfaces/test_session_envelope_derivation.py::test_domain_session_rows_keep_relative_time` | | SURF-10 / #4539:polylogue/surfaces/payloads.py:3947 | fixed-already | polylogue/daemon/http.py:4805-4807 | — | | SURF-11 / #4201:polylogue/surfaces/query_rows.py:106 | fixed | this PR | `tests/unit/surfaces/test_session_envelope_derivation.py::test_session_row_shortens_windows_and_posix_working_directories` | | SURF-12 / #4321:polylogue/surfaces/read_contract.py:65 | fixed | this PR | `tests/unit/surfaces/test_read_contract.py::test_read_boolean_false_overrides_are_not_truthy_strings` | | SURF-13 / #5515:polylogue/surfaces/read_contract.py:78 | fixed | this PR | `tests/unit/surfaces/test_read_contract.py::test_read_github_correlation_false_stays_disabled` | | SURF-14 / #4321:polylogue/surfaces/read_contract.py:100 | fixed | this PR | `tests/unit/surfaces/test_read_contract.py::test_default_read_formats_belong_to_their_profile` | | SURF-15 / #4321:polylogue/surfaces/read_contract.py:156 | not reached | polylogue/surfaces/read_contract.py:100-117; polylogue/surfaces/read_contract.py:159-170 | — | | CTX-01 / #4329:polylogue/context/compiler.py:263 | fixed-already | polylogue/context/compiler.py:265-284 | — | | CTX-02 / #4329:polylogue/context/compiler.py:272 | fixed-already | polylogue/context/compiler.py:292-295 | — | | CTX-03 / #4385:polylogue/context/configuration_evidence.py:84 | fixed-already | polylogue/context/configuration_evidence.py:94-96 | — | | CTX-04 / #4385:polylogue/context/configuration_evidence.py:132 | fixed-already | polylogue/context/configuration_evidence.py:137 | — | | CTX-05 / #4385:polylogue/context/configuration_evidence.py:141 | fixed-already | polylogue/context/configuration_evidence.py:144-176 | — | | CTX-06 / #4385:polylogue/context/configuration_evidence.py:159 | fixed-already | polylogue/context/configuration_evidence.py:171 | — | | CTX-07 / #4385:polylogue/context/configuration_evidence.py:180 | fixed-already | #5778 (3e9ec3d): declared-name mapping with own-name fallback; worker change dropped | — | | CTX-08 / #4385:polylogue/context/configuration_evidence.py:204 | fixed-already | polylogue/context/configuration_evidence.py:216-266 | — | | CTX-09 / #4385:polylogue/context/configuration_evidence.py:234 | fixed-already | polylogue/context/configuration_evidence.py:248-261 | — | | CTX-10 / #4256:polylogue/context/preamble.py:80 | fixed-already | polylogue/context/preamble.py:74-87; polylogue/api/archive.py:3429-3441 | — | | CTX-11 / #4634:polylogue/context/preamble.py:83 | fixed-already | polylogue/operations/facade_writers.py:415-427 | — | | CTX-12 / #4799:polylogue/context/preamble.py:371 | fixed-already | polylogue/context/preamble.py:588-601 | — | | CTX-13 / #4256:polylogue/context/scheduler.py:240 | fixed-already | polylogue/context/scheduler.py:349 | — | | CTX-14 / #4256:polylogue/context/scheduler.py:289 | fixed-already | polylogue/context/scheduler.py:425-437 | — | | AGENT-01 / #4266:polylogue/agent_integration/data/tool-contracts.json:132 | fixed-already | polylogue/agent_integration/spec.py:378-392 | — | | AGENT-02 / #4266:polylogue/agent_integration/data/tool-contracts.json:189 | fixed-already | polylogue/agent_integration/spec.py:416-421 | — | | AGENT-03 / #4266:polylogue/agent_integration/data/tool-contracts.json:288 | fixed-already | polylogue/agent_integration/spec.py:453-475 | — | | AGENT-04 / #4266:polylogue/agent_integration/data/tool-contracts.json:382 | fixed-already | polylogue/agent_integration/spec.py:511-516 | — | | AGENT-05 / #4266:polylogue/agent_integration/data/tool-contracts.json:502 | fixed-already | polylogue/agent_integration/data/tool-contracts.json | — | | AGENT-06 / #4266:polylogue/agent_integration/data/tool-contracts.json:631 | fixed-already | polylogue/agent_integration/spec.py:663-675 | — | | AGENT-07 / #5449:polylogue/agent_integration/spec.py:411 | fixed-already | polylogue/agent_integration/spec.py:410 | — | | AGENT-08 / #5449:polylogue/agent_integration/spec.py:411 | fixed-already | polylogue/agent_integration/spec.py:410 | — | | ANALYSIS-01 / #5314:polylogue/analysis/archive_models.py:109 | fixed-already | polylogue/analysis/archive_models.py:12 | — | | ANALYSIS-02 / #5608:polylogue/analysis/delegation_work_evidence_materializer.py:48 | fixed-already | polylogue/analysis/delegation_work_evidence_materializer.py:79-90 | — | | ANALYSIS-03 / #5608:polylogue/analysis/delegation_work_evidence_materializer.py:106 | fixed-already | polylogue/analysis/delegation_work_evidence_materializer.py:97-114 | — | | ANALYSIS-04 / #4678:polylogue/analysis/export_bundles.py:77 | fixed-already | polylogue/analysis/export_bundles.py:28 | — | | ANALYSIS-05 / #4864:polylogue/analysis/orchestration_evidence.py:362 | fixed | this PR | `tests/unit/mcp/test_session_orchestration.py::test_truncated_orchestration_children_belong_to_retained_topology` | | ANALYSIS-06 / #4985:polylogue/analysis/pathology.py:192 | fixed-already | polylogue/analysis/pathology.py:51 | — | | ANALYSIS-07 / #4678:polylogue/analysis/readiness.py:45 | fixed-already | polylogue/analysis/readiness.py:43 | — | | SEC-01 / #4320:polylogue/security/excision.py:574 | not reached | polylogue/security/excision.py:1091-1092; polylogue/security/excision.py:1382-1426 | — | | SEC-02 / #5452:polylogue/security/excision.py:1281 | fixed | this PR | `tests/unit/security/test_excision.py::TestApplySessionExcision::test_apply_tombstones_marker_assertions_without_retaining_content` | | SEC-03 / #4200:polylogue/security/query_excision.py:170 | fixed | this PR | `tests/unit/security/test_query_excision_scope.py::test_relation_excision_disables_only_watches_whose_baseline_was_removed` | | SEC-04 / #4200:polylogue/security/query_excision.py:176 | not reached | polylogue/security/query_excision.py:227-235 | — | | SEC-05 / #4200:polylogue/security/query_excision.py:176 | fixed | this PR | `tests/unit/security/test_query_excision_scope.py::test_a_refused_tombstone_aborts_before_any_deletion` | ## Derived-identity closure `devtools schema closure` (scratch job 1963) reports three changed files inside the closure: - `polylogue/security/query_excision.py` - `polylogue/surfaces/payloads.py` - `polylogue/surfaces/query_rows.py` All other changed production files are outside it. Land this before the next rebuild starts. ## Residuals - 13 findings were not reached: MCP-08, 11, 16, 17, 20, 21; SURF-01, 04, 05, 08, 15; SEC-01, 04. - Compaction `pack_ref` values change. - The facade list methods behind the paged MCP views still load the full list before slicing it. 🤖 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]>
…#5811) ## Summary Resumed transcript windows now read the selection and page size the continuation was minted for, on both the typed session-owner route and the generic `session.read` operation. Two stale `prose_with_refs` compiler tests are realigned with the contracts that changed under them. Tracking: beads polylogue-zeolc and polylogue-6bhuy (the compiler and transcript-window items). ## Problem At origin/master 1beb2e5 (agentctl job 2441), four tests failed: - `test_session_owner_operations.py::test_search_read_timeline_and_mcp_use_owner`: MCP `query(projection="sessions")` sent the default page size with a continuation, and the owner refused that as widening the window. #5779 has since landed the same fix on master. This PR adds narrowing and widening assertions for that route. - `test_transcript_window_route.py::test_continuation_can_narrow_final_window_without_losing_snapshot_binding` ("dialect mismatch"): the test hand-built a token whose result identity did not match its request, and `frame_request` reported that as a dialect mismatch. Reading the code turned up a real bug underneath. On narrowing, `frame_request` returned the new request, whose default offset and filters replaced the token's. #5778 fixed the same bug in `session_reads._transaction` but not here. - `test_compiler.py`, both `prose_with_refs` tests: #5722 changed the contracts these tests assert (details under Solution). Checking the other surfaces that resume a continuation found three more places where the resumed request's defaults win over the token: - `message_transcript_window` filtered with the caller's request. A token-only `sessions.read` resume of a `message_role=("user",)` window served unfiltered rows at the filtered offset. - The generic `session.read` (transcript and messages kinds) dropped an explicit `limit` beside a continuation. The CLI's narrowed resume from #5785 (remaining bound, `result_too_large` halving) therefore read the token's full page in production. #5785's tests mock the dispatch, so they could not catch this. - The messages kind checked for filters on its own payload, not on the framed token, so it would resume a filtered owner token and serve unfiltered rows. ## Solution - `frame_request`: separate the dialect check from the result-identity check. On narrowing, keep the token's request and change only `limit`. - `message_transcript_window`: frame the request once to get the effective selection, then pass the submitted request to the bound route so epoch validation is unchanged. - `daemon_reads._session_window_request`: one builder for both kinds. With a continuation, a stated `limit` narrows the page (`frame_request` refuses a larger one) and a stated nonzero `offset` is conflict-checked. The messages kind checks filters on the framed selection. - `SessionReadRequest.limit` is now `int | None = None`. The operation transport forwards every declared field, so the old `limit=200` default would have read as a request to widen every token-only resume. That was the cause of the four failures in the first focused run (job 2563). Handlers still use the declared 200-row window for a fresh read. - Compiler tests: #5722 added an action `ObjectRef` assertion that contradicts `ObjectRef.parse`, which has read an action's trailing block index as a qualifier since #4329. The test is fixed; production is right. #5722 also made the budget a hard cap, so `max_tokens=80` now omits every row. The recap test now uses a budget where recapping, not omission, makes the page fit, and asserts the estimate stays within the prose budget. - `docs/session-operations.md` states the resume page-size and filter rules. None of the changed production files is in the derived-identity closure (`devtools schema closure`: all `out`). ## Verification - `agentctl job start polylogue pytest_focused --workspace … -- tests/unit/mcp/test_session_owner_operations.py tests/unit/operations/test_transcript_window_route.py tests/unit/context/test_compiler.py tests/unit/archive/query/test_continuation_surface_parity.py tests/unit/cli/test_session_window_continuation_bounds.py tests/integration/test_transcript_window_differential.py tests/unit/operations/test_transcript_window_resume_selection.py tests/unit/operations/test_daemon_reads.py tests/unit/operations/test_session_read_parity.py tests/unit/operations/test_session_owner_route_equivalence.py tests/unit/operations/test_http_session_reads.py tests/unit/cli/test_read_view_execution_routes.py tests/unit/operations/test_daemon_protocol.py`, job 2608: `passed 143, failed 0` (2 flaky on first attempt, below). - `agentctl job start polylogue verify_quick`, job 2609: succeeded. New regression tests in `tests/unit/operations/test_transcript_window_resume_selection.py`: - A token-only owner resume reads under the token's filters. - The generic messages kind refuses a filtered owner token. - Narrowing works identically on the owner route and both generic kinds; a token-only resume keeps the token's page size through the transport's declared request; widening is refused. ## Self-review - **Sibling sites.** Every `QueryContinuation.decode` and `frame_request` caller was checked. The evidence windows (`frame_evidence_window`) ignore `limit` on a continuation, and their only CLI caller sends none, so no wrong rows are served (residual below). `window_request`, used by the API, MCP `read` and HTTP messages routes, drops `limit` beside a continuation. The window is then fully decided by the token. No wrong rows, but an explicit narrowing is ignored there (residual). - **Contract change.** `SessionReadRequest.limit` is read only through `_non_negative_int(..., default=_SESSION_READ_WINDOW)`, which maps `None` to the 200-row default. No checked-in schema snapshot names it. - **Double framing.** `frame_request` is pure; calling it twice cannot diverge, and the bound route still validates the epoch. - **Compatibility and fail-open.** No shim; a larger limit is refused, not clamped. - **Tests on the production route.** The generic reads go through `SessionReadRequest` validation exactly as the transport does, which is what exposed the default-limit problem. ## Residuals - Evidence windows and the `window_request` routes silently ignore an explicit `limit` beside a continuation. They serve correct rows, but do not narrow. - The two first-attempt flakes in job 2608 were daemon start-up timeouts (`TimeoutError`, `DaemonWriterOwnerLoopStopped`) under host load. They are unrelated to window framing, and both passed on rerun. 🤖 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]>
Summary
Closes the ten Codex findings from the #5722 landing tracked in polylogue-2mw8c. That includes the open P1: replaying a retained
agent-work-event:raw overwrote the reconstructed session's metadata.Problem
Each finding reproduced on master:
ParsedSessionwith default header fields, and the session upsert took those as incoming values. A same-raw full replay could also replace the transcript. The live producer avoided this only by copying header fields by hand, and replay had no equivalent.limitfell back to offset 0 and lost its expression and filters.session.readexposedtool_inputas JSON text instead of an object.Solution
Event-only writes (P1).
write_parsed_session_to_archiverecognizes a work-event raw (WORK_EVENT_RAW_ID_PREFIX) that carries no messages or attachments for an existing session. It then:Because the rule keys on the retained raw identity, events retained before this change replay the same way.
append_work_eventno longer copies the header itself._transactionrebuilds the request from the continuation token and changes onlylimit.Name matching falls back to the invocation name.
Configuration history reads each followed commit under its
--name-only -zpath and skips non-positive tail intervals.Unresolved edges of retained children survive truncation.
_status_operation_resulthas no timeout. Onlyshow_fast_statuspasses the 0.5 s probe bound.tool_inputgoes througharchive_block_to_domain.On cancellation,
_daemon_operationwaits for the submission thread, sendsoperation.cancelfor the same pre-minted request id, and then re-raises.record_manual_continuation_productruns_would_create_cyclebefore writing the resolved edge and refuses a cycle.Operation-route search now reports
matched=total, analyzed=len(hits), the same as the API builder.Verification
agentctl job start polylogue pytest_focused --workspace <wt> -- tests/unit/operations/test_session_read_parity.py tests/unit/context/test_configuration_evidence.py tests/unit/mcp/test_session_orchestration.py tests/unit/cli/test_status.py tests/unit/cli/commands/test_status.py tests/unit/operations/test_daemon_reads.py tests/unit/api/test_search_envelope_builder.py tests/unit/mcp/test_privileged_tools.py tests/unit/api/test_manual_continuation_link.py tests/unit/mcp/test_work_event_tools.py tests/unit/storage/test_revision_replay.py tests/unit/sources/test_revision_backfill.py tests/unit/sources/test_live_batch_support.py(job 1585): everything passed except two status tests. Those two (test_sinex_status_reads_the_active_archive_file_set,test_configured_override_url_is_not_refused) fail identically onorigin/master(baseline job 1546).verify_quick: succeeded (job 1582).Residuals
write.py,archive.pyandrevision_backfill.pyare in the derived schema-identity closure, so this moves the derived identity. Land it before the next rebuild starts.sessions.raw_idandcontent_hashto the event raw's values, as the live route already did.🤖 Generated with Claude Code
https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg