Skip to content

[Test Coverage] container-lifecycle missing branch coverage#5743

Merged
lpcox merged 2 commits into
mainfrom
test-coverage/container-lifecycle-missing-branches-127fca4fd6437ebb
Jul 1, 2026
Merged

[Test Coverage] container-lifecycle missing branch coverage#5743
lpcox merged 2 commits into
mainfrom
test-coverage/container-lifecycle-missing-branches-127fca4fd6437ebb

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Adds 9 new Jest tests in src/container-lifecycle-missing-branches.test.ts targeting branches in container-lifecycle.ts that were not exercised by the existing container-start.test.ts and run-agent-command.test.ts suites.

What's covered

Branch Location Description
Custom stop timeout fastKillAgentContainer Verifies the timeout argument is forwarded to docker stop -t and the hard-deadline is (N+5)*1000 ms
Docker stop error swallowed fastKillAgentContainer Confirms best-effort semantics: a rejected docker stop does not propagate
exitCode || 143 normalisation runAgentCommand Externally-killed agent whose docker wait returns 0 must exit with 143, not 0
Compose-down cleanup throws before retry startContainers The catch (cleanupError) block is hit when runComposeDown rejects; retry still proceeds
CLI-proxy failure during retry startContainers After an api-proxy/squid first-attempt failure triggers the one-shot retry, a cli-proxy failure on retry surfaces the specific fail-fast error rather than falling through to Squid diagnostics

Test results

PASS src/container-lifecycle-missing-branches.test.ts
  fastKillAgentContainer – stop timeout
    ✓ passes the default 3-second grace period to docker stop
    ✓ passes a custom stop timeout to docker stop
    ✓ encodes the hard deadline as (stopTimeoutSeconds + 5) * 1000 ms
  fastKillAgentContainer – docker stop failure is swallowed
    ✓ resolves without throwing when docker stop rejects
    ✓ still marks the agent as externally killed even if docker stop fails
  runAgentCommand – externally killed, docker wait returns 0
    ✓ normalises exit code to 143 when the killed container exits with 0
  startContainers – retry cleanup failure is handled gracefully
    ✓ proceeds with retry even when compose-down cleanup throws
  startContainers – cli-proxy fails during the one-shot retry
    ✓ throws the specific cli-proxy error when cli-proxy fails on retry
    ✓ does not retry a second time after the cli-proxy retry failure

Tests: 9 passed, 9 total

Generated by Test Coverage Improver · 105.5 AIC · ⊞ 5.9K ·

Cover uncovered branches in container-lifecycle.ts:

- fastKillAgentContainer: custom stop timeout propagated to docker stop
- fastKillAgentContainer: docker stop errors are swallowed (best-effort)
- runAgentCommand: externally-killed agent with docker wait returning 0
  exercises the `exitCode || 143` normalisation branch
- startContainers: compose-down cleanup throws before retry; catch block
  swallows the error and proceeds with the retry successfully
- startContainers: cli-proxy fails during the one-shot retry (triggered by
  an api-proxy/squid first-attempt failure); the specific cli-proxy error
  message is surfaced rather than falling through to Squid diagnostics

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox lpcox marked this pull request as ready for review July 1, 2026 18:28
Copilot AI review requested due to automatic review settings July 1, 2026 18:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new Jest test suite to exercise previously uncovered branches in src/container-lifecycle.ts, specifically around retry/cleanup behavior, externally-killed agent exit-code normalization, and docker stop timeout propagation.

Changes:

  • Added 9 branch-coverage tests for fastKillAgentContainer, runAgentCommand, and startContainers.
  • Validates stop-timeout forwarding and hard-deadline computation for docker stop -t.
  • Adds retry-path tests for compose-down cleanup failures and cli-proxy failure surfacing.
Show a summary per file
File Description
src/container-lifecycle-missing-branches.test.ts New Jest tests targeting uncovered branches in container-lifecycle.ts retry/cleanup and externally-killed behavior.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Low

Comment thread src/container-lifecycle-missing-branches.test.ts
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

✅ Copilot review passed with no inline comments.

@github-actions[bot] Add the ready-for-aw label to this PR to trigger agentic CI smoke tests.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Chroot tests passed! Smoke Chroot - All security and functionality tests succeeded.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

🔑 Smoke Copilot PAT PAT auth validated. All systems operational. ✅

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Contribution Check completed successfully!

Contribution check complete for PR #5743: the PR follows the applicable CONTRIBUTING.md guidelines, so no comment is needed.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Gemini completed. All facets verified. 💎

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Claude passed

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

📡 Smoke OTel Tracing completed. All tracing scenarios validated. ✅

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

📰 VERDICT: Smoke Copilot has concluded. All systems operational. This is a developing story. 🎤

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Build Test Suite completed successfully!

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Copilot BYOK AOAI (Entra) completed. Copilot AOAI BYOK (Entra) mode operational. 🔓

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Copilot BYOK completed. Copilot BYOK mode operational. 🔓

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

✨ The prophecy is fulfilled... Smoke Codex has completed its mystical journey. The stars align. 🌟

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Copilot BYOK AOAI (api-key) completed. Copilot AOAI BYOK (api-key) mode operational. 🔓

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

🔌 Smoke Services — All services reachable! ✅

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

🚀 Security Guard has started processing this pull request

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Coverage Regression Detected

This PR decreases test coverage. Please add tests to maintain coverage levels.

Overall Coverage

Metric Base PR Delta
Lines 98.65% 98.68% 📈 +0.03%
Statements 98.53% 98.57% 📈 +0.04%
Functions 99.55% 99.55% ➡️ +0.00%
Branches 94.48% 94.46% 📉 -0.02%
📁 Per-file Coverage Changes (2 files)
File Lines (Before → After) Statements (Before → After)
src/compose-generator.ts 99.0% → 99.1% (+0.03%) 97.2% → 97.3% (+0.08%)
src/workdir-setup.ts 92.7% → 94.5% (+1.82%) 92.7% → 94.5% (+1.82%)

Coverage comparison generated by scripts/ci/compare-coverage.ts

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Test: Claude Engine Validation

Check Result
API status ✅ PASS
gh check ✅ PASS
File status ✅ PASS

Overall result: PASS

Generated by Smoke Claude for #5743 · 52.3 AIC · ⊞ 3.3K ·
Add label ready-for-aw to run again

@github-actions github-actions Bot mentioned this pull request Jul 1, 2026
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

🔥 Smoke Test Results

Test Result
GitHub MCP connectivity
GitHub.com HTTP connectivity ✅ 200
File write/read ⚠️ pre-step data unavailable

PR: [Test Coverage] container-lifecycle missing branch coverage
Author: @github-actions[bot] · No assignees

Overall: PASS

📰 BREAKING: Report filed by Smoke Copilot
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

🔬 Smoke Test: Copilot PAT Auth — PASS

Test Result
GitHub MCP connectivity
GitHub.com HTTP ✅ 200
File write/read

Overall: PASS · Auth mode: PAT (COPILOT_GITHUB_TOKEN)

PR by @github-actions[bot]

🔑 PAT report filed by Smoke Copilot PAT
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

🔍 Smoke Test: API Proxy OpenTelemetry Tracing

Scenario Status Details
1. Module Loading otel.js loads successfully; exports startRequestSpan, setTokenAttributes, setBudgetAttributes, endSpan, endSpanError, shutdown, isEnabled + internal test helpers. isEnabled() returns true (file-fallback mode).
2. Test Suite 59 tests passed, 0 failed across 2 suites (otel.test.js, otel-fanout.test.js). Covers span creation, token attributes (GenAI conventions), error status, serialization, and exporter variants.
3. Env Var Forwarding src/services/api-proxy-env-config.ts forwards all required vars: GH_AW_OTLP_ENDPOINTS, OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, GITHUB_AW_OTEL_TRACE_ID, GITHUB_AW_OTEL_PARENT_SPAN_ID, OTEL_SERVICE_NAME.
4. Token Tracker Integration token-tracker-http.js has onUsage callback wired at line 283 (parameter) and invoked at line 324 — confirmed OTEL hook point is present.
5. OTEL Diagnostics ⏭️ No live api-proxy container ran in this workflow context. When no OTLP endpoint is configured, spans fall back to /var/log/api-proxy/otel.jsonl (expected behavior per module docs).

Overall: ✅ All validatable scenarios pass. Scenario 5 is expected-pending (requires a live run with --enable-api-proxy).

📡 OTel tracing validated by Smoke OTel Tracing
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

🧪 Chroot Version Comparison Results

Runtime Host Version Chroot Version Match?
Python 3.12.13 3.12.3
Node.js v24.17.0 v22.23.0
Go go1.22.12 go1.22.12

Overall: ❌ Tests did not pass — Python and Node.js versions differ between host and chroot environments.

Tested by Smoke Chroot
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@github-actions[bot]
MCP connectivity: ✅
GitHub.com connectivity: ✅
File write/read: ✅
BYOK inference: ✅
Running in direct BYOK mode (AWF_AUTH_TYPE=github-oidc + AWF_AUTH_AZURE_* + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw) authenticated via Microsoft Entra
Overall status: PASS

🪪 BYOK (AOAI Entra) report filed by Smoke Copilot BYOK AOAI (Entra)
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Test: Copilot BYOK (Direct) Mode

✅ GitHub MCP connectivity
✅ GitHub.com HTTP 200
✅ File I/O operations
✅ BYOK inference path (api-proxy → api.githubcopilot.com)

Status: PASS
Mode: Direct BYOK (COPILOT_PROVIDER_API_KEY)
Route: Agent → api-proxy sidecar → api.githubcopilot.com

CC: @lpcox

🔑 BYOK report filed by Smoke Copilot BYOK
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

PASS

  • fix: sysroot filter should not drop workspace custom mounts
  • fix: filter split-fs-invisible mounts when sysroot-stage is active (arc-dind)
  • GitHub title check: ✅
  • File write: ✅
  • Build: ✅
  • Overall status: PASS

🔮 The oracle has spoken through Smoke Codex
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

🏗️ Build Test Suite Results

Ecosystem Project Build/Install Tests Status
Bun elysia 1/1 passed ✅ PASS
Bun hono 1/1 passed ✅ PASS
C++ fmt N/A ✅ PASS
C++ json N/A ✅ PASS
Deno oak N/A 1/1 passed ✅ PASS
Deno std N/A 1/1 passed ✅ PASS
.NET hello-world N/A ✅ PASS
.NET json-parse N/A ✅ PASS
Go color 1/1 passed ✅ PASS
Go env 1/1 passed ✅ PASS
Go uuid 1/1 passed ✅ PASS
Java gson 1/1 passed ✅ PASS
Java caffeine 1/1 passed ✅ PASS
Node.js clsx All passed ✅ PASS
Node.js execa All passed ✅ PASS
Node.js p-limit All passed ✅ PASS
Rust fd 1/1 passed ✅ PASS
Rust zoxide 1/1 passed ✅ PASS

Overall: 8/8 ecosystems passed — ✅ PASS

Generated by Build Test Suite for #5743 · 59 AIC · ⊞ 7.8K ·
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Test: Gemini Engine Validation

Overall status: PASS

Last 2 merged PRs:

  1. fix: sysroot filter should not drop workspace custom mounts
  2. fix: filter split-fs-invisible mounts when sysroot-stage is active (arc-dind)

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • localhost

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "localhost"

See Network Configuration for more information.

💎 Faceted by Smoke Gemini
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Smoke Test: GitHub Actions Services Connectivity

Check Result
Redis PING ❌ Timeout
PostgreSQL pg_isready ❌ No response
PostgreSQL SELECT 1 ❌ Timeout

Overall: FAILhost.docker.internal is not reachable from this runner. Service containers appear unavailable.

🔌 Service connectivity validated by Smoke Services
Add label ready-for-aw to run again

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

@github-actions[bot]
MCP connectivity (merged PRs: fix: ensure chmod runs even when chown fails in rootless permission repair, refactor: split 309-line generateDockerCompose into focused phases): ✅
GitHub.com HTTP connectivity: ✅
File write/read test: ✅
Direct BYOK inference: ✅
Running in direct BYOK mode (COPILOT_PROVIDER_API_KEY + COPILOT_PROVIDER_BASE_URL) via api-proxy → Azure OpenAI (Foundry, o4-mini-aw)
Overall: PASS

🔑 BYOK (AOAI api-key) report filed by Smoke Copilot BYOK AOAI (api-key)
Add label ready-for-aw to run again

@lpcox lpcox merged commit 0fe10ef into main Jul 1, 2026
85 of 88 checks passed
@lpcox lpcox deleted the test-coverage/container-lifecycle-missing-branches-127fca4fd6437ebb branch July 1, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants