Skip to content

perf(runtime): reduce model-facing status and discovery cost - #695

Merged
yyjeqhc merged 4 commits into
mainfrom
feat/model-call-economy
Sep 26, 2026
Merged

yyjeqhc merged 4 commits into
mainfrom
feat/model-call-economy

Conversation

@swjnxyf

@swjnxyf swjnxyf commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • make MCP/model-facing runtime_status sparse by default while preserving canonical/API full diagnostics and explicit compact=false opt-in
  • build sparse runtime status directly instead of constructing full Runner inventories, compatibility rows, connection timestamps, tool names, and diagnostic metadata only to discard them
  • compact repeated Stateless MCP wrapper schemas only on owned tools/list presentation copies; canonical ToolSpecs and ToolRuntime validation remain unchanged
  • move four long-tail Adaptive Runtime tools (list_jobs, stop_job, run_detached_process, transfer_project_artifact) behind the existing tool_manifest + call_runtime_tool gateway
  • preserve exact Job recovery calls, MCP App descriptor-time admission, authority/permission/idempotency semantics, and ordinary pending/passive Job attention
  • add deterministic discovery byte attribution and an audit report at docs/agent/model-call-economy-audit.md

Review fix

  • align exact tool_manifest(tool_name="runtime_status") with MCP's actual omission behavior: its MCP presentation now reports compact default true, using the same projection helper as tools/list, while the canonical/API schema still reports and executes the full default

Runtime status fixture results

Mode Before After Reduction
Fleet full 24,193 B 24,200 B -0.03%
Fleet compact/model 10,742 B 579 B 94.61%
Focused compact/model 2,740 B 665 B 75.73%

The previously observed deployed baseline was 36,811 / 12,220 / 3,522 B; this branch has not been deployed, so those are not presented as post-change production measurements.

MCP compact tools/list

Surface Before After Reduction
anonymous, Apps off 34 / 107,803 B 30 / 82,310 B 23.65%
anonymous, Apps on 51 / 126,894 B 47 / 101,036 B 20.38%
scoped, Apps off 35 / 110,655 B 31 / 84,797 B 23.37%
scoped, Apps on 52 / 129,746 B 48 / 103,523 B 20.21%
admin, Apps off 41 / 122,571 B 37 / 94,821 B 22.64%
admin, Apps on 58 / 141,662 B 54 / 113,547 B 19.85%

Validation

  • cargo test -p webcodex-tool-contracts: 239 passed
  • final cargo test --lib -p webcodex: 2980 passed, 0 failed, 3 ignored
  • cargo check --all-targets --all-features -p webcodex -p webcodex-tool-contracts -p webcodex-runner-registry: passed
  • focused runtime-status MCP default/full/gateway parity: passed
  • pruned-tool exact manifest + canonical gateway validation: passed
  • compact tools/list serialized-size budget: passed
  • canonical-vs-MCP input-schema invariant after review fix: passed
  • cargo fmt --all -- --check: passed
  • git diff --check: passed

Existing warning only: ObservedRunnerRequest.login is unused in the Code Mode test fixture.

@yyjeqhc
yyjeqhc force-pushed the feat/model-call-economy branch from 7a093ff to 1b4c029 Compare September 26, 2026 12:09
@yyjeqhc
yyjeqhc merged commit 28ba625 into main Sep 26, 2026
16 checks passed
@yyjeqhc
yyjeqhc deleted the feat/model-call-economy branch September 26, 2026 12:29
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.

2 participants