Repository navigation
fix: Let MCP name any transcript window, not only the first page - #5184
Conversation
The MCP `read(view="messages")` branch hard-coded `offset=0` and the tool signature carried no `offset` parameter at all, while the Python API, the CLI `read --view messages` verb and the HTTP `/api/sessions/:id/messages` route all window by limit+offset. A client asking MCP for messages 2..4 silently received messages 0..2, and any continuation was refused outright. `read` now takes `offset` and continues the messages view by the same decimal form the topology view already uses (`message-offset:<n>`), so no surface mints a token another cannot read. `offset` also feeds the topology view's existing `node_offset`, and a negative offset is refused typed. tests/integration/test_transcript_window_differential.py holds all four surfaces to one answer for the same (ref, limit, offset), and proves the windows tile the transcript without overlap or gap. Anti-vacuity: restoring `offset=0` on the MCP branch was run and turns two of the three tests red. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
…ners States, per surface, which executor answers a one-session message window, what the MCP change did and did not relocate, and the two owners that still remain (`session.read` vs `get_messages_paginated`) with the concrete consequences: only the CLI resumes under epoch validation, and only that route runs inside QueryExecutionContext. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedNext included review available in 51 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (4)
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. |
…pus (#5196) Two independent settled decisions, one commit each. ## A — retire `polylogue/api/contracts/` (polylogue-aq2l5) Ruled and authorized on the bead. The package shipped as a contract spine enforced through shadow adapters; **those adapters were deleted two days later** (#1329), leaving `TUIReadSurface` as the only implementor — and #5182 deleted the TUI. `a7xr.13` had already deleted the mirrored write-surface half, recording the finding that shadow adapters verify copies rather than surfaces, and the plan "execute f94 first, then nothing in read_surface needs keeping". Verified before deleting, not trusted from the brief: every `api.contracts` hit is inside the package; `assert_implements` has 11 hits, all internal, zero call sites; each exported Protocol name searched individually returns zero external hits; `TUIReadSurface` zero hits anywhere. `ArchiveReadCapability` is unaffected — it lives in `api/archive_reads.py:17` and the deleted `contracts/__init__.py:38` was a pass-through re-export. Replacement in place: operation-identity parity (`polylogue/api/parity.py`, gate `api-parity`) plus behavioral differentials — including the one in #5184 that caught the MCP `offset=0` defect no name-based check could. **Correction to the ruling's expectation**: it predicted the layering baseline would shrink. It did not — 226 before, 226 after. `docs/plans/layering-surface-baseline.json` has no entry for any `api/contracts/*` file, and `polylogue/api` → `polylogue/daemon` is not a disallow pair in `layering.yaml`, so the removed `read_surface.py:31` import never counted. The bound held; the number did not move. ## B — declare the corpus schedule (polylogue-yk0zz want 4) `schedule = "*-*-* 03:00"` added to `[operations.verify_all]`. `cache`, `checkout`, `pool` untouched — they are load-bearing for the dedupe property. `verify.yml`'s header comment corrected: it claimed a nightly agentctl `verify_all` schedule that was never declared. `concurrency.cancel-in-progress: true` deliberately unchanged. Key spelling cross-checked against the live precedent (`/realm/project/sinnix/.agentctl/project.toml` `[operations.census]`). `agentctl schedule apply` was **not** run — that mutates live host state and is the coordinator's. ## Verification ``` devtools verify --quick (after each part) → EXIT 0, all 19 gates devtools test tests/unit/api tests/unit/core/test_facade_api.py → EXIT 0 devtools render all --check → EXIT 0, 0 occurrences of "out of sync" ``` All five changed files confirmed **out** of the schema-identity closure. ## Residual `agentctl schedule apply` still needs running after this lands; want 4 closes only once the timer is listed and one scheduled run has a result. `agentctl schedule` exposes only `apply` — no read-only list verb — so the descriptor's acceptance of the value is unproven until then. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
…5209) Two beads, one commit each. Both replace restated facts with derived ones, because a restated fact in a generated manual is what drifted in the first place. ## polylogue-4u79w — the manual prescribed a flow the handler rejects **The manual was wrong, not the handler.** Evidence, rather than a preference: - The declaration owns the contract: the `maintenance` `_ToolRow` (`mcp/declarations/registry.py:256-273`) states "rebuild_insights and recovery_adjudicate require confirm=true and fail closed without it", and both the handler (`server_cutover.py:2718-2745`) and `_dispatch_maintenance` implement exactly that. - No preview/dry-run exists anywhere in the operation `Literal`, the dispatcher, or `AuditRepository`. `recovery_status` already *is* the read-only inspection route the prose wanted. - **polylogue-2x6xu already adjudicated `preview` as phantom**, removing the `dry_run` argument and the `operation="preview"` example from the generated contract. The prose was the last surviving remnant, not a competing intent. Growing the handler a preview operation would have invented a declared operation and a target-algebra entry to satisfy stale text. The fix is not a reword: the gate is declared once as `ConfirmationGate` on the maintenance contract and the manual sentence is **rendered** from it, with the `operation` argument carrying derived `enum_values`. The remaining preview vocabulary the same defect left behind is purged too — the capability-table row, the "stale destructive preview" recovery bullet, a regeneration-checklist item, and a stale `semantic:"preview-bound confirmation"` example query. **Anti-vacuity, executed twice**: adding `"preview"` to the handler's `Literal` failed both the declared-gate and manual-prose tests; restoring the hand-written prose line in place of the derived sentence failed. Both reverted. **Inherited failure fixed forward**: `test_generated_contract_arguments_match_the_live_mcp_signatures` was already red at base — `read: live but undocumented ['offset']`, from #5184/#5202 adding the parameter. The `read` contract now documents it. ## polylogue-nysan — "ten-tool surface" against twelve declared The count is now **derived**: `ALL_DECLARED_TOOLS` comes from `MCP_TOOL_DECLARATIONS`, and the manual renders both its table rows and its spelled count word from that set. Every literal count is gone — renderer (5 sites), `spec.py` docstring and four `ClientDelivery` deltas, `registry.py` docstring, `declared_tool_names`' own "twelve-tool" docstring, `tests/infra/mcp.py`, `verify_agent_integration.py`, `cli/commands/agent.py`, and the `test_assets_and_cli` assertions. `record_work_event` and `emit_decision` gained real manual contracts with live-signature-exact arguments; `MCPToolDeclaration` now carries `result_semantics` so a tool with no target transaction can still be described, and a new test keeps "outside the target algebra" distinct from "not a tool". **Anti-vacuity, executed**: adding a 13th `_ToolRow` made `devtools render agent-manual --check` exit 1, failing closed with `missing=['probe_thirteenth']`; after adding its contract the manual rendered `## The thirteen tools` and "thirteen tools, of which six are available by default". Reverted. `docs/atlas/mcp.md`'s DISCREPANCIES section documented both of these bugs and is now false — rewritten with re-resolved anchors. ## Verification ``` devtools test tests/unit/agent_integration/test_manual_contract.py → PASSED exit 0 devtools test tests/unit/agent_integration/ tests/unit/mcp/ → PASSED exit 0 devtools render agent-manual --check → exit 0 devtools render all --check → exit 0, 0 "out of sync" devtools verify --quick → exit 0, 21/21 gates devtools gate atlas → ok ``` Every changed source file is **out** of the schema-identity closure. No devtools root verb added. ## ⚠ Overlaps operator work — do not lose it A branch `docs/mcp-tool-count` exists with **no commits ahead of master**; the actual work is parked in `stash@{0}` ("mcp-tool-count-wip", authored by Sinity 2026-09-14) on the same topic as nysan. That stash was **not** touched, popped, or inspected beyond `git stash list` — it is operator WIP and the shared stash stack is unsafe to pop. This PR likely supersedes it, but that is the operator's call to confirm before dropping it. ## Residual `## Normal invocations` still renders worked examples for the six default read tools only; the privileged four-plus-two are covered by the table, capability section and contract JSON. Extending worked examples to privileged tools is a separate judgment call, deliberately not made here. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Summary
MCP
read(view="messages")hard-codedoffset=0. A client asking for messages 2–4 silently received 0–2. Found by building the cross-surface differential that polylogue-vclez asks for.Problem
polylogue-vclez requires that the same request return equal ids, rank, content, provenance, totals and continuing windows through the Python API, CLI, MCP and HTTP. The session-summary request was already held to that by the oracle-backed differential in
tests/infra/surface_differential.py. The transcript-window request had no cross-surface differential at all — and the surfaces had genuinely drifted.polylogue/mcp/server_cutover.pyread()had nooffsetparameter, passed a literaloffset=0intoget_messages_paginated, echoed a literaloffset=0back in the payload, and refused continuations for every view excepttopology. The window was therefore inexpressible over MCP beyond the first page, and — worse than an error — a narrowed request returned the wrong rows with a payload claimingoffset=0, so a caller could not detect it.Solution
read()acceptsoffset, applies it to themessagesview, and echoes the real window back. Themessagesview continues bymessage-offset:<n>, mirroring the decimal form thetopologyview already used (node-offset:<n>), so no surface mints a continuation token another surface cannot read.offsetalso now feeds topology's existingnode_offsetinstead of its own hard-coded zero. A negative offset is refused typed rather than silently clamped.tests/integration/test_transcript_window_differential.pyholds API/CLI/MCP/HTTP to one answer (ids in order, plus total) for the same(ref, limit, offset), and proves consecutive windows tile the transcript with no overlap and no gap.docs/design/transcript-window-responsibility.mdrecords the before/after responsibility map vclez asks for, including an honest negative: nothing was deleted or relocated, because two owners still exist.session.read/_session_read_payload(CLI only) andPolylogue.get_messages_paginated(Python API, MCP, HTTP) are not interchangeable today — the latter exposesmessage_role/message_type/material_originfilters the former lacks, and only the former runs insideQueryExecutionContext. Collapsing them changes the webui payload that/api/sessions/:id/messagesserves, so it needs its own task.Verification
Anti-vacuity, executed: restoring
window_offset = 0on the MCP branch fails two of the three differential tests (devtools test: FAILED exit=1); restoring the fix returns them to green.Schema-identity closure: no changed file is inside it. Verified with
devtools schema closure:polylogue/mcp/server_cutover.py→out. The fix deliberately reuses the existingoffsetfield rather than addingnext_offset/continuationtoSessionMessagesResponsePayload, becausepolylogue/surfaces/payloads.py,archive/query/expression.pyandarchive/query/transaction.pyare all IN the closure. So this carries no pre-rebuild landing-order constraint.Residuals
plan_execution.pywas left alone deliberately:list_for_planis the live repository-runtime-store path and carries the typednear:id:refusal, so it is not superseded.🤖 Generated with Claude Code
https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK