Skip to content

test: fix exit code validation in test runner fixture#792

Merged
Mossaka merged 7 commits intomainfrom
claude/diagnose-test-chroot-package-managers
Feb 13, 2026
Merged

test: fix exit code validation in test runner fixture#792
Mossaka merged 7 commits intomainfrom
claude/diagnose-test-chroot-package-managers

Conversation

@Claude
Copy link
Contributor

@Claude Claude AI commented Feb 13, 2026

  • Analyze the bug in awf-runner.ts success field calculation
  • Fix the success field to use nullish coalescing and validate exit code is a valid number
  • Apply fix to both run() and runWithSudo() methods
  • Build the project
  • Report progress with commit

Changes Made

Fixed the test runner fixture (AwfRunner) to properly validate exit codes before marking runs as successful:

  • Changed from || operator to nullish coalescing (??) for exit code normalization to avoid incorrectly coercing falsy values like NaN to 0
  • Added hasValidExitCode validation to ensure the exit code is a number and finite before marking as success
  • Prevents processes terminated by signals (without a valid exit code) from being incorrectly reported as successful
  • Applied the fix to both run() and runWithSudo() methods

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Claude AI and others added 5 commits February 13, 2026 00:19
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
@Claude Claude AI assigned Claude and lpcox Feb 13, 2026
@Claude Claude AI changed the title [WIP] Diagnose failing GitHub Actions workflow for test chroot package managers docs: diagnose Test Chroot Package Managers failure for rustc Feb 13, 2026
@Claude Claude AI requested a review from lpcox February 13, 2026 00:55
- Normalize exitCode before evaluating success condition
- Previously compared original result.exitCode (possibly undefined) to 0
- Now normalizes to 0 first, then uses normalized value for success check
- Fixes issue where exit code 0 was incorrectly marked as failure

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
@lpcox lpcox marked this pull request as ready for review February 13, 2026 01:00
Copilot AI review requested due to automatic review settings February 13, 2026 01:00
@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

Smoke test (Codex)
PR titles: feat: add API proxy sidecar for secure LLM credential management; feat: add secret-digger red team workflows
GitHub MCP review last 2 merged PRs: ✅
safeinputs-gh pr list: ✅
Playwright title contains GitHub: ✅
Tavily search: ❌ (tool unavailable)
File write: ✅
Bash cat verify: ✅
Discussion comment: ✅
Build npm ci && npm run build: ✅
Overall: FAIL

AI generated by Smoke Codex

@github-actions
Copy link
Contributor

Smoke Test Results

Last 2 merged PRs:

  • feat: add API proxy sidecar for secure LLM credential management
  • feat: add secret-digger red team workflows

✅ GitHub MCP
✅ Playwright (title: "GitHub · Change is constant. GitHub keeps you ahead. · GitHub")
✅ File write
✅ Bash

Status: PASS

AI generated by Smoke Claude

Copy link
Contributor

Copilot AI left a comment

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 adjusts the test runner fixture (AwfRunner) result shaping to ensure the success field is computed from the same normalized exit code value that is returned to tests, addressing failures where exitCode normalization and success could disagree.

Changes:

  • Normalize result.exitCode into a local exitCode variable in run() and runWithSudo().
  • Compute success from the normalized exitCode rather than the raw result.exitCode.
Comments suppressed due to low confidence (1)

tests/fixtures/awf-runner.ts:299

  • Same issue here: the || 0 normalization can turn a missing/invalid exit code into 0 and therefore success: true. Prefer nullish coalescing for exit code normalization and ensure success can’t become true when the process ends without a real 0 exit code (e.g. signal termination).
    // Normalize exit code (undefined/null becomes 0)
    const exitCode = result.exitCode || 0;

    return {
      exitCode,
      stdout: result.stdout || '',
      stderr: result.stderr || '',
      success: exitCode === 0,
      timedOut: false,

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

Comment on lines 144 to 151
// Normalize exit code (undefined/null becomes 0)
const exitCode = result.exitCode || 0;

return {
exitCode: result.exitCode || 0,
exitCode,
stdout: result.stdout || '',
stderr: result.stderr || '',
success: result.exitCode === 0,
success: exitCode === 0,
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

result.exitCode || 0 does not only normalize undefined/null—it also coerces other falsy values (e.g. NaN) to 0, which can incorrectly mark the run as success. Use nullish coalescing for the normalization, and consider guarding success against cases where the process terminated without an exit code (e.g. due to a signal) so it can’t be reported as successful.

This issue also appears on line 291 of the same file.

See below for a potential fix:

    const rawExitCode = result.exitCode;
    const exitCode = rawExitCode ?? 0;
    const hasValidExitCode =
      typeof rawExitCode === 'number' && Number.isFinite(rawExitCode);

    return {
      exitCode,
      stdout: result.stdout || '',
      stderr: result.stderr || '',
      success: hasValidExitCode && exitCode === 0,

Copilot uses AI. Check for mistakes.
Comment on lines 144 to 146
// Normalize exit code (undefined/null becomes 0)
const exitCode = result.exitCode || 0;

Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

PR title is scoped as docs: but this change modifies test fixture logic. Consider renaming the PR (and/or using a non-docs conventional commit scope) so release notes/changelogs and reviewers correctly categorize it.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

C++ Build Test Results

Project CMake Build Status
fmt PASS
json PASS

Overall: PASS

All C++ projects built successfully.

AI generated by Build Test C++

@github-actions
Copy link
Contributor

Go Build Test Results

Project Download Tests Status
color 1/1 PASS
env 1/1 PASS
uuid 1/1 PASS

Overall: PASS

All Go projects successfully downloaded dependencies and passed tests.

AI generated by Build Test Go

@github-actions
Copy link
Contributor

Deno Build Test Results ✅

Project Tests Status
oak 1/1 ✅ PASS
std 1/1 ✅ PASS

Overall: PASS

All Deno tests completed successfully!

AI generated by Build Test Deno

@github-actions
Copy link
Contributor

Build Test: Rust - Results

All Rust projects built and tested successfully! ✅

Project Build Tests Status
fd 1/1 PASS
zoxide 1/1 PASS

Overall: PASS

Both projects compiled successfully and all tests passed.

AI generated by Build Test Rust

@lpcox
Copy link
Collaborator

lpcox commented Feb 13, 2026

@claude[agent] merge this branch into claude/extract-rust-one-shot-token-lib

Copilot AI changed the title docs: diagnose Test Chroot Package Managers failure for rustc test: fix exit code validation in test runner fixture Feb 13, 2026
Base automatically changed from claude/extract-rust-one-shot-token-lib to main February 13, 2026 04:38
Resolved conflicts in favor of main's C-based one-shot-token implementation
(replacing PR's Rust-based version) and main's nullish coalescing operator
for exit code normalization in awf-runner.ts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

🎬 THE ENDSmoke Claude MISSION: ACCOMPLISHED! The hero saves the day! ✨

@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 13, 2026

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

@github-actions
Copy link
Contributor

✅ Coverage Check Passed

Overall Coverage

Metric Base PR Delta
Lines 82.88% 83.04% 📈 +0.16%
Statements 82.88% 83.03% 📈 +0.15%
Functions 82.74% 82.74% ➡️ +0.00%
Branches 74.87% 74.97% 📈 +0.10%
📁 Per-file Coverage Changes (1 files)
File Lines (Before → After) Statements (Before → After)
src/docker-manager.ts 84.7% → 85.3% (+0.61%) 84.2% → 84.8% (+0.60%)

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

@github-actions
Copy link
Contributor

Smoke Test Results (Claude) - Run #21978273270

✅ GitHub MCP: Retrieved last 2 merged PRs

✅ Playwright: Navigated to github.com (title: "GitHub · Change is constant. GitHub keeps you ahead. · GitHub")

✅ File Writing: Created /tmp/gh-aw/agent/smoke-test-claude-21978273270.txt

✅ Bash Tool: Verified file content

Status: PASS

AI generated by Smoke Claude

@github-actions
Copy link
Contributor

C++ Build Test Results

Project CMake Build Status
fmt PASS
json PASS

Overall: PASS

All C++ projects built successfully.

AI generated by Build Test C++

@github-actions
Copy link
Contributor

Go Build Test Results

Project Download Tests Status
color 1/1 PASS
env 1/1 PASS
uuid 1/1 PASS

Overall: PASS

All Go projects successfully downloaded dependencies and passed tests.

AI generated by Build Test Go

@github-actions
Copy link
Contributor

Node.js Build Test Results ✅

All Node.js projects tested successfully!

Project Install Tests Status
clsx PASS PASS
execa PASS PASS
p-limit PASS PASS

Overall: PASS

AI generated by Build Test Node.js

@github-actions
Copy link
Contributor

Smoke Test Results - PASS ✅

Last 2 Merged PRs:

Test Results:

  • ✅ GitHub MCP: Retrieved merged PRs successfully
  • ✅ Playwright: Verified GitHub page title
  • ✅ File Writing: Created /tmp/gh-aw/agent/smoke-test-copilot-21978273214.txt
  • ✅ Bash Tool: Verified file contents

Overall Status: PASS

cc @Mossaka @lpcox @Claude

AI generated by Smoke Copilot

@github-actions
Copy link
Contributor

🦀 Rust Build Test Results

Project Build Tests Status
fd 1/1 PASS
zoxide 1/1 PASS

Overall: PASS

All Rust projects built and tested successfully.

AI generated by Build Test Rust

@github-actions
Copy link
Contributor

Bun Build Test Results

Project Install Tests Status
elysia 1/1 PASS
hono 1/1 PASS

Overall: PASS

All Bun projects built and tested successfully.

AI generated by Build Test Bun

@github-actions
Copy link
Contributor

Deno Build Test Results

Project Tests Status
oak 1/1 ✅ PASS
std 1/1 ✅ PASS

Overall: ✅ PASS

All Deno tests completed successfully.

AI generated by Build Test Deno

@github-actions
Copy link
Contributor

.NET Build Test Results

Project Restore Build Run Status
hello-world PASS
json-parse PASS

Overall: PASS

All .NET projects successfully restored, built, and executed.

AI generated by Build Test .NET

@github-actions
Copy link
Contributor

Smoke test results:
Merged PR titles:

  • fix(agent): use AWF_API_PROXY_IP env var for api-proxy iptables rules
  • Add debug logging for BASE_URL environment variables in agent container
    GitHub MCP review ✅
    Safeinputs gh query ✅
    Playwright title ✅
    Tavily search ❌
    File write ✅ | Bash cat ✅ | Discussion comment ✅ | Build ✅
    Overall status: FAIL

AI generated by Smoke Codex

@github-actions
Copy link
Contributor

🧪 Chroot Version Comparison Test Results

Runtime Host Version Chroot Version Match?
Python 3.12.12 3.12.3 ❌ NO
Node.js v24.13.0 v20.20.0 ❌ NO
Go go1.22.12 go1.22.12 ✅ YES

Overall Status: ❌ Test Failed

Chroot mode is working correctly (binaries from host are accessible), but version mismatches were detected for Python and Node.js. This is expected when the host system has different versions installed than what's available in the agent container's Ubuntu base image.

AI generated by Smoke Chroot

@github-actions
Copy link
Contributor

Build Test: Java ✅

All Java projects compiled and tested successfully!

Project Compile Tests Status
gson 1/1 PASS ✅
caffeine 1/1 PASS ✅

Overall: PASS ✅

All tests passed successfully through the AWF firewall with Maven proxy configuration.

AI generated by Build Test Java

@Mossaka Mossaka merged commit 450cde7 into main Feb 13, 2026
93 checks passed
@Mossaka Mossaka deleted the claude/diagnose-test-chroot-package-managers branch February 13, 2026 07:39
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.

3 participants