mirror of
https://github.com/stablyai/orca.git
synced 2026-09-28 08:02:43 +00:00
fix(claude): retire leftover foreground rows when the next turn starts
A foreground `task_started` arriving with no turn open has no `result` coming to retire it, so it sat in the strip indefinitely — with no per-row stop, since foreground rows are not stoppable — and refused conversation commands behind an instruction nobody could follow. Settle on turn start as well as on `result`. This is cleanup only: visibility never consults `startsTurn`, so a missed one degrades to today's behaviour and can never switch the feature off. It shortens the row's life to the next turn; the case where no further turn is ever sent is filed separately.
This commit is contained in:
@@ -114,6 +114,25 @@ describe('ClaudeBackgroundTaskTracker', () => {
|
||||
})
|
||||
})
|
||||
|
||||
it('retires a phantom foreground row when the next turn starts', () => {
|
||||
// A foreground `task_started` with no turn open has no `result` coming to
|
||||
// retire it, so it would sit in the strip — with no stop of its own — and
|
||||
// refuse a conversation command. Turn start is the same evidence `result`
|
||||
// is, and settling on it is cleanup only: nothing gates visibility on it.
|
||||
const tracker = new ClaudeBackgroundTaskTracker()
|
||||
tracker.observe(
|
||||
system('task_started', {
|
||||
task_id: 'phantom',
|
||||
task_type: 'local_agent',
|
||||
is_backgrounded: false
|
||||
})
|
||||
)
|
||||
expect(tracker.state?.tasks).toEqual([{ id: 'phantom', kind: 'agent', stoppable: false }])
|
||||
|
||||
tracker.observe({ type: 'user' }, true)
|
||||
expect(tracker.state).toBeNull()
|
||||
})
|
||||
|
||||
it('publishes bounded display details when a running task description changes', () => {
|
||||
const tracker = new ClaudeBackgroundTaskTracker()
|
||||
expect(
|
||||
|
||||
@@ -89,6 +89,15 @@ export class ClaudeBackgroundTaskTracker {
|
||||
}
|
||||
|
||||
observe(message: Record<string, unknown>, startsTurn = false): boolean {
|
||||
// A new turn is the same evidence `result` is: nothing the previous turn
|
||||
// left foreground is still that turn's work. This is CLEANUP ONLY — a row's
|
||||
// visibility never depends on `startsTurn`, which is Orca's own
|
||||
// dispatch-correlation bookkeeping and is false by design for undispatched
|
||||
// turns, so a missed one degrades to the old behaviour and can never hide
|
||||
// live work.
|
||||
if (startsTurn) {
|
||||
this.settleForegroundTasks()
|
||||
}
|
||||
if (message.type === 'result') {
|
||||
this.settleForegroundTasks()
|
||||
} else if (message.type === 'system') {
|
||||
|
||||
Reference in New Issue
Block a user