Skip to content

fix(core): bound session shell output in model-facing messages - #52198

Closed
lab1207 wants to merge 1 commit into
anomalyco:devfrom
lab1207:shell-output-cap
Closed

lab1207 wants to merge 1 commit into
anomalyco:devfrom
lab1207:shell-output-cap

Conversation

@lab1207

@lab1207 lab1207 commented Sep 30, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #45099

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Session shell messages were interpolated into the provider request with no bound, so one large shell output could blow past context, fail as provider.unknown, and strand the session.

On current master the capture-side names from the issue are gone (tool-output-store.ts now, V2 shell op unimplemented), so the live defect is this interpolation site. The fix caps the model-facing preview at the existing 50 KiB tool-output limit (ToolOutputStore.MAX_BYTES). Full output stays untouched in session history.

How did you verify your code works?

  • New regression test with a 1 MiB shell output asserts a bounded preview plus marker: bun test test/session-runner-message.test.ts (packages/core), 7 pass
  • bun typecheck (packages/core) clean
  • oxlint: 0 errors, 2 warnings also present on the unmodified baseline

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Session shell messages reached the provider request verbatim, stranding sessions on context overflow. The model now receives a 50 KiB bounded preview matching the tool-output limit; full output stays in session history.
@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

@lab1207

lab1207 commented Oct 11, 2026

Copy link
Copy Markdown
Author

Ported to V2 as #54415 — the V2 runner embeds shell output at a different call site (to-llm-message.ts) with no bound, so the same fix applies there against ToolOutput.MAX_BYTES, with the regression test extended into the existing message suite. Thanks for pointing at the V2 branch.

lab1207 added a commit to lab1207/opencode that referenced this pull request Oct 11, 2026
Unbounded shell output reaches the provider request verbatim through history replay and can strand the session on context overflow. Bound the preview to ToolOutput.MAX_BYTES; the full output stays in session history. Ports anomalyco#52198 to the V2 runner, which embeds output at a different call site.
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.

core: session shell output bypasses tool limits and strands sessions

2 participants