Repository navigation
fix(runtime): report an open agent question as blocked to tui-idle waits #24533
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,8 @@ type HookTurnState = 'done' | 'working' | 'permission' | |
|
|
||
| /** | ||
| * The main agent's turn as the hook server's store last saw it for one pane, and the permission | ||
| * arbiter's verdict on the pane's blocked text with that turn as its explicit status. | ||
| * arbiter's verdict on the pane's blocked text with that turn as its explicit status (or, for a | ||
| * wait the hook reports with no text the arbiter knows, a generic interactive prompt). | ||
| */ | ||
| export type TuiIdleHookTurn = { | ||
| state: HookTurnState | ||
|
|
@@ -65,10 +66,19 @@ export function readTuiIdleHookTurn(read: TuiIdleHookTurnRead): TuiIdleHookTurn | |
| return null | ||
| } | ||
| const state = hookLeadTurnState(row) | ||
| if (state === null || (state === 'done' && row.receivedAt < (read.lastInputAt ?? -1))) { | ||
| const predatesInput = row.receivedAt < (read.lastInputAt ?? -1) | ||
| if (state === null || (state === 'done' && predatesInput)) { | ||
| return null | ||
| } | ||
| return { state, blockedReason: read.resolveBlockedText(state, row) } | ||
| const blockedReason = read.resolveBlockedText(state, row) | ||
| // Why the hook alone blocks: a question or custom modal paints no dialog text the arbiter knows, | ||
| // and these hooks report its answer. Input since may have answered it before the hook arrived. | ||
| return { | ||
| state, | ||
| blockedReason: | ||
| blockedReason ?? | ||
| (state === 'permission' && !predatesInput ? 'agent-interactive-prompt' : null) | ||
|
Comment on lines
+78
to
+80
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } | ||
| } | ||
|
|
||
| /** The tui-idle verdicts the hook lane can reach (a subset of `TuiIdleVerdict`). */ | ||
|
|
@@ -104,7 +114,7 @@ export function evaluateHookTurn( | |
| case 'working': | ||
| return { kind: 'working' } | ||
| case 'permission': | ||
| // Why pending: the arbiter saw no prompt in the tail, so the poll's screen read decides. | ||
| // Why pending: input after the wait opened may have answered it; the next hook decides. | ||
| return { kind: 'pending', quietForeground: 'closed' } | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: stablyai/orca
Length of output: 14230
Compare input with the wait start time.
receivedAtrecords delivery time, not when the permission wait began. If a permission row hasstateStartedAt < lastInputAt < receivedAt, the current check treats the row as fresh and can returnagent-interactive-prompteven though the input answered a wait that started earlier.🐛 Suggested fix
📝 Committable suggestion