[Test Coverage] container-lifecycle.ts retry/timeout/kill branches#4809
Conversation
Add 14 focused Jest unit tests targeting previously-uncovered paths: - startContainers retry failures (api-proxy fails both attempts → specific throw) - startContainers squid retry falls through to handleHealthcheckError - startContainers cli-proxy first-attempt failure (no retry, specific throw) - startContainers cli-proxy failure during retry attempt - startContainers graceful handling of runComposeDown failure before retry - runAgentCommand timeout path (agentTimeoutMinutes, exitCode 124, docker stop called) - runAgentCommand externally-killed short-circuit (isAgentExternallyKilled, skips squid analysis) - fastKillAgentContainer: default/custom stop timeout, silent error handling, marks agent killed All container-startup-diagnostics and squid-log-reader calls are mocked for deterministic, fast tests without Docker or filesystem dependencies. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (2 files)
Coverage comparison generated by |
There was a problem hiding this comment.
Pull request overview
Adds a new Jest unit test suite to increase branch coverage for src/container-lifecycle.ts, focusing on retry behavior in startContainers, timeout/external-kill branches in runAgentCommand, and error-handling/timeout options in fastKillAgentContainer.
Changes:
- Adds targeted tests for
startContainersretry/no-retry failure paths (api-proxy, squid, cli-proxy) including cleanup-before-retry behavior. - Adds timeout and externally-killed branch tests for
runAgentCommand. - Adds tests for
fastKillAgentContainerdefault/custom stop timeouts and error swallowing.
Show a summary per file
| File | Description |
|---|---|
| src/container-lifecycle-retry-timeout.test.ts | New unit tests covering previously-uncovered retry/timeout/external-kill branches in container-lifecycle.ts. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
GitHub API: ✅ PASS Total: PASS
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@copilot fix this failing ci check https://github.com/github/gh-aw-firewall/actions/runs/27435207418/job/81095729513?pr=4809 |
Fixed in |
🔥 Smoke Test Results — Auth mode: PAT (COPILOT_GITHUB_TOKEN)
Overall: PASS PR: [Test Coverage] container-lifecycle.ts retry/timeout/kill branches
|
Smoke Test Results: Copilot BYOK (Direct) Mode ✅Test Summary:
Mode: Running in direct BYOK mode via api-proxy sidecar with real credentials held by proxy. Status: PASS
|
🤖 Copilot Smoke Test Results
Overall: PASS PR: [Test Coverage] container-lifecycle.ts retry/timeout/kill branches · Author:
|
|
Smoke test results: GitHub MCP connectivity: ✅
|
|
Smoke test results:
Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
Chroot Version Comparison
Result: ❌ Not all versions match — Python and Node.js differ between host and chroot environments.
|
|
|
Smoke Test Results
Overall: FAIL —
|
Build Test Suite Results — 8 EcosystemsAll 18 projects completed across 8 ecosystems. All clones succeeded. {
"results": [
{
"ecosystem": "Bun",
"project": "elysia",
"clone_status": "ok",
"build_status": "N/A",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
},
{
"ecosystem": "Bun",
"project": "hono",
"clone_status": "ok",
"build_status": "N/A",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
},
{
"ecosystem": "C++",
"project": "fmt",
"clone_status": "ok",
"build_status": "ok",
"test_status": "N/A",
"tests_passed": null,
"tests_total": null,
"error": null
},
{
"ecosystem": "C++",
"project": "json",
"clone_status": "ok",
"build_status": "ok",
"test_status": "N/A",
"tests_passed": null,
"tests_total": null,
"error": null
},
{
"ecosystem": "Deno",
"project": "oak",
"clone_status": "ok",
"build_status": "N/A",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
},
{
"ecosystem": "Deno",
"project": "std",
"clone_status": "ok",
"build_status": "N/A",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
},
{
"ecosystem": ".NET",
"project": "hello-world",
"clone_status": "ok",
"build_status": "ok",
"test_status": "N/A",
"tests_passed": null,
"tests_total": null,
"error": null
},
{
"ecosystem": ".NET",
"project": "json-parse",
"clone_status": "ok",
"build_status": "ok",
"test_status": "N/A",
"tests_passed": null,
"tests_total": null,
"error": null
},
{
"ecosystem": "Go",
"project": "color",
"clone_status": "ok",
"build_status": "N/A",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
},
{
"ecosystem": "Go",
"project": "env",
"clone_status": "ok",
"build_status": "N/A",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
},
{
"ecosystem": "Go",
"project": "uuid",
"clone_status": "ok",
"build_status": "N/A",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
},
{
"ecosystem": "Java",
"project": "gson",
"clone_status": "ok",
"build_status": "ok",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
},
{
"ecosystem": "Java",
"project": "caffeine",
"clone_status": "ok",
"build_status": "ok",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
},
{
"ecosystem": "Node.js",
"project": "clsx",
"clone_status": "ok",
"build_status": "N/A",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
},
{
"ecosystem": "Node.js",
"project": "execa",
"clone_status": "ok",
"build_status": "N/A",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
},
{
"ecosystem": "Node.js",
"project": "p-limit",
"clone_status": "ok",
"build_status": "N/A",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
},
{
"ecosystem": "Rust",
"project": "fd",
"clone_status": "ok",
"build_status": "ok",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
},
{
"ecosystem": "Rust",
"project": "zoxide",
"clone_status": "ok",
"build_status": "ok",
"test_status": "ok",
"tests_passed": 1,
"tests_total": 1,
"error": null
}
],
"clone_failures": [],
"all_clones_failed": false
}Notes
|
Adds 14 focused Jest unit tests covering previously-uncovered branches in
src/container-lifecycle.ts.What's covered
startContainersretry failure paths"awf-api-proxy failed to start on both attempts"error and thatlogContainerLogsToStderris called twicehandleHealthcheckError(squid failure on retry logs but doesn't throw directly)"awf-cli-proxy could not connect"message and that compose-up is only called oncerunComposeDownthrows before retry — the cleanup failure is swallowed and the retry still proceedsrunAgentCommandtimeout pathagentTimeoutMinutes— fake timers advance past the timeout; assertsexitCode = 124anddocker stop -t 10calleddocker stopis NOT calledrunAgentCommandexternally-killed pathisAgentExternallyKilled()short-circuit — squid-log analysis is skipped,blockedDomainsis empty0 || 143 === 143branchfastKillAgentContainerApproach
container-startup-diagnosticsandsquid-log-readerare Jest-mocked so tests have full control overdidContainerFailStartup/handleHealthcheckErrorreturn values without relying on internal message-parsing heuristics. Fake timers (jest.useFakeTimers) are used for the timeout tests.