Skip to content

fix: preserve mcp tool error display for historic chats - #345

Merged
nirmchan merged 1 commit into
redhat-data-and-ai:mainfrom
Anish701:fix/mcp-tool-error-display
Nov 11, 2026
Merged

nirmchan merged 1 commit into
redhat-data-and-ai:mainfrom
Anish701:fix/mcp-tool-error-display

Conversation

@Anish701

@Anish701 Anish701 commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What

If an MCP tool call failed, the tool would be displayed in red as an error, but if user refreshed the page or went back to that conversation in history, the tool would go back to being showed as success. This is because the "status: error" field was not getting saved in chat history. This PR fixes the bug by saving status: message.status in chat history for MCP tools

Fixes #344

How

  • src/frontend/services/agent-rest.ts: save status: message.status in records of function combineToolCallandResult
  • src/frontend/services/agent-rest.test.ts: test and validate the behavior

Testing

  • Unit tests added/updated
  • Ran locally (npm run dev)
  • Manual verification (describe below if applicable)

Rollback

revert the commit

Checklist

  • PR title follows Conventional Commits (feat:, fix:, ci:, etc.)
  • No secrets, credentials, or PII in the diff
  • No breaking changes (or documented above with a migration path)
  • Lint and tests pass (npm run lint && npm run test)

Signed-off-by: Anish701 <anish2sinha@gmail.com>
@Anish701 Anish701 self-assigned this Nov 10, 2026
@Anish701
Anish701 requested a review from a team as a code owner November 10, 2026 18:11
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review.

Walkthrough

When getThreadState merges a tool result into its matching AI tool call, it now copies the result’s status. The history test checks error, success, and undefined statuses.

Suggested reviewers: atrikghosh

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: Minimal · up to 4bc2d

Historic tool errors retain their status on the inspected path. No merge-blocking issue remains.

Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly identifies the fix for MCP tool error display in historic chats.
Linked Issues check Passed Issue #344 requests preserving MCP tool error display in historic chats. combineToolCallandResult in src/frontend/services/agent-rest.ts now copies the tool result status onto its matching tool …
Out of Scope Changes check Passed The reported implementation and test changes both support issue #344. The available evidence shows no unrelated changes.
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Description check Passed The description explains that the change preserves MCP tool error status in chat history and adds tests for the behavior.
Full details: Linked Issues check

Explanation

Issue #344 requests preserving MCP tool error display in historic chats. combineToolCallandResult in src/frontend/services/agent-rest.ts now copies the tool result status onto its matching tool call. The history test checks error, success, and undefined statuses.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 2 files.

Post-Merge Actions

  • Update changelog

Warning

Some tools did not complete. Review the errors below.

ast-grep (0.51.1)

ast-grep could not parse rule config: /.coderabbit/rules/no-dangerously-set-innerhtml.yml

Linked repositories: Some configured repositories could not be included in this review. Cross-repository analysis may be incomplete. Please check linked-repository access and settings.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 35a380f and 4bc2d1d.

Files selected for processing: 2

  • src/frontend/services/agent-rest.test.ts
  • src/frontend/services/agent-rest.ts
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

@abhiskum

Copy link
Copy Markdown
Contributor

Looks good to me.

@nirmchan nirmchan 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.

LGTM

@nirmchan
nirmchan merged commit 4ac9411 into redhat-data-and-ai:main Nov 11, 2026
14 checks passed
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.

fix: preserve mcp tool error display for historic chats

3 participants