Skip to content

feat(query): continuation resume parity across HTTP/API surfaces - #3171

Merged
Sinity merged 3 commits into
masterfrom
feature/query/continuation-resume-parity
Jul 19, 2026
Merged

Sinity merged 3 commits into
masterfrom
feature/query/continuation-resume-parity

Conversation

@Sinity

@Sinity Sinity commented Jul 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Verifies and locks in test coverage for continuation-resume parity across
Polylogue's three query_units surfaces (daemon HTTP /api/query-units, the
Python API Polylogue.query_units() facade, and the MCP query tool).

Problem

polylogue-z9gh.9.1's 2026-07-18 trail note flagged a residual gap: daemon
HTTP's /api/query-units accepts no continuation query parameter (no
resume path exists there, even though it returns a continuation token), and
the Python API/CLI query_units path likewise has no continuation input.
MCP already accepts and validates continuation via
validate_continuation_epoch()/QueryContinuationStaleError, the reference
implementation.

Source review found both flagged gaps already closed on master, just not
reflected in the bead trail: the six-tool MCP cutover hardening pass
(dc6fa632a / #3095, merged the same day, after the note was written)
added continuation decoding + QueryContinuationStaleError handling to both
DaemonAPIHandler._handle_query_units and Polylogue.query_units, reusing
the same query_units_transaction_request / QueryTransaction /
QueryContinuation primitives MCP's query tool already validated — and in
fact MCP's query tool delegates straight into Polylogue.query_units
under the hood, so there was never a second implementation to build.

What was missing was direct proof that this held together end-to-end: HTTP
had its own continuation test suite (tests/unit/daemon/test_web_reader.py),
and only MCP+API were compared together
(tests/unit/mcp/test_server_surfaces.py) — no test drove all three
surfaces against the same corpus, and the Python API facade's own
continuation= keyword had zero direct test coverage (only indirect
coverage via MCP tests that patch the facade in).

Solution

  • tests/unit/api/test_facade_contracts.py: four new tests pinning
    Polylogue.query_units(continuation=...) directly — normal resume drains
    all rows with stable query_ref/result_ref, rejecting a continuation
    combined with a new expression (QueryContinuationInvalidError),
    rejecting a continuation issued before a write lands
    (QueryContinuationStaleError), and rejecting a malformed token.
  • tests/unit/archive/query/test_continuation_surface_parity.py (new):
    seeds one on-disk corpus, then drives HTTP, the Python API facade, and the
    MCP query tool through an identical expression/continuation flow,
    asserting byte-identical message_id ordering and identical
    query_ref/result_ref across all three pages, plus identical
    query_continuation_stale rejection when a write lands between issuing
    and resuming a continuation on each surface.

No production code changed — this closes the residual test-coverage gap
the bead trail identified, without building a second continuation
mechanism (the mission's explicit anti-goal): every surface still funnels
through the single query_units_transaction_request/QueryTransaction
boundary.

Not touched — CLI: the CLI does not call Polylogue.query_units at
all today. Its find/read verbs use a separate SessionQuerySpec /
cli/archive_query.py path with plain limit/offset, not opaque
continuation tokens. There is no CLI query-units paging surface to wire
continuation resume into, so CLI is out of this change's scope.

Reviewed but not touched — z9gh.3 execution-layer gaps: the two
execution-layer gaps flagged in polylogue-z9gh.3's notes (near:""
similarity queries falling back to an unfiltered session list;
lineage:id: queries not materializing declared
parent_refs/child_refs/continuation projection columns) both live in
the generic find/read CLI route (expression.py, execution_control.py,
unit_results.py untouched by that prior PR), not in the HTTP/API/MCP
query_units continuation path this change touches. Left as already-tracked
scope, not duplicated here.

Verification

  • devtools test tests/unit/archive/query/test_continuation_surface_parity.py tests/unit/api/test_facade_contracts.py tests/unit/mcp/test_server_surfaces.py
    — 286 passed.
  • devtools test tests/unit/daemon/test_web_reader.py::TestReaderQueryUnits
    — 13 passed (confirms no regression to the existing HTTP continuation
    suite from sharing its xdist_group).
  • devtools verify --quick — green, 16/16 steps (ran automatically via the
    pre-push hook too).
  • mypy --strict on both new/changed test files — clean.
  • Noted, not caused by this change: devtools test tests/unit/daemon/test_web_reader.py
    run as a whole has one pre-existing failure
    (TestReaderAssertionEndpoint::test_operational_web_payloads_redact_configured_archive_paths,
    sqlite3.OperationalError: unable to open database file after the test
    deliberately unlinks index.db mid-run) — reproduced identically at
    origin/master HEAD (71d134eaa) with none of this PR's files present,
    confirming it predates this change.

Ref polylogue-z9gh.9.1, polylogue-z9gh.9

Summary by CodeRabbit

  • New Features

    • Added continuation support for paging query results across the Python API, HTTP endpoint, and MCP tool.
    • Query pages preserve consistent ordering and shared query/result identifiers when resumed.
  • Bug Fixes

    • Invalid, conflicting, malformed, or stale continuation tokens are now consistently rejected.
    • Stale continuations return appropriate errors across all supported query interfaces.
  • Tests

    • Added coverage for multi-page queries and cross-interface result and error consistency.

Sinity added 2 commits July 19, 2026 22:35
Problem: Polylogue.query_units() already accepts and validates a
continuation parameter (added alongside the six-tool MCP cutover in
dc6fa63/#3095, reusing the shared QueryTransaction/QueryContinuation
primitives), but no test exercised the facade's own continuation
keyword directly -- only indirect coverage existed via MCP tests that
patch the facade in.

What changed: tests/unit/api/test_facade_contracts.py gains four focused
tests pinning query_units(continuation=...): normal resume drains all
rows across pages with stable query_ref/result_ref, rejecting a
continuation combined with a new expression/limit/offset
(QueryContinuationInvalidError), rejecting a continuation issued before
a write lands (QueryContinuationStaleError via validate_continuation_epoch),
and rejecting a malformed token.

Ref polylogue-z9gh.9.1, polylogue-z9gh.9
Problem: polylogue-z9gh.9.1's 2026-07-18 trail note flagged daemon HTTP
/api/query-units as having no continuation resume path and the Python
API/CLI query_units path as likewise missing continuation input. Source
review found both gaps already closed on master: the six-tool MCP
cutover hardening pass (dc6fa63/#3095, same day, after the note was
written) added continuation decoding + QueryContinuationStaleError
handling to both DaemonAPIHandler._handle_query_units and
Polylogue.query_units, reusing query_units_transaction_request/
QueryTransaction/QueryContinuation -- the same primitives MCP's query
tool (which itself delegates straight into Polylogue.query_units)
already validated. No cross-surface test proved this delegation held
together, though: HTTP had its own continuation test suite
(tests/unit/daemon/test_web_reader.py), and only MCP+API were compared
together (tests/unit/mcp/test_server_surfaces.py), never all three.

What changed: tests/unit/archive/query/test_continuation_surface_parity.py
seeds one on-disk corpus, then drives HTTP, the Python API facade, and
the MCP query tool through the identical expression/continuation flow
and asserts byte-identical message_id ordering plus identical
query_ref/result_ref across all three pages. A second test proves a
write landing between "get page 1" and "resume" is rejected identically
(query_continuation_stale) on every surface.

Not touched: CLI does not call Polylogue.query_units at all today (its
find/read verbs use a separate SessionQuerySpec/archive_query.py path
with limit/offset, not opaque continuation tokens) -- there is no CLI
query-units paging surface to wire continuation resume into, so CLI is
out of this change's scope.

Also reviewed the two execution-layer gaps polylogue-z9gh.3's notes
flagged (near:"" falling back to an unfiltered list, lineage:id: not
materializing parent_refs/child_refs/continuation): both live in the
generic find/read CLI route (expression.py/execution_control.py/
unit_results.py), not in the HTTP/API/MCP query_units continuation path
this change touches, so they are left as already-tracked, unrelated
scope.

Verification: devtools test tests/unit/archive/query/
tests/unit/api/test_facade_contracts.py -k continuation (6 passed);
devtools verify --quick (green, 16/16 steps).

Ref polylogue-z9gh.9.1, polylogue-z9gh.9
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jul 19, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds direct API tests and HTTP/API/MCP parity tests for continuation pagination, shared query/result identifiers, completion behavior, malformed tokens, and stale continuations.

Changes

Continuation verification

Layer / File(s) Summary
Direct API continuation contracts
tests/unit/api/test_facade_contracts.py
Adds facade tests for resuming paginated queries, preserving query and result identifiers, rejecting expression overrides and malformed tokens, and rejecting stale continuations after writes.
HTTP and MCP surface parity
tests/unit/archive/query/test_continuation_surface_parity.py, .beads/issues.jsonl
Adds HTTP server, archive, and MCP test fixtures, verifies matching page contents and continuation metadata across all three surfaces, and checks consistent stale-continuation errors. Records the verification outcome in the issue entry.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • Sinity/polylogue#3068: Introduced the archive-epoch binding and stale-continuation behavior covered by these tests.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately describes the main continuation-resume parity change across query surfaces.
Description check ✅ Passed The description covers Summary, Problem, Solution, and Verification, and omits Changelog appropriately for a test-only PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/query/continuation-resume-parity

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

#3171

The 2026-07-18 residual-gap note on polylogue-z9gh.9.1 flagged HTTP/API
query_units continuation as unwired. Investigation found both already
fixed by the same day's later six-tool cutover commit (dc6fa63/#3095);
PR #3171 closes the remaining test-coverage gap that note actually left
open. Bead stays in_progress (not closed) per the mission's own
instruction -- z9gh.9.1 has broader open scope beyond this slice.

Ref polylogue-z9gh.9.1

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.beads/issues.jsonl:
- Line 15: Redact real session, corpus, capture, and environment identifiers
from the expanded notes and comments in the issue record. Replace live
provenance and evidence with synthetic fixture IDs and generalized redacted
descriptions while preserving the technical failure and verification details. Do
not alter the implementation scope or acceptance criteria.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7767015c-ef08-40ab-aaa4-7e759194ee37

📥 Commits

Reviewing files that changed from the base of the PR and between 5f65ad9 and 00db2a8.

📒 Files selected for processing (3)
  • .beads/issues.jsonl
  • tests/unit/api/test_facade_contracts.py
  • tests/unit/archive/query/test_continuation_surface_parity.py

Comment thread .beads/issues.jsonl
{"_type":"issue","id":"polylogue-hjpx","title":"Make RawAuthorityReconciler execute accepted replay plans to fixed point","description":"The raw-authority repair path can classify a retained revision as replayable yet produce no executable logical source: repair_raw_materialization reports a scanned/classified full raw, backfill_historical_revision_evidence returns replayed_logical_sources=0 and success=false, and the same candidate remains forever. This is the execution-completeness slice of lkrc, not six unrelated test failures. Any plan the reconciler accepts must either execute exactly once or end in an explicit typed deferred/terminal state with a receipt.","design":"Repair the exact production route anchored at polylogue/storage/repair.py repair_raw_materialization around lines 6135-6385, polylogue/sources/revision_backfill.py backfill_historical_revision_evidence around lines 42-185, and polylogue/daemon/cli.py _drain_raw_materialization_once around lines 611-640. Introduce a stable RawReplayPlanId for every selected authority component before the raw_artifact_limit slice. Carry it through membership expansion, raw_revision_rebuild_selection, cohort classification, resource admission, adoptability, apply, remaining-candidate recomputation, and status receipts. Replace the current aggregate-only RevisionBackfillResult with per-plan outcomes executed, retryable, deferred, terminal, or rejected-stale, each with input raw ids, logical key, authority witness, reason, and next action. The daemon batch selector must choose bounded independent authority components fairly, not the smallest individual raw ids that repeatedly expand into the same few components. A plan present in the before census must appear exactly once in the pass receipt and in the after census unless executed/terminal; selected plans cannot vanish when logical_keys is empty, membership keys differ, a component expands, or adoptability defers. Fixed-point means two successive quiescent dry-run censuses have identical typed non-executable debt and zero executable accepted plans, not merely repaired_count less than the batch limit. Preserve CAS, source authority, atomic rollback, component byte limit, and FTS closure. Do not raise the batch limit, reset cursors, replay every candidate, or bypass the reconciler.","acceptance_criteria":"1. A production-shaped fixture reproduces a selected/classified raw yielding replayed_logical_sources=0 and remaining executable debt on current behavior; the fixed route emits one plan receipt and executes or explicitly defers/terminalizes it. 2. Every before-census RawReplayPlanId is conserved into exactly one per-pass outcome; counters reconcile selected components, expanded raws, logical keys, execution, retry/defer/terminal outcomes, and after-census debt. Mutations dropping logical_keys, membership keys, or expanded components fail. 3. Bounded scheduling is by independent authority component with stable fairness/age, so a finite fixture with more than one batch drains every executable component; repeatedly selecting the same cheap components or starving large valid work fails. 4. Transient lock/resource interruption remains retryable with the same plan id and later succeeds once; CAS conflict or incomparable authority remains typed, durable, and non-mutating. 5. Two successive quiescent dry-run passes establish fixed point only when executable accepted-plan count is zero and all residual rows are explicit durable non-executable states. Candidate count alone cannot claim convergence. 6. A sanitized scale fixture matching the 2026-07-15 shape proves bounded memory/temp/time, monotonic executable backlog decrease, no cursor/head regression, and responsive daemon health; removing fair selection or outcome conservation recreates non-progress. 7. Run devtools test tests/unit/sources/test_revision_backfill.py; devtools test -k raw_materialization; devtools test -k raw_authority; and devtools verify. Before any live apply, record current build/schema, stopped-daemon census, verified backup, dry-run plan inventory, resource envelope, and explicit operator authorization.","notes":"2026-07-15 formulation correction: replaced the symptom/test-count title with the missing reconciler invariant. This remains a necessary lkrc execution slice; no regression or safety condition was removed.\nActive-set expansion 2026-07-15: admitted as a high-leverage operational mechanism under the scale/raw-authority program; execution focus remains readiness- and conflict-aware.\nPriority escalation 2026-07-15: P1 to P0 after the yla8 authorization preflight found the installed daemon already replaying 2 sources per bounded pass while remaining candidates monotonically grew 11,717 to 15,264, with 1,890 broken active seeds and 40 cursor-ahead rows. This is the executable successor to the failed live gate, not a second raw-authority architecture. No live apply is authorized.\n2026-07-15 execution-foundation phase implemented in isolated branch feature/fix/raw-replay-fixed-point. Evidence-first repro: 5 same-session prefix revisions plus 4 independent raws produced 9 candidates/5 components; the old raw-row limit selected only one cohort and replayed 0 logical sources indefinitely. Phase changes: provisional single-session raws enter typed full-revision classification; non-prefix full cohorts convert to semantic membership governance; component closure includes source paths, membership keys, and raw_revision logical keys; batch budget counts complete components; ops receipts rotate attempted retryable plans behind never-attempted work; resource-blocked and executable plans share one budget; independent components execute/fail in isolation; selected attempts produce stable IDs and typed outcomes; daemon emits zero-work and nonzero pass receipts. Adversarial iterations 1-2 found that full hjpx closure still requires pre-execution immutable census, complete carried-forward conservation, durable source-tier rejection, two-census fixed-point proof, richer authority witnesses, and scale evidence. Those are now explicit children hjpx.1 (P0 correctness kernel) and hjpx.2 (P1 July-15 scale proof, blocked by hjpx.1). Parent remains in_progress; no live apply authorized or performed. Verification: revision_backfill focused cross-path tests 2 passed; selected storage regressions 4 passed; raw_materialization selector 79 passed before final per-component isolation refactor, followed by its focused 4-test pass; devtools verify --quick green run 20260715T221858Z-quick-1939817-ca04d05e. Full devtools verify cannot bootstrap in a fresh worktree because seed-testmon is unbounded/red/hanging; tracked b054.1.1. raw_authority selector has an inherited clean-master failure tracked lkrc.4.\nFoundation phase merged via PR #2915 as d6501ac4615efa30cb0e2413c97614a4bf44b253. Final post-refactor selector receipt: devtools test -k raw_materialization selected 80 tests and passed all 80 in 106.14s. Automated CodeRabbit review was quota-limited (tool failure/no findings), GitGuardian passed; two independent adversarial iterations are recorded in the PR and residual children. Parent remains in_progress.\n2026-07-16 implementation pass: owning the coherent lkrc/hjpx.1/lkrc.4 raw-authority cluster from fresh origin/master. Scope is the single reconciler/immutable-plan conservation and the production multi-session divergence regression now observed in packaged ordinary catch-up. Preserve yla8 fail-closed replay protections; no live cursor reset, force replay, evidence deletion, manual SQL repair, or live apply before reviewed code, verified backup, quiescent census, and explicit authorization. First deliverable is a production-route failing fixture and read-only live evidence.\n2026-07-17 static follow-up from yla8 read-only preflight: current live execution is blocked by one non-stream-safe authority component over the 1 GiB bounded replay envelope. The implemented P0 kernel remains present: repair_raw_materialization completes parser census before planning, keeps complete authority components intact, persists immutable plan/outcome/postflight conservation, rotates prior attempts fairly, and requires two quiescent dry-run census identities for fixed point. The current resource-envelope/streaming proof is therefore the existing P1 polylogue-hjpx.2 scale lane, not evidence to weaken or bypass P0 authority conservation. No source/index/live mutation was made.","status":"in_progress","priority":0,"issue_type":"bug","assignee":"Sinity","owner":"[email protected]","created_at":"2026-07-15T13:48:19Z","created_by":"Sinity","updated_at":"2026-07-17T01:54:28Z","started_at":"2026-07-15T20:56:16Z","metadata":{"frontier":"active","frontier_program_ref":"polylogue-1xc"},"labels":["area:sources","area:storage","area:test","delivery:A-trust-floor","horizon:frontier"],"dependencies":[{"issue_id":"polylogue-hjpx","depends_on_id":"polylogue-lkrc","type":"parent-child","created_at":"2026-07-15T18:44:11Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-hjpx","depends_on_id":"polylogue-yla8","type":"discovered-from","created_at":"2026-07-15T22:54:55Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"polylogue-866e","title":"Make lineage writes order-independent and branch-point safe","description":"Stateful property testing has found three production-shaped lineage transition failures on clean master. Repeated full replacement with sibling variants plus child-before-parent ingestion can retain older sibling text instead of the newest primary content; deleting a referenced parent branch point can leave a child whose modeled prefix exceeds the surviving parent and crash composition. The invariant is broader than three examples: equivalent lineage histories must converge to the same logical transcript regardless of ingestion/replacement order, and missing branch points must degrade through a typed readable relation state.","design":"Run the evidence harness against the saved Hypothesis examples before editing production. The write transition authority is polylogue/storage/sqlite/archive_tiers/write.py: full-replace normalization around lines 235-455, batch link normalization around 1858-1889, composed-signature/prefix alignment around 3167-3454, and stale branch-point repair around 3478-3594. Link resolution is polylogue/storage/sqlite/queries/session_links.py around 175-341; the independent read oracle is polylogue/storage/sqlite/queries/message_query_reads.py around 74-235; the state machine is tests/property/test_write_path_state_machine.py, especially rules around 202-276 and invariants around 405-445. Reduce each saved sequence to a deterministic fixture and compare three independently observed states: physical messages ordered by (position, variant_index, message_id), session_links transition row, and composed logical transcript/completeness. The settled invariant is one atomic lineage normalization after every accepted full replacement or link-resolution transition: recompute against the parent composed signature, retain the newest accepted sibling variants, and either bind an existing branch point or set a typed unresolved/repaired/quarantined state. A missing branch point may truncate with LineageCompleteness(dangling_branch_point) but must never preserve an impossible prefix length or substitute other content. Fix the common writer/link transition if the reduced traces implicate it; correct the property model only when the direct SQL plus composed-read oracle proves it wrong. Do not add read-only exception handling as the primary fix, weaken examples, or introduce provider-specific repair.","acceptance_criteria":"1. POLYLOGUE_HYPOTHESIS_REUSE_FAILURES=1 devtools test tests/property/test_write_path_state_machine.py reproduces every saved class on the pre-fix baseline; each is committed as a named deterministic transition fixture with physical-row, link-row, and composed-read oracle. 2. Repeated full replacement with sibling variants retains the newest accepted identity/text/order in physical tails and composed transcript; mutating variant selection or cache invalidation to the prior behavior fails. 3. Child-before-parent, parent-before-child, and later parent replacement converge to identical physical tail, session_links state, logical transcript, and completeness. 4. Deleting or replacing a referenced branch point atomically rebinds when exactly provable; otherwise it yields the declared typed unresolved/repaired/quarantined edge and LineageCompleteness dangling state, with bounded readable child content and no IndexError, stale prefix, or substituted message. 5. Crash/rollback between message replacement, link resolution, normalization, and repair cannot commit a mixed state; retry converges idempotently. 6. No property assertion or generator is weakened unless the direct SQL and composed-read oracle demonstrates model error and the correction retains a mutation-sensitive production invariant. 7. Run devtools test tests/property/test_write_path_state_machine.py; devtools test -k session_links; devtools test -k composed; and devtools verify. Record saved-example ids, fresh random seed, exact counts, and the production mutation each regression catches.","notes":"Active-frontier correction 2026-07-15: admitted as the sole executable leaf of the lineage program. Deterministic falsifying examples make leaving it outside scheduling incompatible with P0.\n2026-07-15 formulation correction: renamed from the Hypothesis symptom to the lineage state-machine invariant. The three saved falsifiers remain permanent anti-vacuity fixtures under the unchanged P0 scope.\nTerra-readiness correction 2026-07-15: anchored the exact writer/link/reader/state-machine surfaces, fixed the atomic transition invariant and permitted degraded state, and made this an evidence-first bug-fix packet rather than an open architectural exercise.\n2026-07-16 GPT-Pro corpus adjudication: lineage package 5e2363a19a64 is merged as PR #2922 (b55f3fd9697083d44466613091604a21c7324ae6). Package contribution is canonical sibling-variant ordering and missing-branch-cut safety; remaining broader lineage AC stays under this owner.\n2026-07-17 implementation-readiness audit: #2922 / b55f3fd resolved canonical sibling-variant ordering and direct missing-branch-cut safety. Current authoritative anchors are write._replace_full_session_messages_and_blocks (1375), _composed_db_signatures (3273), _replacement_for_stale_prefix_branch_point (3512), repair_stale_prefix_branch_points (3626); session_links.resolve_session_links_for_session (175); composed read ordering in message_query_reads.py; state-machine rules at tests/property/test_write_path_state_machine.py:204-291 and invariants 383-445. Do not redo the merged slice. The remaining known falsifier is nested dangling-ancestor completeness propagation; PR #2922 also leaves persisted semantic-cut witnesses and crash/rollback fault injection. Reduce that saved sequence into a named deterministic fixture before changing writer code; then make a single transaction-level repair that proves physical rows, link state, composed transcript, and LineageCompleteness converge across child-first/parent-first/replacement/retry. Direct branch-point absence must retain bounded owned tail, never substitute a sibling or fabricate prefix.\n2026-07-17 direct implementation attempt/audit on current master 3b217d63: no production patch made because the alleged remaining falsifier is not reproducible. `POLYLOGUE_HYPOTHESIS_REUSE_FAILURES=1 devtools test tests/property/test_write_path_state_machine.py` -\u003e 3 passed (10.79s); targeted dangling/branch_point/variant/replacement/reingest lineage+write suite -\u003e 13 passed (1.15s); `devtools test -k \"session_links or composed\"` -\u003e 11 passed (23.99s). Existing deterministic coverage already includes nested dangling ancestor reingest (test_reingest_after_dangling_ancestor_does_not_fabricate_a_prefix), stale composed-ancestor repair, and caller-owned transaction rollback fixtures. Therefore do not implement speculative normalization. Remaining scope is an AC closure audit: enumerate which of persisted semantic-cut witness, crash/rollback fault injection, and typed link-state requirements are already covered by production tests versus genuinely absent; split only a demonstrated missing invariant into a smaller child. P0 rationale (currently falsifying state machine) is stale unless a fresh failing sequence is produced.\n2026-07-17: PR #3044 / 1d3145afa adds Claude Code arrival-order and replay/compaction normalization witnesses. It does not close this P0 lineage-write bead; the writer-level order-independent branch-point protocol remains in progress.","status":"in_progress","priority":0,"issue_type":"bug","assignee":"Sinity","owner":"[email protected]","created_at":"2026-07-15T13:44:21Z","created_by":"Sinity","updated_at":"2026-07-17T14:44:09Z","started_at":"2026-07-17T11:38:28Z","metadata":{"execution_mode":"evidence_first_bug_fix","frontier":"active","frontier_program_ref":"polylogue-4ts"},"labels":["area:lineage","area:storage","area:test","horizon:frontier"],"dependencies":[{"issue_id":"polylogue-866e","depends_on_id":"polylogue-4ts","type":"parent-child","created_at":"2026-07-15T18:44:10Z","created_by":"Sinity","metadata":"{}"}],"dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"polylogue-z9gh.9.1","title":"Land the shared query transaction across every read surface","description":"The mandate-critical read failures are one implementation gap, not separate ergonomics, pagination, parity, and overflow projects. Land the bounded query transaction as the sole production read boundary and absorb the complete remaining contracts of polylogue-rsad and polylogue-t46.3. The cancellation/selective-plan slices and query-receipt contract remain separately verifiable because they have distinct proof and durability concerns; all surface-specific response behavior belongs here.","design":"Add polylogue/archive/query/transaction.py as the sole orchestration boundary. QueryExecutionRequest wraps either a canonical SessionQueryPlan or terminal QueryUnitSource plus structural filters, material scope, projection/render profile, stable order/frame/snapshot, deadline, and query identity. QueryExecutor composes z9gh.1 execution control with z9gh.2 selective relations and chooses keyset continuation for stable indexed order, deterministic snapshot re-execution for safe immutable plans, or an owned ephemeral spool for recursive, aggregate, or unstable plans. QueryResultPage owns compact typed rows, exact or qualified total/coverage, useful first-page evidence, complete opaque continuation state, stable query/result refs, and independently pageable graph nodes and edges. Migration order on one branch: first query_units and list/search; then session/message/block/action/file reads; then tree/topology and insight-as-saved-query reads; then CLI, MCP, HTTP, and Python adapters; finally delete parallel pagination/filter/overflow/query-recording owners. Primary anchors: archive/query/{plan.py,archive_execution.py,unit_results.py}; storage/sqlite/archive_tiers/archive.py; api/archive.py; mcp/{server_tools.py,archive_support.py,server_support.py}; daemon/http.py; cli query contracts and verbs; surfaces/payloads.py. Replace server_support response_budget_exceeded whole-payload substitution with page construction before serialization. Absorb rsad behavior as declared projections and diagnostics: compact optional boilerplate, excerpts, truthful summaries, valid-value recovery, deduplicated sessions, and zero-hit explanation. Reuse minimal rxdo.3 identities without blocking on its full telemetry program.","acceptance_criteria":"1. z9gh.1 and z9gh.2 acceptance criteria pass through the shared executor, including prompt cancellation, bounded RSS/temp work, and selective plans. 2. Every rsad flow is satisfied at this boundary: no erased successful result; list/search/query/session/messages/tree/topology are losslessly resumable; recursive nodes/edges page independently; boilerplate is compact/opt-in; excerpts and truthful summaries exist; valid-value and zero-hit diagnostics teach recovery; list sessions deduplicates by identity. 3. CLI, MCP, HTTP, and Python execute the same canonical plan and return identical totals, stable order/frame, page boundaries, cursors, and result refs for identical requests. 4. Cursor/ref state preserves the complete expression, structural filters, material scope, projection/render budget, sort, snapshot, order, and query-run identity; following it yields every logical row exactly once and terminates with no semantic cap. 5. rxdo.3 query-run/result/evaluation refs are populated for committed reads. 6. Grep/source review finds no second per-surface owner for filter mapping, continuation state, totals, overflow replacement, cancellation, or query receipts, and no path serializes a full result merely to discard it. 7. The original archaeology flow and Workflow reconstruction finish in fewer than ten discovery/read calls, while live-scale and mutation tests fail when the shared executor is removed or bypassed.","notes":"[2026-07-15 invariant-collapse pass] This bead now absorbs the full remaining scope of polylogue-rsad and polylogue-t46.3. They are superseded rather than independently scheduled; their incident details remain durable regression evidence. It composes under polylogue-4p1 read algebra rather than replacing that domain contract.\nFrontier correction 2026-07-15: full rxdo.3 telemetry/privacy/@last behavior is compatible follow-on work, not a hard prerequisite for restoring lossless bounded query execution. This slice owns the minimal stable query/result/continuation identity required by transport; rxdo.3 enriches committed-run telemetry without gating the mandate repair.\n[2026-07-15 exact transport/execution replay] Valid live reads were destroyed at the interface boundary: list 100 found 129 candidates and built 54,344 bytes; search Sonnet found 50 and built 112,701 bytes; get_session_topology for the correct coordinator built 137,223 bytes. Each successful result was replaced wholesale by response_budget_exceeded with continuation.arguments={}, so no evidence row survived and replay was impossible. After narrowing to limit=3, useful rows arrived. Correct structural attempts then exposed execution failure: archive_list_sessions(tool=Workflow) plus a Wave 2 search ran \u003e150s before termination; the Wave 2 search alone ran \u003e79s; query_units over delegations for the known coordinator ran \u003e79s. The shared transaction must physically page before full serialization, emit complete opaque continuation state, preserve a useful prefix/page, and make termination interrupt SQLite/derived work. Requested limit is a logical maximum, never a requirement that one transport response contain that many rows.\n[2026-07-15 continuation root cause] The empty continuation was deterministic, not lost by the client. async_safe_call installs only fallback response arguments derived from an optional session_id. archive_list_sessions and archive_search_sessions never enter hooks.response_context with their real request, and pass no session_id, so _budget_envelope sees their tool name with arguments={}. archive_search_sessions also exposes no offset/cursor and reports total=len(capped_hits), so even a preserved smaller limit could not enumerate the full match set. get_session_topology has no paging/projection argument; its generic fallback can only replay the identical oversized call, creating a non-progressing loop. Existing continuation tests cover archive_get_session and explicitly context-wrapped tools, but there is no over-budget contract test for archive list/search/topology. The shared transaction must delete this per-tool opt-in context/fallback design, not merely fill three missing dictionaries.\n[2026-07-15 semantic-cap census] Static MCP inspection finds 18 directly registered tools that accept limit but expose no offset/cursor/page token: compose_context_preamble, tool_call_latency_distribution, find_stuck_sessions, find_abandoned_sessions, find_resume_candidates, find_similar_sessions, get_postmortem_bundle, get_pathologies, archive_search_sessions, neighbor_candidates, provider_usage, blackboard_list, list_assertion_claims, list_assertion_candidates, list_assertion_candidate_reviews, archive_debt, explain_import, and agent_coordination. This excludes dynamically registered insights and oversized unpaged graphs such as topology. Not every limit is wrong: ranked recommendations, summaries, and context compilation may be intentionally bounded. But every read must declare whether it is an exhaustive relation page, top-k ranking, sample, aggregate summary, or bounded context; exhaustive logical results need continuation/result refs, and ranked/summary surfaces need an exhaustive underlying query path plus explicit omitted/coverage semantics. No hidden limit may masquerade as totality.\n[2026-07-15 live audit reproduction] MCP search with origin=chatgpt-export and limit=30 built 594,054 bytes for query polylogue and returned only response_budget_exceeded. Its prescribed recovery was limit=3, but the same call at limit=3 still built 41,371 bytes and returned the same metadata-only refusal, so the continuation did not make progress. query_units over messages where text:\"prework\" built 450,317 bytes and returned continuation.arguments={}, which cannot replay the expression or filters. This independently reproduces both failure classes already owned here: a narrowing instruction that remains over budget and an uninvokable empty continuation.\nInvariant consolidation 2026-07-15: absorbs polylogue-20d.5. Its three concrete residues—lineage-composed transcript streaming, messages --full iterator/file output, and SQL-pushed material_origin pagination—are required paths under the sole bounded query transaction and its no-full-materialization AC.\n[2026-07-15 installed-skill dogfood reproduction] Invoking MCP readiness_check through the shipped Polylogue skill built 27,673 bytes against a 25,000-byte budget and returned response_budget_exceeded with continuation.tool=readiness_check and continuation.arguments={}. Repeating that continuation necessarily rebuilds the same oversized monolith, so the advertised recovery cannot progress. Add readiness/status to the over-budget regression matrix: preserve a useful compact page, return a component/detail ref or advancing cursor, and never prescribe an identical argument-less replay.\nTerra-readiness correction 2026-07-15: fixed the module boundary, plan/page strategy, adapter migration order, and deletion targets. z9gh.1 owns execution control; z9gh.2 owns selective derived relations; this bead owns the one transaction and every surface adapter.\n2026-07-17 implementation-readiness integration map: this is the only transaction integration branch. Consume, do not reimplement, #2964 execution control (z9gh.1) and #3004 declarations (z9gh.3 substrate). z9gh.2 is the only new derived index prerequisite. Land in this order on one branch: canonical request/page/opaque-cursor types and query_units route; lossless first-page construction replacing response_budget_exceeded; list/search; structural session/message/block/action/file; tree/topology/insight; then CLI/MCP/HTTP/Python parity and deletion of duplicate pagination owners. Before each migration, pin existing route rows/totals/order/error semantics as a production golden; after, prove the same canonical plan and cursor enumerate exactly once. A current grep target is mcp/server_support.py response_budget_exceeded and all envelope/pagination owners; do not claim completion while that whole-payload replacement remains reachable.\n2026-07-17 PR #3018 implementation receipt: QueryTransaction/QueryContinuation/QueryResultPage now provide canonical request identity, q1 advancing replay, bounded execution, result refs, exact totals where provable, and surface migration across API/CLI/daemon/MCP/annotations/demo. Focused post-merge 67 passed and affected-area 1030 passed, 1 skipped, 1 deselected. No private 4.85-million-block replay was run; z9gh.7 remains the live terminal gate.\n[2026-07-17 bounded read/MCP closure] Routed terminal query-unit API and HTTP adapters through QueryTransaction, made MCP query_units own one canonical request identity for receipts/result refs/continuations, and changed ordinary action pages to select base rows before computing follow-up detail. Registered MCP route test covers query capability discovery plus advancing action continuation; focused devtools test passed 4 tests and devtools verify --quick passed. Not closed: z9gh.7 still owns the private live 4.85-million-block cold-model/terminal replay, which was not automated here.\n[2026-07-18, PR #3068] Added archive-epoch binding to QueryTransactionRequest/QueryContinuation and wired QueryContinuationStaleError into the MCP query_units resume path (see polylogue-z9gh.9 note for the full reconciliation context against an external handoff packet). Residual CLI/MCP/HTTP/Python parity gap this surfaced and did NOT fix: daemon HTTP's /api/query-units accepts no `continuation` query parameter at all, so it has no resume path today even though it returns a continuation token in its response (MCP already accepts+validates continuation; API/Python query_units also has no continuation input parameter). Wiring HTTP (and API) continuation resume, with the same epoch-staleness check now available via validate_continuation_epoch(), is straightforward follow-up scope for whichever pass finishes \"CLI/MCP/HTTP/Python parity\" migration.","status":"in_progress","priority":0,"issue_type":"task","assignee":"Sinity","owner":"[email protected]","created_at":"2026-07-14T22:57:21Z","created_by":"Sinity","updated_at":"2026-07-18T00:16:40Z","started_at":"2026-07-17T11:44:58Z","metadata":{"frontier":"active","frontier_program_ref":"polylogue-z9gh"},"labels":["area:mcp","area:protocol","area:query","horizon:frontier"],"dependencies":[{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-20d.5","type":"supersedes","created_at":"2026-07-15T21:34:34Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-7q16","type":"relates-to","created_at":"2026-07-15T06:25:57Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-9l5.6","type":"relates-to","created_at":"2026-07-15T06:26:00Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-rxdo.3","type":"relates-to","created_at":"2026-07-15T19:19:31Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-z9gh.1","type":"blocks","created_at":"2026-07-15T00:57:24Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-z9gh.2","type":"blocks","created_at":"2026-07-15T00:57:27Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-z9gh.3","type":"relates-to","created_at":"2026-07-15T19:19:42Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-z9gh.9","type":"parent-child","created_at":"2026-07-15T00:57:20Z","created_by":"Sinity","metadata":"{}"}],"comments":[{"id":"019f6407-5537-72fe-b283-e820d2e288b7","issue_id":"polylogue-z9gh.9.1","author":"Sinity","text":"[Dogfood 2026-07-15 / F-003, F-006 diagnostics, F-009, F-011 contract, F-015] Live exact-selection canaries expose the shared-transaction gap. A bare native UUID resolves in SQL but list/select discards the canonical row via an unresolved residual startswith filter. Exact canonical ID then analyze count, grouped stats, facets, and postmortem silently broadened to all 18,430 sessions because CLI aggregate dispatch and the API kwargs adapter omit session_id; pathology materialization shares the write-side risk. Explain recompiles query terms and omits root flags. Exact summary and transcript JSON were byte-identical at 242,783 bytes. Public tool_result_is_error is integer on one route, bool on another, absent on a third. These are primary closure anchors for canonical request scope, deletion of parallel filter maps, typed pages, and truthful summary projection.","created_at":"2026-07-15T04:27:10Z"}],"dependency_count":2,"dependent_count":5,"comment_count":1}
{"_type":"issue","id":"polylogue-z9gh.9.1","title":"Land the shared query transaction across every read surface","description":"The mandate-critical read failures are one implementation gap, not separate ergonomics, pagination, parity, and overflow projects. Land the bounded query transaction as the sole production read boundary and absorb the complete remaining contracts of polylogue-rsad and polylogue-t46.3. The cancellation/selective-plan slices and query-receipt contract remain separately verifiable because they have distinct proof and durability concerns; all surface-specific response behavior belongs here.","design":"Add polylogue/archive/query/transaction.py as the sole orchestration boundary. QueryExecutionRequest wraps either a canonical SessionQueryPlan or terminal QueryUnitSource plus structural filters, material scope, projection/render profile, stable order/frame/snapshot, deadline, and query identity. QueryExecutor composes z9gh.1 execution control with z9gh.2 selective relations and chooses keyset continuation for stable indexed order, deterministic snapshot re-execution for safe immutable plans, or an owned ephemeral spool for recursive, aggregate, or unstable plans. QueryResultPage owns compact typed rows, exact or qualified total/coverage, useful first-page evidence, complete opaque continuation state, stable query/result refs, and independently pageable graph nodes and edges. Migration order on one branch: first query_units and list/search; then session/message/block/action/file reads; then tree/topology and insight-as-saved-query reads; then CLI, MCP, HTTP, and Python adapters; finally delete parallel pagination/filter/overflow/query-recording owners. Primary anchors: archive/query/{plan.py,archive_execution.py,unit_results.py}; storage/sqlite/archive_tiers/archive.py; api/archive.py; mcp/{server_tools.py,archive_support.py,server_support.py}; daemon/http.py; cli query contracts and verbs; surfaces/payloads.py. Replace server_support response_budget_exceeded whole-payload substitution with page construction before serialization. Absorb rsad behavior as declared projections and diagnostics: compact optional boilerplate, excerpts, truthful summaries, valid-value recovery, deduplicated sessions, and zero-hit explanation. Reuse minimal rxdo.3 identities without blocking on its full telemetry program.","acceptance_criteria":"1. z9gh.1 and z9gh.2 acceptance criteria pass through the shared executor, including prompt cancellation, bounded RSS/temp work, and selective plans. 2. Every rsad flow is satisfied at this boundary: no erased successful result; list/search/query/session/messages/tree/topology are losslessly resumable; recursive nodes/edges page independently; boilerplate is compact/opt-in; excerpts and truthful summaries exist; valid-value and zero-hit diagnostics teach recovery; list sessions deduplicates by identity. 3. CLI, MCP, HTTP, and Python execute the same canonical plan and return identical totals, stable order/frame, page boundaries, cursors, and result refs for identical requests. 4. Cursor/ref state preserves the complete expression, structural filters, material scope, projection/render budget, sort, snapshot, order, and query-run identity; following it yields every logical row exactly once and terminates with no semantic cap. 5. rxdo.3 query-run/result/evaluation refs are populated for committed reads. 6. Grep/source review finds no second per-surface owner for filter mapping, continuation state, totals, overflow replacement, cancellation, or query receipts, and no path serializes a full result merely to discard it. 7. The original archaeology flow and Workflow reconstruction finish in fewer than ten discovery/read calls, while live-scale and mutation tests fail when the shared executor is removed or bypassed.","notes":"[2026-07-15 invariant-collapse pass] This bead now absorbs the full remaining scope of polylogue-rsad and polylogue-t46.3. They are superseded rather than independently scheduled; their incident details remain durable regression evidence. It composes under polylogue-4p1 read algebra rather than replacing that domain contract.\nFrontier correction 2026-07-15: full rxdo.3 telemetry/privacy/@last behavior is compatible follow-on work, not a hard prerequisite for restoring lossless bounded query execution. This slice owns the minimal stable query/result/continuation identity required by transport; rxdo.3 enriches committed-run telemetry without gating the mandate repair.\n[2026-07-15 exact transport/execution replay] Valid live reads were destroyed at the interface boundary: list 100 found 129 candidates and built 54,344 bytes; search Sonnet found 50 and built 112,701 bytes; get_session_topology for the correct coordinator built 137,223 bytes. Each successful result was replaced wholesale by response_budget_exceeded with continuation.arguments={}, so no evidence row survived and replay was impossible. After narrowing to limit=3, useful rows arrived. Correct structural attempts then exposed execution failure: archive_list_sessions(tool=Workflow) plus a Wave 2 search ran \u003e150s before termination; the Wave 2 search alone ran \u003e79s; query_units over delegations for the known coordinator ran \u003e79s. The shared transaction must physically page before full serialization, emit complete opaque continuation state, preserve a useful prefix/page, and make termination interrupt SQLite/derived work. Requested limit is a logical maximum, never a requirement that one transport response contain that many rows.\n[2026-07-15 continuation root cause] The empty continuation was deterministic, not lost by the client. async_safe_call installs only fallback response arguments derived from an optional session_id. archive_list_sessions and archive_search_sessions never enter hooks.response_context with their real request, and pass no session_id, so _budget_envelope sees their tool name with arguments={}. archive_search_sessions also exposes no offset/cursor and reports total=len(capped_hits), so even a preserved smaller limit could not enumerate the full match set. get_session_topology has no paging/projection argument; its generic fallback can only replay the identical oversized call, creating a non-progressing loop. Existing continuation tests cover archive_get_session and explicitly context-wrapped tools, but there is no over-budget contract test for archive list/search/topology. The shared transaction must delete this per-tool opt-in context/fallback design, not merely fill three missing dictionaries.\n[2026-07-15 semantic-cap census] Static MCP inspection finds 18 directly registered tools that accept limit but expose no offset/cursor/page token: compose_context_preamble, tool_call_latency_distribution, find_stuck_sessions, find_abandoned_sessions, find_resume_candidates, find_similar_sessions, get_postmortem_bundle, get_pathologies, archive_search_sessions, neighbor_candidates, provider_usage, blackboard_list, list_assertion_claims, list_assertion_candidates, list_assertion_candidate_reviews, archive_debt, explain_import, and agent_coordination. This excludes dynamically registered insights and oversized unpaged graphs such as topology. Not every limit is wrong: ranked recommendations, summaries, and context compilation may be intentionally bounded. But every read must declare whether it is an exhaustive relation page, top-k ranking, sample, aggregate summary, or bounded context; exhaustive logical results need continuation/result refs, and ranked/summary surfaces need an exhaustive underlying query path plus explicit omitted/coverage semantics. No hidden limit may masquerade as totality.\n[2026-07-15 live audit reproduction] MCP search with origin=chatgpt-export and limit=30 built 594,054 bytes for query polylogue and returned only response_budget_exceeded. Its prescribed recovery was limit=3, but the same call at limit=3 still built 41,371 bytes and returned the same metadata-only refusal, so the continuation did not make progress. query_units over messages where text:\"prework\" built 450,317 bytes and returned continuation.arguments={}, which cannot replay the expression or filters. This independently reproduces both failure classes already owned here: a narrowing instruction that remains over budget and an uninvokable empty continuation.\nInvariant consolidation 2026-07-15: absorbs polylogue-20d.5. Its three concrete residues—lineage-composed transcript streaming, messages --full iterator/file output, and SQL-pushed material_origin pagination—are required paths under the sole bounded query transaction and its no-full-materialization AC.\n[2026-07-15 installed-skill dogfood reproduction] Invoking MCP readiness_check through the shipped Polylogue skill built 27,673 bytes against a 25,000-byte budget and returned response_budget_exceeded with continuation.tool=readiness_check and continuation.arguments={}. Repeating that continuation necessarily rebuilds the same oversized monolith, so the advertised recovery cannot progress. Add readiness/status to the over-budget regression matrix: preserve a useful compact page, return a component/detail ref or advancing cursor, and never prescribe an identical argument-less replay.\nTerra-readiness correction 2026-07-15: fixed the module boundary, plan/page strategy, adapter migration order, and deletion targets. z9gh.1 owns execution control; z9gh.2 owns selective derived relations; this bead owns the one transaction and every surface adapter.\n2026-07-17 implementation-readiness integration map: this is the only transaction integration branch. Consume, do not reimplement, #2964 execution control (z9gh.1) and #3004 declarations (z9gh.3 substrate). z9gh.2 is the only new derived index prerequisite. Land in this order on one branch: canonical request/page/opaque-cursor types and query_units route; lossless first-page construction replacing response_budget_exceeded; list/search; structural session/message/block/action/file; tree/topology/insight; then CLI/MCP/HTTP/Python parity and deletion of duplicate pagination owners. Before each migration, pin existing route rows/totals/order/error semantics as a production golden; after, prove the same canonical plan and cursor enumerate exactly once. A current grep target is mcp/server_support.py response_budget_exceeded and all envelope/pagination owners; do not claim completion while that whole-payload replacement remains reachable.\n2026-07-17 PR #3018 implementation receipt: QueryTransaction/QueryContinuation/QueryResultPage now provide canonical request identity, q1 advancing replay, bounded execution, result refs, exact totals where provable, and surface migration across API/CLI/daemon/MCP/annotations/demo. Focused post-merge 67 passed and affected-area 1030 passed, 1 skipped, 1 deselected. No private 4.85-million-block replay was run; z9gh.7 remains the live terminal gate.\n[2026-07-17 bounded read/MCP closure] Routed terminal query-unit API and HTTP adapters through QueryTransaction, made MCP query_units own one canonical request identity for receipts/result refs/continuations, and changed ordinary action pages to select base rows before computing follow-up detail. Registered MCP route test covers query capability discovery plus advancing action continuation; focused devtools test passed 4 tests and devtools verify --quick passed. Not closed: z9gh.7 still owns the private live 4.85-million-block cold-model/terminal replay, which was not automated here.\n[2026-07-18, PR #3068] Added archive-epoch binding to QueryTransactionRequest/QueryContinuation and wired QueryContinuationStaleError into the MCP query_units resume path (see polylogue-z9gh.9 note for the full reconciliation context against an external handoff packet). Residual CLI/MCP/HTTP/Python parity gap this surfaced and did NOT fix: daemon HTTP's /api/query-units accepts no `continuation` query parameter at all, so it has no resume path today even though it returns a continuation token in its response (MCP already accepts+validates continuation; API/Python query_units also has no continuation input parameter). Wiring HTTP (and API) continuation resume, with the same epoch-staleness check now available via validate_continuation_epoch(), is straightforward follow-up scope for whichever pass finishes \"CLI/MCP/HTTP/Python parity\" migration.\n[2026-07-19, PR #3171 investigation] Investigated the 2026-07-18 residual gap\n(HTTP /api/query-units has no continuation param; API/CLI query_units also\nmissing continuation input). Source review found BOTH flagged gaps already\nclosed on master by the same day's later commit: dc6fa632a/#3095 (the\nsix-tool MCP cutover hardening pass, merged 18:24 -- after this bead's\n00:16 note) added continuation decoding + QueryContinuationStaleError\nhandling to both DaemonAPIHandler._handle_query_units (polylogue/daemon/http.py)\nand Polylogue.query_units (polylogue/api/archive.py), reusing the same\nquery_units_transaction_request/QueryTransaction/QueryContinuation\nprimitives MCP already validated -- MCP's query tool\n(mcp/server_cutover.py) in fact delegates straight into\nPolylogue.query_units, so there was never a second mechanism built. The\nbead's own note predates that fix and was never updated.\n\nWhat was genuinely still missing: proof this held together end-to-end.\nHTTP had its own continuation suite (tests/unit/daemon/test_web_reader.py),\nAPI's own continuation= keyword had ZERO direct test coverage (only\nindirect coverage via MCP tests patching the facade in), and no test drove\nHTTP+API+MCP against one shared corpus.\n\nPR #3171 closes that test gap: 4 new API-direct continuation tests\n(tests/unit/api/test_facade_contracts.py) plus a genuine 3-surface parity\nsuite (tests/unit/archive/query/test_continuation_surface_parity.py)\nproving byte-identical message_id ordering/query_ref/result_ref across\nHTTP/API/MCP for the same expression+continuation, and identical\nquery_continuation_stale rejection on all three when a write lands\nmid-resume. No production code changed; no second continuation mechanism\nbuilt.\n\nExplicitly NOT touched: CLI does not call query_units at all (separate\nSessionQuerySpec/archive_query.py limit-offset path) -- no CLI paging\nsurface exists to wire continuation into. Also reviewed but left alone:\nthe z9gh.3-flagged near:\"\"/lineage:id: execution-layer gaps live in the\ngeneric find/read CLI route, not this HTTP/API/MCP query_units path.\n\nVerification: devtools test (parity+facade+MCP surfaces) 286 passed;\ndevtools verify --quick green 16/16. One pre-existing unrelated failure\nnoted (test_web_reader.py::test_operational_web_payloads_redact_configured_archive_paths,\nreproduced at origin/master HEAD 71d134eaa with none of this PR's files\npresent).\n\nPR: https://github.com/Sinity/polylogue/pull/3171","status":"in_progress","priority":0,"issue_type":"task","assignee":"Sinity","owner":"[email protected]","created_at":"2026-07-14T22:57:21Z","created_by":"Sinity","updated_at":"2026-07-19T20:46:07Z","started_at":"2026-07-17T11:44:58Z","metadata":{"frontier":"active","frontier_program_ref":"polylogue-z9gh"},"labels":["area:mcp","area:protocol","area:query","horizon:frontier"],"dependencies":[{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-20d.5","type":"supersedes","created_at":"2026-07-15T21:34:34Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-7q16","type":"relates-to","created_at":"2026-07-15T06:25:57Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-9l5.6","type":"relates-to","created_at":"2026-07-15T06:26:00Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-rxdo.3","type":"relates-to","created_at":"2026-07-15T19:19:31Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-z9gh.1","type":"blocks","created_at":"2026-07-15T00:57:24Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-z9gh.2","type":"blocks","created_at":"2026-07-15T00:57:27Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-z9gh.3","type":"relates-to","created_at":"2026-07-15T19:19:42Z","created_by":"Sinity","metadata":"{}"},{"issue_id":"polylogue-z9gh.9.1","depends_on_id":"polylogue-z9gh.9","type":"parent-child","created_at":"2026-07-15T00:57:20Z","created_by":"Sinity","metadata":"{}"}],"comments":[{"id":"019f6407-5537-72fe-b283-e820d2e288b7","issue_id":"polylogue-z9gh.9.1","author":"Sinity","text":"[Dogfood 2026-07-15 / F-003, F-006 diagnostics, F-009, F-011 contract, F-015] Live exact-selection canaries expose the shared-transaction gap. A bare native UUID resolves in SQL but list/select discards the canonical row via an unresolved residual startswith filter. Exact canonical ID then analyze count, grouped stats, facets, and postmortem silently broadened to all 18,430 sessions because CLI aggregate dispatch and the API kwargs adapter omit session_id; pathology materialization shares the write-side risk. Explain recompiles query terms and omits root flags. Exact summary and transcript JSON were byte-identical at 242,783 bytes. Public tool_result_is_error is integer on one route, bool on another, absent on a third. These are primary closure anchors for canonical request scope, deletion of parallel filter maps, typed pages, and truthful summary projection.","created_at":"2026-07-15T04:27:10Z"}],"dependency_count":2,"dependent_count":5,"comment_count":1}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Redact real session and corpus identifiers from this cloud artifact.

The expanded notes now embeds live ChatGPT/Claude corpus metadata, including session UUIDs, capture references, and environment details. Replace these with synthetic fixture IDs and redacted evidence; do not commit real session provenance or corpus-derived identifiers to the repository.

As per coding guidelines, never upload real Claude or Codex session corpora in cloud environments; use synthetic fixtures instead.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.beads/issues.jsonl at line 15, Redact real session, corpus, capture, and
environment identifiers from the expanded notes and comments in the issue
record. Replace live provenance and evidence with synthetic fixture IDs and
generalized redacted descriptions while preserving the technical failure and
verification details. Do not alter the implementation scope or acceptance
criteria.

Source: Coding guidelines

@Sinity
Sinity merged commit 6578484 into master Jul 19, 2026
3 checks passed
@Sinity
Sinity deleted the feature/query/continuation-resume-parity branch July 19, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant