DD-469: Attention 3/6 — bounded queries and ranking #5
Labels
No labels
epic
needs-info
needs-triage
ready-for-agent
ready-for-human
svd:fire
svd:go
svd:hold
svd:respec
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dev/attention-mind-mcp#5
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Scope and authority
Parent: #1 (DD-469). Product decisions: ADR 0002. Agreed decomposition.
Implement attention/1.0 and binding 1.1 pinned to mind-spec
3da6a263e6aeb3f37d25590d6ab755045ff53786, including its schemas and conformance obligations. Preserve the single queue authority, independent grants and host-owned interruption policy. This issue is a bounded implementation brief; it does not claim working software or grant production deployment.Blocked by
None.
Completed prerequisite
Durable queue/commands #4 landed in PR #11 as
04b0704842deon 2026-11-15. This retires the #4 dependency; it does not dispatch this issue.Deliverables and acceptance
Deliverables. Implement
list,getandexplainagainst the current authorised projection. Use the pinned priority/due/first-acceptance/item-UUID order and fixed reason codes. Preserve terminal items until explicit Forget; eligible is the default view andallstill excludes forgotten items. Continuations bind actor, queue, recovery generation, query/limit, mutation generation and frozen evaluation time, with one five-minute deadline measured from the first page. Do not retain historical payload snapshots.Enforce strict JSON decoding, schema formats, semantic UTF-8 checks, the 16 KiB logical request ceiling, 1 MiB response ceiling and 50/default, 100/maximum row limits. Bound raw transport work as well as logical documents. Shorten pages to the byte budget while ensuring continuation progress. Reauthorise and recheck erasure before releasing buffered content; coordinate the final Forget fence with slice 4.
Acceptance. Exercise equal-priority ties, dated/undated order, replacement age preservation and explain inputs. Verify fractional microsecond snooze boundaries and backward wall-clock correction across actual restart. Mutations invalidate existing views; no-op writes and passive time passage preserve frozen views. Check actor/query/limit/generation mismatches, unknown cursors and the original five-minute expiry. Send malformed Unicode, duplicate keys, nonfinite numbers, extra fields and oversized documents through the actual adapter. Test multibyte record-ID limits and byte-limited pages without empty-page loops. Revoke authority while a response is buffered and prove it cannot subsequently release protected content. Exercise the erasure-fence interface with a test control here; the actual Forget race is required integration evidence in slices 4 and 6.
Boundary. Reads do not acknowledge, dispose or deliver. Passing logical byte fixtures does not establish packaged memory, latency or concurrency budgets; those require measurement in slice 6.
Completion evidence
Link the implementing PR and exact commit, commands and results for the acceptance obligations above. Distinguish actual provider checks from reference-model tests; record unsupported checks as unsupported. Follow the repository's specification/review process before implementation. Do not close the parent epic from this slice.
Architect review of draft spec from Half-A
20261115T112242Z-2d09e15e. This is a hold on dispatch pending correction and re-verification, under the operator’s DD-469 continuation authority. The live Half-A repair pass remains owned by mind-spec@voyager; do not start a duplicate run.The draft could not read the pinned contract prose from its nested sandbox. I checked the immutable attention/1.0 README at 3da6a263e6ae and CONFORMANCE. The local copy is unchanged at that pin. These are settled contract requirements, not new product decisions.
view_changed”. For a syntactically valid list request, this covers forged/unknown/wrong-purpose cursors and incompatible actor, query/limit or token identity/generation. Preserve the normal top-level request validation and queue/recovery preconditions separately; token expiry isview_expired. Update the approach, invariants and tests together. The draft’sinvalid_requestmapping is not approved. Its ranking direction and inclusive snooze-expiry boundary do agree with the pin.Service.executeruns before FastMCP constructs/buffers/serializes the response; FastMCP/ASGI can await before handing over its body. Require a final fence at the buffered transport boundary and a defined serialization mechanism between response handoff and conflicting authority changes, prepared recovery transitions and Forget. Another check without a serialization rule leaves a race. Add a served-transport barrier after computation/serialization but before body handoff, then revoke or erase through the test seam and prove that protected bytes are withheld. Retain a private hook for #6 to use. If the correct mechanism needsstore.pyor a coordinator file, add it explicitly to Primary Files and Source Hashes before dispatch. The Attention session independently raised the same gap.The verifier’s existing blocking finding on MCP text-copy escaping/raw-envelope size must also be resolved with the actual encoded envelope budget and transport tests. A logical 1 MiB result can exceed a naive two-copy raw allowance.
Refs #5is accepted. I will post completion evidence and close #5 only after the reviewed, integrated, exact-head green merge. The real Forget race and packaged acceptance remain with #6/#8; #1 stays open. Thus neither missing-contract access nor the closure bookkeeping needs another human decision.Full pinned-source snapshots with SHA-256 hashes and this review are available locally at
/tmp/dd469-attention5-contract-feedback.mdfor incorporation into the next stage’s readable context. No portable contract bytes are to change.⏸ SVD architect gate: dev/attention-mind-mcp#5 dd-469-attention-3-6-bounded-queries-and-ranking
Status: CLEAN after 1 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity
substrate· dispatch efforthighRun:
20261115T112242Z-2d09e15eHeld because: CLEAN but 6 open risk(s) (4 verification · 2 decision) — HOLD-ALL parks everything. The risks, verbatim:
Open risks:
Change: Mirror commands.py's token and precondition shapes (purpose_key/issue/authenticate_token at commands.py:53-140; decide order at 169-190) for the new queries.py. Move RAW_BODY_BYTES, RAW_RESPONSE_BYTES and envelope() verbatim from mcp_adapter.py:29-30,36-41 into contract.py, and re-export them explicitly from mcp_adapter with
X as X(mypy strict). Add ENVELOPE_SLACK_BYTES=4096 and ENVELOPE_BYTES=2,093,056 (= RAW_RESPONSE_BYTES − RAW_BODY_BYTES − slack). Bound list pages on the exact MCP envelope bytes, not the logical document. The incremental accounting is fixed + Σ(len(encode(item)) + escaped-text-len(item)) + 2·(n−1), and the assembled page gets one final exact len(encode(envelope(doc))) check. Keep the 2,162,688 cap unchanged, because the client depends on it (binding.py:83,260 and the raw structuredContent ≤ RESULT_BYTES check at binding.py:86-88). OperationTool.run builds its result from envelope(). Boundary.bounded_send (mcp_adapter.py:109-113) checks content-length before forwarding http.response.start: an oversize response becomes 500 internal_failure, never a truncated body. Service.execute dispatches the three queries, branches the post-check at service.py:78-85, and runs a release fence in a fresh transaction.Files:
src/attention_mind_mcp/queries.py·src/attention_mind_mcp/service.py·src/attention_mind_mcp/contract.py·src/attention_mind_mcp/mcp_adapter.py·tests/test_queries.py·tests/test_commands.py·tests/test_foundation.py·README.mdSource Hashes table: 1 of 20 row(s) malformed and skipped —
All 17 existing-file hashes were re-computed this rework (shasum -a 256(cut -c1-12) at HEAD04b0704842, with a clean tree.binding.pyis newly hashed as a read-only reader of the moved wire seam.) — the drift guard cannot check them; Half-A will report HOLD.Decision: accept the 6 open risk(s) above and dispatch this spec (
svd:go), or park (svd:skip) / re-spec (svd:respec)?Your call (when this issue is held at the gate via
svd:hold):svd:go— approve; Half-B dispatch accepts exactly this spec (open risks accepted)svd:firebesidesvd:go— approve AND authorise the Half-B fire from the phone; never on its ownsvd:skip— park it; dispatch refuses it and the issue stays for a humansvd:respec— discard this spec; the next Half-A run re-produces it with this record as prior-attempt contextSpec:
/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-15-dd-469-attention-3-6-bounded-queries-and-ranking.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-15-dd-469-attention-3-6-bounded-queries-and-ranking.md— mind-spec
⏸ SVD architect gate: dev/attention-mind-mcp#5 dd-469-attention-3-6-bounded-queries-and-ranking
Status: CLEAN after 1 rework round(s) · 0 blocking defect(s) · 0 lens(es) INCONCLUSIVE (could not run) · 0 lens(es) DEGRADED (deterministic denial) · complexity
substrate· dispatch efforthighRun:
20261115T112242Z-2d09e15eHeld because: CLEAN but 5 open risk(s) (5 verification) — HOLD-ALL parks everything. The risks, verbatim:
Open risks:
uv run python3 -m pytest -m transport -qon the PR head and in CI (ci/woodpecker/pr/validation). Confirm that test_http_release_fence_revocation (all parameters plus the control), test_http_full_page_wire_bounds, test_http_backward_clock_restart_preserves_floor_and_view_expiry, test_http_continuation_refusals, test_http_query_strict_decoding and test_http_query_tools_exact_schemas passed against the served subprocess. [verification]Change: Mirror commands.py. The continuation token copies issue/authenticate_token (commands.py:63-140) with a distinct purpose_key("continuation"). Result and error documents use domain() (commands.py:150-161), and preconditions follow decide's order (commands.py:164-190). New queries.py provides project/eligible/rank, a scalar-only RANK_SQL scan plus a page-only payload fetch, an envelope-exact page budget, Obligation, ErasureFence/LiveItemsFence and recheck(). Every schema-valid unknown or incompatible continuation (forged, wrong-purpose, token queue or generation, actor, view, limit, position, mutation) returns view_changed, and expiry returns view_expired. service.py owns release_gate (an asyncio.Lock) and the private _erasure_fence control, and adds recheck(). Service.execute only buffers. The release happens in mcp_adapter.py: OperationTool.run executes under release_gate and registers an Obligation in a per-request RELEASE ContextVar slot. Boundary.call bounded_send holds the SDK's http.response.start and buffers the serialized body, fires store.checkpoint("before_release"), then under release_gate runs a read-only Service.recheck and hands off the original bytes or a content-free JSON-RPC refusal, bounded by RELEASE_HANDOFF_SECONDS. RAW*/envelope move to contract.py with an explicit X-as-X re-export. store.py and commands.py are not written: WriterGuard (store.py:59-72, cli.py:102) excludes administrative writers while serving, and every served writer enters through OperationTool.run.
Files:
src/attention_mind_mcp/queries.py·src/attention_mind_mcp/service.py·src/attention_mind_mcp/contract.py·src/attention_mind_mcp/mcp_adapter.py·tests/test_queries.py·tests/test_commands.py·tests/test_foundation.py·README.mdDecision: accept the 5 open risk(s) above and dispatch this spec (
svd:go), or park (svd:skip) / re-spec (svd:respec)?Your call (when this issue is held at the gate via
svd:hold):svd:go— approve; Half-B dispatch accepts exactly this spec (open risks accepted)svd:firebesidesvd:go— approve AND authorise the Half-B fire from the phone; never on its ownsvd:skip— park it; dispatch refuses it and the issue stays for a humansvd:respec— discard this spec; the next Half-A run re-produces it with this record as prior-attempt contextSpec:
/Users/piers/.local/state/exhaust/groupthink/specs/2026-11-15-dd-469-attention-3-6-bounded-queries-and-ranking.md— next:codex-svd dispatch --args '<same-json>' --approved-spec-path /Users/piers/.local/state/exhaust/groupthink/specs/2026-11-15-dd-469-attention-3-6-bounded-queries-and-ranking.mdArchitect gate release by mind-spec@voyager under the operator’s explicit DD-469 grant to continue SVD/batch-SVD and merge T4.
Approved spec SHA-256:
cb177b56e9f82a30791ed3cd25a97d470b5b9e17fb46f4dfe6e6d45ee34b1023, base04b0704842de65cb47fb444a1eb97033299d68a4, Half-A20261115T112242Z-2d09e15e. The revised spec resolves the prior architect HOLD. Automated verification returned zero blocking, degraded or inconclusive lenses; all 18 existing-file hashes and two create rows were independently checked. Dispatch preflight is ready.Disposition of the five verification risks: risks 1–3 are required implementation/merge evidence (served transport, actual serializer/context/handoff and SQLite JSON support). They are accepted for implementation and must pass at the PR head before merge. Risks 4–5 are explicit scope limits: real Forget during buffered release remains unsupported until #6/#8; packaged memory, latency and concurrency budgets remain unsupported until #8. This release makes no claim that those later gates passed.
Applying
svd:gorecords this approval; it does not override source drift, implementation tests or exact-head CI. mind-spec owns this single dispatch. No ADR or portable contract change is authorized.Refs #5; completion evidence and manual closure follow the reviewed green merge, while parent #1 remains open.spec-verify-dispatch Half B for dev/attention-mind-mcp#5 dd-469-attention-3-6-bounded-queries-and-ranking completed integration verify.
3e976d8d6dcodex-svd ship --run-id 20261115T121156Z-96e56214 --confirm-merge)Completed through PR #12, merged to main at
dfcec304d08a14f3734669cef17bafe2bd4a3878from reviewed head3e976d8d6dddc284de8a47a4cf7a63c080d10b2e. Exact-head CI and independent SVD integration passed. Full review and evidence: #12 (comment) .Passed: bounded list/get/explain, ranking, frozen authenticated continuations, logical/wire size limits, served authority and erasure release fencing; 336 unit and 58 HTTP/MCP tests, lint/type checks and package build. Unsupported in this slice: the real Forget-during-buffered-release race (#6/#8) and packaged latency/memory/concurrency budgets (#8). No S3 recovery, delivery, deployment or full-provider conformance is certified. Parent #1 stays open.