Skip to content

feat(trace): inspect bounded metadata evidence and find Window calls - #782

Merged
yyjeqhc merged 5 commits into
mainfrom
feat/bounded-meta-trace-diagnostics
Sep 29, 2026
Merged

yyjeqhc merged 5 commits into
mainfrom
feat/bounded-meta-trace-diagnostics

Conversation

@Xiiiing

@Xiiiing Xiiiing commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Complete the interrupted metadata-trace work saved by the user as 41d1c2345b50fe176d51f337bcbf03e391cdbdcd on base 6524f559a85d2509b7379c472bd63ceb933cd57a. Development and verification continued on xa at /disk6/xie_rh/jialin/git/webcodex. The saved commit is retained, followed by four implementation/review commits:

  • 05f9d9c5 — complete bounded metadata capture, reader/query boundaries, integration and schema regressions.
  • ccfcb8dc — wire explicit Window call search and lazy diagnostic inspection, fix stale reads, translations, tests and generated bundles.
  • 1cd4b365 — maintainer documentation, capture limits, validation and deployment distinction.
  • aa660b44 — review fix: enforce the advertised 240-event WebUI display ceiling even when a bounded server page crosses the final boundary, with regression coverage and regenerated Runtime bundle.

Final HEAD aa660b44e2aacd30e7fa9a5c3565deb64886202b.

Metadata evidence without routine full capture

Enabled metadata mode now persists lifecycle events and selected bounded diagnostic summaries in the existing private trace directory. ActionAudit remains the Window/call/time index; there is no second business ledger or raw-payload database.

Capture stages distinguish:

  1. supplied arguments / _wc before envelope parsing, preserving gateway entry versus actual selected target;
  2. business arguments entering the canonical parser after adapter envelope handling (not a claim that parsing or later normalization succeeded);
  3. producer-reported normalization, execution/effect/Job/timing evidence before model compaction;
  4. final response context receipts: instruction source path/scope/fingerprint, body inclusion, returned byte count, truncation/read continuation and exact unavailable reason.

Selected tools cover bootstrap, reading/search, process/script/shell, structured edits/Git, validation and Job observation. Explicit _wc is also observable on other ordinary tools, without capturing their business body. Trace-reader and continuation suppression remains intact. not_observed is no longer dropped by the existing semantic-status telemetry projection.

Each diagnostic is at most 8 KiB, with bounded traversal depth/nodes/items/text. Large scripts, file/patch/text bodies, stdin, stdout/stderr and log tails are omitted without cloning/serializing the entire source just to truncate it. Credential-labelled fields are omitted. Real paths, search selectors, command and argv prefixes are operator data and can contain arbitrary inline secrets; this is not a universal sanitizer. Existing business-audit allowlists are unchanged.

Metadata uses existing bounded asynchronous writes; saturation remains fail-open. Aggregate process-since-start queue/budget/write failure counters are visible, explicitly not per-trace completeness or durable historical counters. Runner request/result/terminal correlation remains downstream of authoritative acceptance, without serializing every Job log update. Capture-off stops new capture but does not delete or prohibit authorized reads of retained data.

Query and read boundaries

Extend the existing admin-only read_tool_trace operator extension rather than adding Direct tools:

  • Omit trace_ref to search retained ActionAudit calls by time, exact Project/tool and optional Window.
  • Supply a trace for bounded lifecycle/diagnostic event pages.
  • Supply payload_index explicitly for one already-retained full payload, with existing digest, private-file and read-size checks.

The shared method is used by MCP and /api/runtime-console/trace; both recheck administrator authority. The Console retains same-origin JSON checks and MCP retains diagnostic protocol admission. A trace or Window ID never grants authority. No Session is created, inferred or recorded by the Console read.

Defaults: 24-hour query range, maximum 31 days, at most 64 results/page and offset <=10,000. The returned effective range is reusable on subsequent pages. Window candidates/counts describe only returned calls; missing Host identity stays null. Query paging reads the live retained index, not a frozen cross-request report. A single observed-time expression and matching partial index own filtering/order, including legacy fallback; a regression proves coarse audit time cannot incorrectly exclude an exact millisecond match.

Trace index reads are bounded to 2 MiB / 4,096 entries, with at most 64 KiB of event entries per page. File reads serialize against append only while copying the bounded snapshot, not during JSON parsing. Missing capture is reported as trace_not_retained with possible not-captured/dropped/expired/evicted causes, not as proof an operation never occurred. Handler handoff is not client receipt or model reading.

The default exact trace response now lists events rather than only payload indexes. The input/output schema changes deliberately reflect query mode and metadata evidence. No App resource URI or Direct inventory change is introduced.

WebUI

The Work/Windows sidebar has an explicit time/Project/tool call search, so no pre-known Window hash is needed. Existing Window call rows can inspect the same trace. Metadata loads only on expansion; cached re-expansion, explicit refresh, paging and separately requested full payloads are supported. No new polling or automatic retry. Superseded/aborted responses cannot clear or append into a newer trace view. The page stops at 240 displayed events and points to the exact reader for further inspection.

Generated Runtime and Admin bundles are included; their larger diff is generated output, not an unrelated manual rewrite.

Validation

Implementation frozen through final validation:

  • cargo test --locked -p webcodex --lib trace passed, then full default Server library: 3,124 passed / 3 ignored / 0 failed (115.16 s test phase). These selections overlap.
  • Includes real MCP direct/gateway/malformed-envelope capture with no payload files, existing full trace regressions, permissions, Console route, selector/query, millisecond-clock, schema size and failure-boundary coverage.
  • Frontend TypeScript check and full runtime Vitest after review: 157 passed across 24 files; five trace UI tests are included, including the 240-event boundary regression.
  • Frontend build and check:dist passed.
  • Rust format, Git whitespace and 21-package workspace dependency-boundary checks passed.
  • Review also validated the exact merge with current main (55b7085a, including fix(desktop): harden Tunnel recovery and macOS signing pipeline #779/fix(runtime): complete Session and AgentTask selector contracts #781): tool-contracts all-features 267 passed, trace-focused Server tests 59 passed, and the full Server library 3,127 passed / 3 ignored / 0 failed.
  • Final branch is clean; the review commit changes only WebUI source/test plus the generated Runtime bundle.

Intermediate failures were resolved without weakening production checks: saved dispatcher syntax, test-module path, old required-trace schema assertion, Bootstrap-vs-ordinary test identity, and an adapter fixture exceeding the unchanged HTTP request limit. A frontend check interrupted by Runner process replacement was confirmed stopped and then rerun.

No full workspace/all-features suite, native Windows/macOS verification, browser E2E, or production full-vs-metadata performance benchmark was run. This PR does not add per-Window full-capture arming, automatic escalation or retroactive reconstruction of omitted data; these remain separate operator-control work.

Operations performed separately from this feature

At the user's request, the already-built xa dogfood Runner 0.4.3 / 6524f55 / dirty=false was deployed through a detached launcher and independent systemd user unit. Only webcodex-runner-xa.service was restarted; its config digest stayed unchanged and the separate xrh Runner retained its PID. The previous binary is retained under ~/.local/state/webcodex/xa-upgrade-6524f559-20260929/previous.

That deployment does not deploy this trace feature. No Server deployment, production trace/ledger edit or merge was performed. xa's Git credential could push only its existing fork; identical reviewed objects were transmitted there, then the authorized GitHub connector fast-forwarded this canonical branch with force=false. No credential configuration or published history was rewritten.

Usage, limitations and examples: docs/agent/tool-request-tracing.md and docs/implementation/bounded-meta-trace-diagnostics.md.

@yyjeqhc yyjeqhc left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed on OE against the complete PR diff and the current main integration. The design keeps ActionAudit as the bounded searchable call index, private trace storage as evidence rather than authority, and read_tool_trace admin-only / protocol-gated. Metadata capture remains bounded and fail-open, raw payload reads stay explicit, trace/Window identifiers grant no authority, and Runtime Console/MCP share the same authorized read path. The Window search correctly preserves missing Host identity instead of inferring it from Project.

One concrete WebUI boundedness defect was fixed in review: the advertised 240-event display ceiling could be exceeded when a size-bounded final page crossed the boundary. Review commit aa660b44 now slices accumulated evidence at the exact ceiling, removes further paging at the bound, adds a regression, and regenerates the Runtime bundle.

Validation: PR-head GitHub CI before the review fix was fully green. After the frontend-only fix, OE frontend full suite is 157/157 across 24 files, typecheck and check:dist pass, Rust trace tests 59/59 and tool-contracts 258/258 pass. The exact conflict-free merge with current main (55b7085a, including #779/#781) was additionally tested: tool-contracts all-features 267/267, trace tests 59/59, and full webcodex --lib 3127 passed / 3 ignored / 0 failed. Current-head CI has all completed core Linux/tooling/contract/Mac-core/Windows-runner/package lanes green; remaining native lanes are still running with no failures. No remaining blocking findings.

@yyjeqhc
yyjeqhc merged commit 1006a48 into main Sep 29, 2026
15 checks passed
@yyjeqhc
yyjeqhc deleted the feat/bounded-meta-trace-diagnostics branch September 29, 2026 07:56
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.

3 participants