Repository navigation
fix(cli): answer subagent asks in run and keep parallel rejections continuing - #52146
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of change
What does this PR do?
Two edge cases left
opencode runstopping or hanging after #51968. Both were found with an opencode-drive edge-case matrix.1. Parallel permission asks stopped the run (core). When one ask is rejected,
Permission.replyalso rejects every other pending ask in the session, always with a plainDeclinedError. Sorun's reject-with-feedback for the first ask still ended the step for the second:The other pending asks now get the same feedback (
CorrectedError) when the rejection carries a message. They still getDeclinedErrorwhen it doesn't. This also fixes the TUI case where rejecting one ask with feedback while another is pending ended the turn.2. Subagent asks hung the run forever (CLI).
runonly answered permission asks and forms for its own session ID. A subagent runs in a child session, so its ask was never answered and the run waited indefinitely. This predates #51968.runnow also handles asks and forms from descendant sessions. It resolves theparentIDchain once per session and caches it, so unrelated sessions on a shared server (for example the TUI's) are still left alone. Permission replies now use the asking session's ID.How did you verify your code works?
packages/cli:bun typecheck;bun test test/runis 11 pass / 0 fail.packages/core:bun typecheck;bun test test/permission.test.ts test/session-runner.test.tsis 325 pass / 0 fail.--auto, denyrunexits--format json, and a subagent trying the question tool.Checklist