The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: keep Ink agent progress monotonic across snapshot hydration
Teknium30be948a0cbb
diff --git a/ui-tui/src/__tests__/agentRoster.test.ts b/ui-tui/src/__tests__/agentRoster.test.tsindex 66ffae6866e..a492a027428 100644--- a/ui-tui/src/__tests__/agentRoster.test.ts+++ b/ui-tui/src/__tests__/agentRoster.test.ts@@ -2,6 +2,27 @@ import { expect, it } from 'vitest'import { $agentSnapshot, applyAgentSnapshot, mergeAgentRoster } from '../app/agentRoster.js'import { shouldPassThroughToGlobalHandler } from '../components/textInput.js'+import type { SubagentProgress } from '../types.js'++it('never rolls event progress back when an older live snapshot arrives', () => {+ const event: SubagentProgress = {+ id: 'child', goal: 'inspect', depth: 0, index: 0, parentId: null,+ notes: [], thinking: [], tools: ['read_file'], taskCount: 1,+ status: 'running', toolCount: 5+ }++ const stale = {+ subagents: [{ subagent_id: event.id, status: 'queued', tool_count: 1 }],+ delegations: []+ }++ for (const status of ['running', 'completed', 'error', 'interrupted'] as const) {+ const latest = { ...event, status }+ const [row] = mergeAgentRoster([latest], stale)+ expect(row?.status).toBe(latest.status)+ expect(row?.toolCount).toBe(latest.toolCount)+ }+})it('lets the agents shortcut leave the composer without stealing redo', () => {const key = { ctrl: true, shift: false, meta: false } as Parameters<typeof shouldPassThroughToGlobalHandler>[1]diff --git a/ui-tui/src/app/agentRoster.ts b/ui-tui/src/app/agentRoster.tsindex 8885168c43a..01711d21905 100644--- a/ui-tui/src/app/agentRoster.ts+++ b/ui-tui/src/app/agentRoster.ts@@ -35,8 +35,9 @@ export function mergeAgentRoster(events: SubagentProgress[], data: SubagentListRdelegationId: s.delegation_id ?? previous?.delegationId,model: s.model ?? previous?.model,startedAt: s.started_at != null ? s.started_at * 1000 : previous?.startedAt,- status: s.status === 'queued' ? 'queued' : 'running',- toolCount: s.tool_count ?? previous?.toolCount ?? 0,+ // Snapshot replies may predate progress/completion events already rendered.+ status: previous && previous.status !== 'queued' ? previous.status : s.status === 'queued' ? 'queued' : 'running',+ toolCount: Math.max(s.tool_count ?? 0, previous?.toolCount ?? 0),tools: previous?.tools.length ? previous.tools : s.current_tool ? [s.current_tool] : []})}