Skip to content

fix(daemon): carry projectless refusals as structured content - #2345

Merged
ScriptedAlchemy merged 1 commit into
masterfrom
fleet/projectless-problem-shape
Sep 27, 2026
Merged

ScriptedAlchemy merged 1 commit into
masterfrom
fleet/projectless-problem-shape

Conversation

@ScriptedAlchemy

Copy link
Copy Markdown
Owner

This fixes the #2335 follow-up. A refusal answered on the daemon's projectless route (for example tracedecay serve outside a project, or tracedecay_project_list through the profile owner) put the typed problem record beside content, at the top level of the tools/call result. CallToolResult has no extension members, so MCP clients received that refusal only as prose. Project connections already move the record into structuredContent, in the rmcp call_tool adapter.

There is now one renderer, tracedecay_mcp::tool_errors::structure_tool_problem. The rmcp call_tool adapter and the projectless tools/call response both call it, so every host-facing tools/call refusal has the same isError shape: {content, isError: true, structuredContent: {problem}}. The inline copy of the move in rmcp.rs is deleted.

Fail-before / pass-after

Test: daemon::tests::socket::projectless_project_list_reads_the_empty_profile_registry, a real projectless socket connection. It now asserts the refusal record under structuredContent.problem and asserts that result.problem is absent.

On origin/master source (b836d91) with only this test changed:

panicked at crates/tracedecay/src/daemon/tests/socket.rs:813:5:
  left: (Number(9), Bool(true), Some(Object {"cancellation_stage": Null, "code": String("application.surface.invalid_request"), ...
 right: (Number(9), Bool(true), None, String("invalid_request"), String("application.surface.invalid_request"), String("invalid arguments for tracedecay_project_list: unknown field `limt`, expected `limit`"))
test result: FAILED. 0 passed; 1 failed

With this change: ok.

Runtime journey

Setup: debug tracedecay built from this branch, isolated HOME/profile, one daemon under systemd-run --user --scope -p MemoryMax=6G -p MemorySwapMax=1G, stopped afterwards.

tracedecay serve (cwd outside any project):
tools/list: 230 tools
tracedecay_project_list {"limt": 5}: isError=True 3ms
     structuredContent.problem.code="application.surface.invalid_request" top-level problem.code=null keys=['content', 'isError', 'structuredContent']
tracedecay_project_list {"format": "json", "limit": 1}: isError=None 8ms

Before this change, the same call answered keys=['content', 'isError', 'problem'] with structuredContent absent. That was observed on b836d91 with the same driver.

Checks

  • tracedecay-mcp lib: 387 passed.
  • Root --lib -- daemon:: mcp::: 735 passed, 2 failed, neither in the code this PR touches:
  • cargo clippy -p tracedecay -p tracedecay-mcp --all-targets -D warnings, with and without tracedecay/test-transport,test-helpers: clean. cargo fmt --all -- --check: clean.

@changeset-bot

changeset-bot Bot commented Sep 27, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: f1059c5

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

@ScriptedAlchemy
ScriptedAlchemy merged commit acceceb into master Sep 27, 2026
1 check passed
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-27T17:04:40.388599Z f1059c5 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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