Skip to content

fix: recover interrupted tool and lsp warmup states#27895

Open
eatFirewood wants to merge 2 commits into
anomalyco:devfrom
eatFirewood:fix/wait-tool-results-before-cleanup
Open

fix: recover interrupted tool and lsp warmup states#27895
eatFirewood wants to merge 2 commits into
anomalyco:devfrom
eatFirewood:fix/wait-tool-results-before-cleanup

Conversation

@eatFirewood
Copy link
Copy Markdown

@eatFirewood eatFirewood commented May 16, 2026

Issue for this PR

Closes #27871

Type of change

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

What does this PR do?

Fixes two ways a session can get stuck after tool/runtime interruption.

First, read now treats LSP warm-up as best-effort. It explicitly carries the current InstanceRef into the forked warm-up effect and logs any warm-up failure instead of letting that background optimization break a successful file read.

Second, session cleanup now waits only for tool calls that reached running. A pending tool part is still incomplete input assembly, so it cannot produce a real tool result and should be marked interrupted during cleanup instead of awaited.

How did you verify your code works?

  • bun test test/tool/read.test.ts
  • bun test test/session/processor-effect.test.ts
  • bun run --cwd packages/opencode typecheck
  • bun run lint -- packages/opencode/src/tool/read.ts packages/opencode/src/session/processor.ts packages/opencode/test/tool/read.test.ts packages/opencode/test/session/processor-effect.test.ts

processor-effect.test.ts needs local port binding and was run outside the sandbox. Lint reports existing warnings in processor.ts, with no new errors.

Screenshots / recordings

Not applicable, no UI change.

Checklist

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

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added needs:issue and removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels May 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@eatFirewood eatFirewood force-pushed the fix/wait-tool-results-before-cleanup branch from 3534458 to 21fe2d1 Compare May 16, 2026 15:53
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.

Empty bash tool arguments {} can still be submitted and interrupt the session

1 participant