Files
callstack__agent-device/scripts/lib/runner-timeout-meta.ts
devin-ai-integration[bot] 885c1486bb test(ci): single-retry policy for enumerated contention-flaky files (timeouts only) (#1448)
* test(ci): single-retry policy for enumerated contention-flaky files

* fix: satisfy fallow

* test(ci): read failures through a lane reporter so timeouts stay distinguishable

* test(ci): cover the lane reporter and drop its duplicated boilerplate

* chore(fallow): own the retry lane's tool-loaded export seams

* test(ci): block retries on non-test failures and classify timeouts structurally

* test(ci): decide retry eligibility from runner metadata and route gate verdicts through blockers

* refactor(ci): name the retry policy's rules in code instead of comments

* test(ci): mark runner-aborted timeouts inside the runner instead of inferring them

* test(ci): make timeout provenance a per-run secret, not a writable flag

Cover direct task.meta mutation in the real child-Vitest fixture gate.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(ci): retry the failed files in the first run's project and coverage modes

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* fix: drop deleted repo-health file from the retry list after #1480

Rebase onto main post-#1480: the SkillGym/repo-health descope deleted
scripts/repo-health/run.test.ts, whose CONTENTION_RETRY_FILES entry
would now fail this PR's own missing-file check, and inlined the
slow-test budgets into the reporter, resolving the budgets-module
import. Envelope comments now point at scripts/lib/lane-envelope.ts
instead of the closed #1430.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FUv7bvbWNryuXgSBuqTtep

---------

Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
2026-07-29 12:53:33 +02:00

25 lines
1.1 KiB
TypeScript

// The provenance mark the runner-timeout setup file writes on a test, and the
// contention retry lane (#1419) reads back through `TestCase.meta()`.
//
// `task.meta` is writable by test code, so the mark is not a boolean but a
// per-run secret the lane generates. Setup files are imported before any test
// module, and the setup file takes the secret out of the environment as it
// loads, so no test body can read the value it would have to forge.
export const RUNNER_TIMEOUT_META = 'agentDeviceRunnerTimeout';
export const RUNNER_TIMEOUT_TOKEN_ENV = 'CONTENTION_RETRY_TIMEOUT_TOKEN';
/** Reads the run's secret and removes it from `env`, leaving nothing for a test to find. */
export function takeRunnerTimeoutToken(env: NodeJS.ProcessEnv): string | undefined {
const token = env[RUNNER_TIMEOUT_TOKEN_ENV];
delete env[RUNNER_TIMEOUT_TOKEN_ENV];
return token;
}
/** True when the runner itself aborted the test with its own timeout error. */
export function runnerTimedOut(meta: unknown, token: string | undefined): boolean {
if (!token) return false;
return (meta as Record<string, unknown> | undefined)?.[RUNNER_TIMEOUT_META] === token;
}