mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
fix(orchestration): wake idle Hermes workers after a runtime restart (#37732)
* fix(orchestration): wake reattached Hermes terminal workers Record the provider-proven terminal grid on the headless attach path before restoring the screen. Without it, trusted-screen readiness rejected idle Hermes workers after a runtime restart and stranded both send and reply mail. Reuse the spawn geometry policy without resizing the surviving PTY. Cover status and question-reply wakes plus busy and draft composer holds. * fix(orchestration): retain Hermes activity across native titles Hermes writes a status marker followed by an arbitrary session name and model. These titles can lack a recognized agent-name token, clearing live activity after the mailbox pointer is typed and leaving its Enter deferred. Classify native markers only for an already identified Hermes terminal. Reproduce the exact OSC 1/2 titles during both status and reply delivery, retain busy/draft holds, and update the existing partial attach fixture. * refactor(pty): keep runtime attach seeding under the line cap The rebased attach path pushed operations.ts over the 300-line oxlint cap. Move the size commit and headless seed into their own module so the wake behavior stays and the file fits. * fix(orchestration): retarget Hermes title imports after the agent-status move Upstream moved agent-title-core and terminal-agent. The rebased title helper still imported the old paths, so typecheck could not resolve them. * fix(pty): keep a resize that lands during runtime attach Attach waits on the daemon before committing snapshot geometry. A resize in that window already published the live grid, so the later snapshot commit must not write it back. * fix(pty): detect an attach-time resize by cache identity A resize that returns to the pre-attach dimensions still publishes a new cache entry. Comparing only cols and rows let the snapshot commit overwrite that live grid. * test(pty): assert attach reflow and Hermes idle status in existing cases Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * refactor(orchestration): keep the Hermes title rule with the other title providers * fix(pty): give a resize that landed during attach a readable mirror Reflowing the seeded snapshot marked the grid unrepainted, so the screen rules kept refusing it after the TUI repainted for the resize. * fix(orchestration): write the Hermes title markers as escapes for the ASCII server bundle * test(pty): retarget Hermes attach test imports after the orchestration module moves * fix(orchestration): restore a reattached agent's idle status from its trusted ready screen A screen-ruled agent idle before a runtime restart may write no title after reattach (Hermes repaints its title only on a state change) and has no restored hook report, so it stayed without live status and mail was never offered. When no report restores it, the agent's own strong ready rule on the trusted, correctly sized grid now gives it a live idle status; busy, draft and unknown screens still give nothing. Quiet-gated rules and a grid not yet readable get one recheck. The attach test no longer injects a fresh title after attach. * fix(orchestration): keep rechecking a reattached ready screen until it settles One recheck could land inside a redraw's quiet window or before the grid became readable, leaving a quiet-gated agent without live status. Recheck within a bounded window instead, and cover a Cline redraw after attach. * fix(agent-state): read agy's idle composer with background task rows as ready agy 1.4 lists running background tasks between the composer and the hint row, so composer_ready never matched and a reattached agy with a task running held its mail until the task ended. A sibling rule allows up to six task rows; the hint row still decides, so mid-turn, draft and picker screens hold. --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
This commit is contained in:
co-authored by
Claude Sonnet 5.5
Jinwoo-H
parent
9b9363f4fb
commit
b4aa8a1be6
@@ -0,0 +1,17 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { hermesNativeTitleStatus } from './hermes-terminal-title'
|
||||
|
||||
describe('Hermes native session title markers', () => {
|
||||
it.each([
|
||||
['hermes', '✓ Run Orca dispatched worker … · grok-4.7 · ~/workspace', 'idle'],
|
||||
['hermes', '⏳ Ready to deploy', 'working'],
|
||||
['hermes', '⚠ Finished the changes', 'permission'],
|
||||
['hermes', '⚠️ Waiting for approval', 'permission'],
|
||||
['hermes', 'user@host: ~/workspace', null],
|
||||
['hermes', '✓not a status marker', null],
|
||||
['codex', '✓ Run Orca dispatched worker …', null],
|
||||
[null, '✓ Run Orca dispatched worker …', null]
|
||||
] as const)('classifies %s title %s as %s', (agent, title, expected) => {
|
||||
expect(hermesNativeTitleStatus(title, agent)).toBe(expected)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,21 @@
|
||||
import type { AgentStatus } from '../agent-title-core'
|
||||
import type { TerminalAgent } from '../../identity/terminal-agent'
|
||||
|
||||
// Hermes TUI titles lead with ⚠ (approval or question), ⏳ (busy) or ✓ (idle), then the session name.
|
||||
const HERMES_TITLE_MARKER_STATUS: Record<string, AgentStatus> = {
|
||||
'\u2713': 'idle',
|
||||
'\u23F3': 'working',
|
||||
'\u26A0': 'permission'
|
||||
}
|
||||
|
||||
/** The markers are too generic to identify Hermes, so they count only in a Hermes pane. */
|
||||
export function hermesNativeTitleStatus(
|
||||
title: string,
|
||||
agent: TerminalAgent | null
|
||||
): AgentStatus | null {
|
||||
if (agent !== 'hermes') {
|
||||
return null
|
||||
}
|
||||
const marker = title.match(/^(\u2713|\u23F3|\u26A0)\uFE0F?(?:\s|$)/u)?.[1]
|
||||
return marker ? HERMES_TITLE_MARKER_STATUS[marker] : null
|
||||
}
|
||||
Reference in New Issue
Block a user