Repository navigation
fix(trace): observe MCP audit tail and bounded capture loss - #1326
Merged
Merged
Conversation
This was referenced Oct 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MCP response handoff preceded synchronous audit persistence, so a blocked Store Mutex could add seconds after
handler_returnedwith no correlated request-tail evidence. Keep that compatibility boundary in place and record audit/finalizer/adapter completion separately; report known capture loss without blocking tools.Boundaries and ownership
handler_returnedtiming. Explicit original identity now reachesaudit_finalizeand wholerequest_finalize; lifecycle scope exit addshandler_finishedafter synchronous cleanup. Cancellation/unwind stays incomplete. These boundaries do not claim client receipt or body-stream EOF.try_sendstays nonblocking. A bounded, try-lock map coalesces losses for <=128 trace IDs and persists gap markers through the existing writer/budget/retention owner. Reader/UI expose an incomplete trace and a known-loss lower bound. Process counters also expose marker loss. Absence of a marker or presence of Handler finish never proves completeness.Validation on mini (isolated fixtures)
cargo test -p webcodex trace: 72 passed, including actual successful MCP invocation while the writer is blocked/saturated, 71 dropped events across 8 trace IDs, bounded overflow, cancellation, timeout and Runner disconnect.cargo test -p webcodex audit_: 71 passed; finalfinalization_tests: 2 passed. Real SQLite mutex + channels hold two requests after handoff; both finish durations include the wait, INFO logs and metadata retain distinct IDs, and failed audit persistence does not change successful tool output.cargo test -p webcodex-store connection: 11 passed, including nested context/unwind/re-entry and fail-open callback tests.cargo test -p webcodex-tool-contracts: 342 passed, 1 pre-existing ignored.check:distpassed. Homebrew Node's zlib produced different PDF gzip bytes; all 183 decompressed assets matched, and official Node 22.23.4 / zlib 1.3.1 passed unchanged PDF artifacts. No unrelated generated PDF changes included.RunnerPollRequesttest import warning remains.Independent main-based PR A. Related B: #1324, C (stacked on B): #1325. No production configuration edits, service restarts, deployment or automatic merge. CI at
b9260efc6passed every selected job: Linux Server/Runner/workspace/tooling, contract, MCP conformance and aggregate gates. Native platform build jobs were skipped by this PR's path matrix. Workflow: https://github.com/yyjeqhc/webcodex/actions/runs/40492656887 .