mirror of
https://github.com/stablyai/orca.git
synced 2026-11-17 03:15:01 +00:00
test(e2e): wait for the shell-ready deadline after a startup exec (#39203)
* test(e2e): wait for the shell-ready deadline after a startup exec Since #30978 the terminal host no longer probes for a prompt when a profile exec drops Orca's ready marker; it submits the startup command once at the 15 s shell-ready deadline. The oracle allowed only 8 s, so the headless serve case failed unless the exec barrier happened to run long. Wait until that deadline (measured from terminal creation) plus the recovery budget, and route the spec from the shell-ready barrier and shell startup sources. * ci(e2e): route the startup-exec oracle helper to its spec
This commit is contained in:
@@ -175,6 +175,23 @@ describe('runtime host status E2E routing', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('startup exec readiness E2E routing', () => {
|
||||
const spec = 'tests/e2e/paired-startup-exec-readiness.spec.ts'
|
||||
it.each([
|
||||
'src/main/daemon/sessions/session-shell-ready-barrier.ts',
|
||||
'src/main/daemon/shell-readiness/post-ready-flush-gate.ts',
|
||||
'src/main/pty/shell-startup/shell-templates.ts',
|
||||
'tests/e2e/helpers/startup-exec-readiness-oracle.ts'
|
||||
])('routes %s', (path) => {
|
||||
expect(selectPrE2eSpecs([path])).toContain(spec)
|
||||
})
|
||||
it('does not route unit tests of those sources', () => {
|
||||
expect(
|
||||
selectPrE2eSpecs(['src/main/daemon/shell-readiness/testing/shell-ready.test.ts'])
|
||||
).not.toContain(spec)
|
||||
})
|
||||
})
|
||||
|
||||
describe('agent descendant kill E2E routing', () => {
|
||||
const spec = 'tests/e2e/agent-descendant-process-kill.spec.ts'
|
||||
it.each([
|
||||
|
||||
@@ -155,5 +155,17 @@ export const PR_FEATURE_AREA_E2E_SOURCE_ROUTES = [
|
||||
'src/shared/remote-runtime/host-store/runtime-environment-store.ts',
|
||||
`${COMPONENTS}sidebar/workspace-card/identity/worktree-card-header-items.tsx`
|
||||
]
|
||||
),
|
||||
featureRoute(
|
||||
'feature.startup-exec-readiness',
|
||||
['paired-startup-exec-readiness'],
|
||||
[
|
||||
'src/main/daemon/sessions/session-shell-ready-barrier.ts',
|
||||
'src/main/daemon/shell-readiness/',
|
||||
'src/main/pty/shell-startup/shell-prompt-readiness-probe.ts',
|
||||
'src/main/pty/shell-startup/shell-startup-output-scanner.ts',
|
||||
'src/main/pty/shell-startup/shell-templates.ts',
|
||||
'tests/e2e/helpers/startup-exec-readiness-oracle.ts'
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -13,8 +13,11 @@ import { readFreshTerminalInventory } from './terminal-inventory-observation'
|
||||
import { quotePosixShell } from '../../../src/shared/shell/launch/shell-argument-quoting'
|
||||
|
||||
const RECOVERY_DEADLINE_MS = 8_000
|
||||
// The host's shell-ready deadline (SHELL_READY_TIMEOUT_MS): a profile exec drops the ready marker, so the command waits for it.
|
||||
const SHELL_READY_DEADLINE_MS = 15_000
|
||||
|
||||
export type StartupExecTerminal = {
|
||||
createdAtMs: number
|
||||
hostPtyId: string
|
||||
panePtyId: string
|
||||
parentTabId: string
|
||||
@@ -150,6 +153,7 @@ export async function createStartupExecTerminal(
|
||||
`printf '%s|%s\\n' "$$" "$(tty)" > ${quotePosixShell(ledgerPath)}`,
|
||||
markerCommand(startupMarker)
|
||||
].join('; ')
|
||||
const createdAtMs = Date.now()
|
||||
const created = await callStartupExecRuntime<{
|
||||
tab: { parentTabId: string; terminal: string | null }
|
||||
}>(page, 'session.tabs.createTerminal', {
|
||||
@@ -191,6 +195,7 @@ export async function createStartupExecTerminal(
|
||||
shown.terminal.ptyId
|
||||
)
|
||||
return {
|
||||
createdAtMs,
|
||||
hostPtyId: shown.terminal.ptyId,
|
||||
panePtyId,
|
||||
parentTabId: created.tab.parentTabId,
|
||||
@@ -214,8 +219,14 @@ export async function expectStartupExecRecovery(
|
||||
created: StartupExecTerminal,
|
||||
runId: string
|
||||
): Promise<void> {
|
||||
const shellReadyDeadlineRemainingMs = Math.max(
|
||||
0,
|
||||
created.createdAtMs + SHELL_READY_DEADLINE_MS - Date.now()
|
||||
)
|
||||
await expect
|
||||
.poll(() => readTerminal(page, created.terminal), { timeout: RECOVERY_DEADLINE_MS })
|
||||
.poll(() => readTerminal(page, created.terminal), {
|
||||
timeout: shellReadyDeadlineRemainingMs + RECOVERY_DEADLINE_MS
|
||||
})
|
||||
.toMatchObject({
|
||||
tail: expect.arrayContaining([expect.stringContaining(created.startupMarker)])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user