Skip to content

fix: use io.Discard instead of os.Stderr as panic fallback in interp#96

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits intomainfrom
worktree-fix-allowedsymbols
Mar 16, 2026
Merged

fix: use io.Discard instead of os.Stderr as panic fallback in interp#96
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits intomainfrom
worktree-fix-allowedsymbols

Conversation

@julesmcrt
Copy link
Collaborator

@julesmcrt julesmcrt commented Mar 16, 2026

Summary

Test plan

  • TestInterpAllowedSymbols passes (no new allowlist entries needed)
  • TestVerificationInterpCleanPass passes
  • Full allowedsymbols test suite passes

🤖 Generated with Claude Code

PRs #78 and #85 introduced panic recovery in interp/api.go and
interp/runner_exec.go that use runtime/debug.Stack() and os.Stderr,
but those symbols were not added to interpAllowedSymbols, causing
TestInterpAllowedSymbols and TestVerificationInterpCleanPass to fail
on all platforms.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@julesmcrt
Copy link
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@julesmcrt julesmcrt marked this pull request as ready for review March 16, 2026 11:05
@julesmcrt julesmcrt marked this pull request as draft March 16, 2026 11:08
Drop the debug.Stack() call from the panic recovery handlers in
api.go and runner_exec.go — emitting a raw stack trace leaks internal
implementation details and contradicts the sanitization goal of #85.
The panic value alone is sufficient for diagnosis.

This also removes the need to add runtime/debug and runtime/debug.Stack
to the interp allowlist; only os.Stderr remains as a new entry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@julesmcrt julesmcrt marked this pull request as ready for review March 16, 2026 11:13
Copy link
Member

@AlexandreYang AlexandreYang left a comment

Choose a reason for hiding this comment

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

x

When the runner has no stderr configured, the panic recovery handlers
were falling back to os.Stderr, causing rshell to write directly to
the process stderr — undesirable for embedders like datadog-agent.

Replace the fallback with io.Discard so the message is silently
dropped; the caller still receives "internal error" via the returned
error. This also removes the need to add os.Stderr to the interp
allowlist, leaving it unchanged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@julesmcrt
Copy link
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@julesmcrt julesmcrt changed the title fix: add runtime/debug.Stack and os.Stderr to interp allowlist fix: use io.Discard instead of os.Stderr as panic fallback in interp Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants