test(runtime): expect the agent's own submit delay, not the generic one

The Antigravity submit-timing case computed its expected wait with
getAgentPromptSubmitDelayMs, which knows only byte ingest. Antigravity
is the one agent with submitLineSettleMsPerLine, so production waits
45 ms longer per input line. The test advanced fake time to the shorter
figure and then awaited the send, so the outstanding settle timer never
fired and the case burned its full 30 s timeout.

Ask the production policy resolver for the delay, and pin the drift with
an assertion that the per-agent delay is the generic delay plus the
agent's configured line settle.
This commit is contained in:
Jinwoo-H
2026-09-20 23:29:08 -04:00
parent 7a6d10064e
commit 88198bfaee
@@ -3,7 +3,8 @@ import {
AGENT_PROMPT_BRACKETED_PASTE_END,
AGENT_PROMPT_BRACKETED_PASTE_START,
buildAgentPromptPasteBytes,
getAgentPromptSubmitDelayMs
getAgentPromptSubmitDelayMs,
resolveAgentPromptSubmitDelayForAgent
} from '../../../shared/agent-prompt-injection'
import { TUI_AGENT_CONFIG } from '../../../shared/tui-agent-config'
import type { TuiAgent } from '../../../shared/tui-agent'
@@ -610,9 +611,18 @@ describe('OrcaRuntimeService', () => {
launchAgent: agent
})
const submitDelayMs = getAgentPromptSubmitDelayMs(
// The submit wait is per agent: a line-settle policy adds to the generic byte-ingest
// delay, so expecting the generic delay here stalls this test for its whole timeout.
const submitDelayMs = resolveAgentPromptSubmitDelayForAgent(
process.platform,
Buffer.byteLength(buildAgentPromptPasteBytes('review this change'), 'utf8')
'review this change',
agent
)
expect(submitDelayMs).toBe(
getAgentPromptSubmitDelayMs(
process.platform,
Buffer.byteLength(buildAgentPromptPasteBytes('review this change'), 'utf8')
) + (TUI_AGENT_CONFIG[agent].submitLineSettleMsPerLine ?? 0)
)
const sendPromise = runtime.sendTerminalAgentPrompt(handle, 'review this change')
if (agent === 'omp') {