Skip to content

test(mcp): add migration and concurrency evidence - #4037

Merged
Sinity merged 15 commits into
masterfrom
feature/test/mcp-evidence
Aug 20, 2026
Merged

Sinity merged 15 commits into
masterfrom
feature/test/mcp-evidence

Conversation

@Sinity

@Sinity Sinity commented Aug 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Add direct migration and concurrent-load evidence for the consolidated MCP read surface, then make the concurrent evidence hermetic.

Problem

The t46.8.2 report lacked direct migration-harness and concurrent-load evidence. The latest CircleCI quick gate stopped before devtools verify --quick because structured scope validation rejected a Beads snapshot that did not match its checked-out head. Separately, review found that the concurrent registered-MCP test allowed production call-log events to write to ambient state.

Solution

  • The real-server migration red twin disables QueryTransaction, disables daemon call logging, and requires the registered MCP query to return a typed internal error.
  • The load test drives all six registered read tools through real RuntimeServices and ArchiveStore from 16 threads across 32 request identities. It checks identity isolation, archive-read admission membership and drain, descriptor counts, temporary artifacts, and SQLite integrity.
  • The load test now points configuration and XDG state at its temporary archive, sets POLYLOGUE_NO_DAEMON=1, and fails if the production MCP dispatcher creates a durable call-log outbox. The red twin failed before that flag because registered calls created state/polylogue/mcp-call-log. Its descriptor baseline is captured after context setup and before concurrent reads, so setup teardown cannot impersonate a reader leak.
  • Review closure makes the cancellation worker prove it observed the disconnect event, follows the oversized response's real continuation through the registered handler, and requires its next page to contain non-empty, non-repeated message identities. The AC#6 receipt explicitly includes the resource-resolver transaction mutation proof.

Bead disposition

Bead Disposition Evidence Residual
polylogue-0ku83 partial migration and concurrent registered-route evidence, including the call-log red twin and 44 focused managed tests Host-wide RSS/PSS/swap/temp steady-state proof remains owned by open polylogue-4s3c; this PR does not claim it.

Verification

  • devtools test tests/unit/mcp/test_migration_load_evidence.py: 4 passed in 11.18s at the current merged-base head.
  • devtools verify --quick: quick run success (exit 0) in 43.0s.
  • Pre-push devtools verify --quick: quick run success (exit 0) in 63.1s.
  • devtools test tests/unit/mcp/test_migration_load_evidence.py tests/unit/mcp/test_server_surfaces.py::test_query_transaction_certifies_twenty_large_messages_across_api_and_mcp tests/unit/mcp/test_server_surfaces.py::test_query_resource_golden_fails_when_shared_transaction_is_bypassed tests/unit/archive/query/test_read_surface_control.py tests/unit/archive/query/test_transaction.py tests/unit/archive/query/test_execution_control.py: 44 passed in 25.36s.
  • Pre-push devtools verify --quick: quick run success (exit 0) in 84.0s.
  • Anti-vacuity: the red twin invokes registered MCP tools, the real dispatcher, RuntimeServices, ArchiveStore, QueryTransaction, and the real call-log hook. Without POLYLOGUE_NO_DAEMON=1, it observes the durable outbox created by production code.

Adversarial review notes

One independent structured-review invocation failed in transport before it returned a verdict. The owner then re-reviewed every active and outdated automated thread against the current diff. The earlier substring, foreign-session-ID, descriptor-count, raw-wire-budget, and partial-disposition findings are covered at the current head. The call-log finding was fixed in 0ca44fa70; the exact merged-base receipt found and a215238f8 fixed a descriptor-baseline ordering error. 20de2d33d closes the four subsequently active threads: migration call logging, resource-resolver receipt coverage, observed cancellation, and advancing continuation. The query_units, archive.resolve_ref, and status owner counts prove the intended transaction membership for query, read/get, and status. Explain is metadata-only and context intentionally does not use archive-read admission.

Scope carrier

Sinity added 2 commits August 20, 2026 13:14
Add production-route anti-vacuity for the shared query transaction and concurrent six-tool load evidence over real RuntimeServices. Verify admission bounds, request identity isolation, archive cleanup, and SQLite integrity.

Ref polylogue-0ku83
Document the AC#6 fail-closed migration proof and AC#7 concurrent six-tool load evidence, including cleanup checks and the explicit host-memory measurement boundary.

Ref polylogue-0ku83
@coderabbitai

coderabbitai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ca7de247-bbe2-4ffd-90eb-df19fd5b4195


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.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb3cb7b7b2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/mcp-surface-report-2026-08.md Resolved
Problem: AC#7 allowed an empty context delivery list to pass, described shared status as request-identified, and only observed two concurrent admissions.

What changed: seed marker-bearing context receipts through the real write route, read them through the real context route, validate the shared archive status payload, and synchronize DEFAULT_CAPACITY admissions to prove saturation and drain. Update the surface report to match the production paths.

Alternatives rejected: static context fixtures and a lower-bound concurrency assertion do not prove the production contracts.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ae7108e3d7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Exercise disconnect through the registered query handler after real result assembly, and assert transaction cleanup and admission release. Force the response-budget path with large results while measuring transient allocations, archive sidecars, and descriptor cleanup. Preserve the concurrent context, status, identity, and admission evidence.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dbbd7d9b03

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/mcp-surface-report-2026-08.md Resolved
Sinity added 7 commits August 20, 2026 14:14
Problem: the concurrent MCP load compared a post-context-seeding descriptor snapshot with the state after the runtime-service scope had been restored. That treated setup-owned durable-tier handles as load-owned leaks.\n\nWhat changed: capture the load baseline before context setup, assert route cleanup against that baseline while the service scope is active, and repeat the same assertion after scope restoration. Apply the same ownership-boundary proof to the large-result route.\n\nAlternatives rejected: preserving source.db, audit.db, and user.db handles across the load would weaken cleanup evidence.\n\nCompatibility/migration: test-only; no runtime behavior or schema changes.
Problem: the large-result MCP test parsed the production handler response and measured a compact re-encoding, so its byte assertion did not cover the actual formatted wire string.

What changed: retain the exact handler response, measure its UTF-8 bytes, and assert the formatted response is the measured value. Record the full AC#7 host-wide and steady-state/orphan evidence boundary as partial, with polylogue-4s3c as the existing live-scale successor.

Compatibility/migration: test and report only; no runtime or schema changes.

Ref polylogue-0ku83
Problem: the concurrent MCP evidence route allowed the production call-log dispatcher to persist outbox records under ambient state.\n\nWhat changed: bind config and XDG state to the test archive, disable daemon call logging, and assert that no call-log outbox remains. The red twin fails without the daemon-disable flag through the registered MCP dispatcher.
Problem: the concurrent load test compared its post-load descriptor snapshot against pre-context setup state, so setup cleanup could appear as a reader leak.\n\nWhat changed: capture and compare the descriptor baseline inside the isolated runtime-services scope after context setup.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d24cfd580d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/mcp-surface-report-2026-08.md Resolved
@Sinity
Sinity merged commit a769077 into master Aug 20, 2026
3 checks passed
@Sinity
Sinity deleted the feature/test/mcp-evidence branch August 20, 2026 15:10

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 20de2d33df

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sinity added a commit that referenced this pull request Sep 29, 2026
## Summary

Test-only salvage of Codex-debt worker 16 (`polylogue-1tyq5.122`). Eight
unit tests now fail on the regression each one names, instead of passing
on a weaker proxy. No production code changes.

## Problem

Hosted review findings on earlier PRs showed that these tests could not
catch the defects they claim to guard. For example, the antigravity
symlink test used a `.md` path that the conversation walker never
considers. The blob-store fsync test also passed with every staged-file
fsync removed. The worker's patch arrived truncated. Eight complete
test-file diffs were recoverable. The ninth
(`test_durable_change_train.py`) was cut off after its header and is not
included.

## Solution

| key | disposition | evidence | test |
|---|---|---|---|
| 122.01 #4037 test_migration_load_evidence.py:357 | fixed-kept
(reworked) | query continuations are opaque `q2.` tokens
(`server_support.py` `_budget_envelope`), so the worker's
`arguments["offset"]` read raised KeyError | decodes the token and
requires `request.offset == returned_items` |
| 122.02 #4037 test_migration_load_evidence.py:460 | fixed-kept | status
check rejected only markers | status must contain no seeded session ID
either |
| 122.08 #5470 test_resource_pilot.py:104 | fixed-kept | `perf_counter`
timing test had no `uses_real_clock` marker | marker added with its
reason |
| 122.09 #5470 test_resource_pilot.py:116 | fixed-kept | receipt went to
captured stdout | `emit_receipt("pilot-provider-build-cost")` plus
readback |
| 122.12 #4788 test_antigravity_source_acquisition.py:187 | fixed-kept |
`.md` symlink is never a conversation candidate | symlinked `.pb` next
to a regular `.pb`; only the regular one is admitted |
| 122.13 #5325 test_cold_build_generation.py:263 | fixed-kept |
preflight depended on the runner's free space | `_free_space` pins 512
MiB, and the receipt must record it |
| 122.14 #5334 test_finished_build_equivalence.py:183 | fixed-kept |
both arms call `backfill_historical_revision_evidence` directly | arms
are described as replay configurations; receipt names the executed
`callable_identity`; the unexercised `production_driver` labels are
removed |
| 122.17 #5340 test_tool_result_unknown_reason_contract.py:982 |
fixed-kept | a success-only route would demand an unknown declaration |
origins come only from routes that expect `UNKNOWN` |
| 122.20 #4152 test_blob_store.py:65 | fixed-kept | first `fsync` could
be the directory sync | events are classified by `fstat`; the file fsync
must precede `replace` |
| 122.21 #4976 test_bulk_build_lifecycle.py:615 | fixed-kept | protocol
committed per session; production replay passes
`manage_transaction=False` (`revision_governance.py:555`) | each arm
runs in one caller-owned transaction; a trace callback requires exactly
`BEGIN`, `COMMIT` |
| 122.22 #4976 test_bulk_build_lifecycle.py:699 | fixed-kept |
measurements were dropped after the assertions |
`emit_receipt("finished-build-protocol-synthetic")` plus readback |

Removed from the worker's patch as tautological: an `any(...)` assertion
over the same set it iterated, a test asserting its own marker, and a
check that a dict it had just built lacked a key.

## Verification

- `agentctl job start polylogue verify_quick --workspace
/realm/worktrees/salvage-w16 --wait` → job 2591: `verify: PASSED exit=0
... head=d35b8dc637d8`
- `agentctl job start polylogue pytest_focused --workspace
/realm/worktrees/salvage-w16 --wait -- <all 8 files>` → job 2498 (before
the 122.01 rework): 198 passed, 4 failed. After the rework, job 2560 on
d35b8dc (the five files whose tests had failed or changed since
2498): 138 passed, 2 failed.
- The remaining failures are in tests this PR does not touch, and they
fail the same way on clean master 1beb2e5 (job 2561, 3 failed):
`test_resource_pilot.py::test_parser_resource_needs_only_provider_bytes`
and `::test_parser_resource_acquisition_opens_no_archive_tier` (the
ChatGPT parser opens `sqlite3.connect(":memory:")` at
`chatgpt.py:3017`), and
`test_bulk_build_lifecycle.py::test_fresh_shard_build_finishes_equivalent_to_retained_indexes`.
- Mutation proof, job 2501: with `_walk_source_paths` following symlinks
and the staged fsync removed from `write_from_bytes`, both the new
antigravity test and the new blob-store test fail (`2 failed`).

## Self-review

- **Sibling sites.** Both status and continuation assertions in the MCP
file were reviewed. The three sibling fsync sites in `blob_store.py`
share the same event classification, and only `write_from_bytes` is
exercised here, as before.
- **Cancellation, shutdown, unbounded reads.** Not applicable; no loops
or readers were added.
- **Fail-open fallbacks and compatibility shims.** None. The retired
`_routed_origin_names` and `production_driver` have no remaining
references.
- **Production route.** Every changed test drives the production
callable. 122.14 narrows its claim instead of pretending to exercise
drivers it does not call.
- **Removed symbols.** `rg _routed_origin_names|production_driver tests`
finds no remaining uses.

## Derived-identity closure

No production files are touched, so the closure does not move.

## Residuals

- Worker 16's 22 claimed fixes for `.120` and `.121` never reached a
branch, because the publication connector returned 502. They remain
open.
- Findings 122.10, 122.11, 122.24 and 122.25 were not reached (122.24
and 122.25 were in the truncated diff), along with the other `.122` and
`.123` findings.
- The three failures that already occur on master (above) are not
addressed here.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_015pdKaZWyGe6Ngvsz468dzg

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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