Skip to content

fix(mcp): keep tool descriptions free of runtime state - #4529

Open
ScriptedAlchemy wants to merge 2 commits into
fix/move-import-syntax-boundariesfrom
fix/static-context-tool-description
Open

ScriptedAlchemy wants to merge 2 commits into
fix/move-import-syntax-boundariesfrom
fix/static-context-tool-description

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Oct 25, 2026 •

Copy link
Copy Markdown
Owner

Merge #4478 first, followed by #4526, #4510, #4524, #4489, #4485, #4527, #4528, #4530, #4531, #4529, #4534, and #4541.

This PR is number 11 of 13, based on #4531. Merge #4534 next.

Use merge commits. After merging a parent PR, change its child's base to master before merging the child. Auto-merge is disabled.

Stacked on #4531.

Refs #4451 (section 2 only).

Problem

The tracedecay_context MCP tool description said "The graph is still warming, and 3 broad context calls are available." It never changed for the life of a session, even after tracedecay_status reported code_index_freshness: current and retrieval_serving: serving. Agents read the stale note and skipped TraceDecay.

Root cause

tools/list patched runtime state into the description. In the daemon, cached_project_node_count always returned None for a project, so every session got the "warming" variant. Hosts also cache tools/list, so even a correct value would have gone stale.

Fix

Tool descriptions are static. I deleted the dynamic description path and everything that existed only to feed it:

  • context_description, context_warming_description, explore_call_budget, get_tool_definitions_with_budget.
  • The node-count and budget parameters of catalog_discovery_tools_list_payload, and cached_project_node_count.
  • The catalog_is_provisional flag on claim_catalog_refresh and its warming-catalog test. The version-skew tools/list_changed refresh stays.

The call budget was advisory text only; nothing enforced it. Live state stays in the per-response freshness: and indexing: lines.

Verification

Before, with the installed beta.92 binary on an isolated daemon, a fresh session's tools/list ended with "The graph is still warming, and 3 broad context calls are available." even after status was current.

After, with the binary built from this branch, the description has no state text. It is identical while freshness is warming and after it is current.

Bazel, run with --disk_cache and CARGO_BAZEL_TIMEOUT=3600:

  • //crates/tracedecay-mcp-catalog/... and //crates/tracedecay-mcp/...: all pass, including the new context_description_carries_no_runtime_state and discovery_advertises_rewrite_with_a_state_free_context_description.
  • //crates/tracedecay:unit_test, filtered to the daemon bootstrap tests by exact path and daemon::tests::handshake::: 21 passed.
  • //crates/tracedecay-cli:core_cli_suite, cli_boundary::: 2 passed.
  • bazel build --config=clippy over the touched crates: clean.

The test-first commit changes the two daemon bootstrap assertions to require a static description. I did not capture a clean red unit-test run. The real-surface run above is the failing-before evidence.

🤖 Generated with Claude Code

Independent canonical validation

At 5168aa6b3be88654fbf8acb7122a6666d11333d4, fresh Bazel execution passed 33 catalog tests and 483 MCP tests, plus affected Rust formatting. Invocation: d57c232b-b530-43c1-82c8-d92bb067e90a. No budgets or host settings changed.

Fresh daemon handshake coverage: 19 passed, 922 filtered, nonzero helper passed; invocation 9f1bab71-f931-4169-8dad-c7674577bb53. The only local change since the catalog/MCP run corrects two stale comments describing the deleted dynamic patching path.

Shipped CLI boundary tests: 2 passed, 205 filtered, exact-count helper passed; invocation 8b69c401-048f-4570-82c5-28c1980f4671. Both exact daemon-bootstrap tests passed (939 filtered), proving catalog discovery while the project writer is blocked; invocation de980baf-e7be-4a2d-9de8-4e1368a561f2. These latter runs include the comment correction; MCP formatting passed again.

Stack integration

Merged parent #4531 (51a435adac93d8e1f7c6eea4ff1a8bbe3b503e88) without conflicts in ea18e44c202fcb1b0bf82156bd9f8fafd65b2502. The own delta remains 16 files, 104 additions and 421 deletions. The focused validation above predates this integration; it is not a claim of fresh combined-tree execution. Diff checks passed; combined-head CI remains pending.

@changeset-bot

changeset-bot Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 3492b08

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@ScriptedAlchemy
ScriptedAlchemy force-pushed the fix/move-import-syntax-boundaries branch from 05f3027 to 770114e Compare October 25, 2026 10:35
@ScriptedAlchemy
ScriptedAlchemy force-pushed the fix/static-context-tool-description branch from bafe3fd to 8dfc5c0 Compare October 25, 2026 10:35
@ScriptedAlchemy
ScriptedAlchemy force-pushed the fix/move-import-syntax-boundaries branch from 770114e to 017328f Compare October 25, 2026 11:27
@ScriptedAlchemy
ScriptedAlchemy force-pushed the fix/static-context-tool-description branch 2 times, most recently from f147012 to 51d151e Compare October 25, 2026 13:27
@ScriptedAlchemy

Copy link
Copy Markdown
Owner Author

The completed-check notification at 90909cd no longer describes the current branch. Exact live head 51d151e78fe53ec1b3d00c0785c96e24198ff3ec has a Linux fleet failure in run 40197720365, job 121187356595.

The uploaded artifact 12603254279 shows only //crates/tracedecay-cli:refresh_memory_journey timing out at its unchanged 300-second target deadline. The helper fixture test passed; repeated_heavy_refreshes_under_the_limit_are_admitted did not reach a terminal libtest result. The other 170 test targets passed.

The last reported state was the fifth generation in bulk_commit, 112/300 files and 448 committed pages. No memory-refusal state was reported there. This does not prove a flake, OOM, or a regression in static tool descriptions. Please coordinate with the existing cold-refresh owner before retriggering or changing this stack. Our code-index owner received the evidence and will not rerun or overwrite your lane. No timeout increase is proposed.

@ScriptedAlchemy
ScriptedAlchemy force-pushed the fix/move-import-syntax-boundaries branch from 8b07ca6 to eea3ca0 Compare October 25, 2026 19:42
@ScriptedAlchemy
ScriptedAlchemy force-pushed the fix/static-context-tool-description branch from 51d151e to c8b0cff Compare October 25, 2026 19:42
@ScriptedAlchemy
ScriptedAlchemy force-pushed the fix/move-import-syntax-boundaries branch from eea3ca0 to 443b1f9 Compare October 25, 2026 20:06
@ScriptedAlchemy
ScriptedAlchemy force-pushed the fix/static-context-tool-description branch from c8b0cff to 9174d4f Compare October 25, 2026 20:06

This branch has not been deployed

No deployments
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