Skip to content

fix: handle nil writer in bash MCP tool #18978

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

ThomasK33
Copy link
Member

@ThomasK33 ThomasK33 commented Jul 21, 2025

  • Refactors the bash tool to use io.Discard instead of nil to avoid panics.

  • Enhances panic recovery in codersdk/toolsdk/toolsdk.go by adding stack trace information in development builds. When a panic occurs in a tool handler:

    • In development builds: The error includes the full stack trace for easier debugging
    • In production builds: A simpler error message is shown without the stack trace

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ThomasK33 ThomasK33 requested a review from johnstcn July 21, 2025 21:11
@ThomasK33 ThomasK33 marked this pull request as ready for review July 21, 2025 21:11
Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

Nice find!

Could you add a test that replicates the panic you saw?
Otherwise LGTM.

Change-Id: I12e96df671e52eb9e2ae85127ac1aa40f5671e52
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33 ThomasK33 force-pushed the thomask33/fix_correct_agent_selection_logic_and_handle_nil_timestamps branch from bbdf0cc to 7141db8 Compare July 22, 2025 15:06
@ThomasK33 ThomasK33 changed the title fix: correct agent selection logic and handle nil timestamps fix: handle writer in bash MCP tool Jul 22, 2025
@ThomasK33 ThomasK33 changed the title fix: handle writer in bash MCP tool fix: handle nil writer in bash MCP tool Jul 22, 2025
@ThomasK33 ThomasK33 merged commit c6efe64 into main Jul 22, 2025
38 checks passed
@ThomasK33 ThomasK33 deleted the thomask33/fix_correct_agent_selection_logic_and_handle_nil_timestamps branch July 22, 2025 16:03
@github-actions github-actions bot locked and limited conversation to collaborators Jul 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy