Skip to content

test: gate claude-native live e2e subtests behind ACP_TEST_CLAUDE_NATIVE (#1248) - #1253

Merged
ranxianglei merged 2 commits into
masterfrom
2026-09-24_claude-native-e2e-gate
Sep 24, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-09-24_claude-native-e2e-gate

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What & why

#1248: in shared multi-agent sandboxes, npm test hangs >25 min or fails non-deterministically inside tests/claude-native.test.ts, while every pure subtest stays green. Verified here: Run C's failing set {24,37,38,39,40,41,42} is exactly the file's 7 process-spawning subtests (live ps-walk, hook e2e ×3, watchdog tracker, watcher route, shared-proxy survival) — they spawn real proxies/processes and observe real /proc, ps output and network ports, which concurrent load makes unreliable.

Gate that exact set behind an opt-in env var, same pattern as ACP_TEST_E2E (codex suite):

  • tests/claude-native.test.ts: single LIVE_E2E flag (ACP_TEST_CLAUDE_NATIVE === "1") + per-test skip: reasons; platform-only conditions preserved when the gate is open.
  • .github/workflows/ci.yml, release.yml, release-manual.yml: set ACP_TEST_CLAUDE_NATIVE: "1" on their npm test steps so dedicated runners keep running all 7 unchanged.

Behavior change (disclosed)

Local npm test default: the 7 claude-native live subtests now skip instead of running (old: always ran — on loaded shared boxes that meant 25+ min hangs or random failures unrelated to the diff under review). New default keeps them off for a fast deterministic signal; opt back in with ACP_TEST_CLAUDE_NATIVE=1. CI/release-gate coverage is unchanged (env set there).

Verification (rebased head, this sandbox = the flaky environment itself)

  • Gates OFF (new local default): full suite node --import tsx --test tests/*.test.ts → 2440 tests, 2431 pass, 0 fail, 9 skipped (7 new gate-skips with reasons + 2 pre-existing win32 skips), ~170s, exit 0.
  • Gates ON: all 7 run (0 skipped); on this loaded sandbox 3 failed with the issue's exact signatures ({24} "leaf pid file never appeared", {40}/{42} "proxy up behind …" 60s timeouts — subset of Run C's set), confirming both the diagnosis and that opt-in is meant for dedicated machines.
  • npm run typecheck ✅ · npm run build ✅ (run after rebase onto current master incl. fix: break logger EPIPE feedback loop — async stderr error re-enters uncaughtException (#1233) #1240).

Incidental fix (separate commit, labeled)

test: claude-native live ps-walk — survive ESRCH when the fake claude is already gone: the unguarded process.kill(claude.pid) in the finally block threw kill ESRCH (Run B's exact error signature) when the spawned fake claude had already exited (e.g. OOM-killed mid-test under load), failing the test even though every assertion had passed. Wrapped like the adjacent leaf-kill.

Closes #1248

ework-agent added 2 commits September 24, 2026 11:42
… is already gone (#1248)

Run B's exact failure signature: the unguarded process.kill(claude.pid) in the
finally block throws ESRCH when the spawned fake claude has already exited
(e.g. OOM-killed mid-test on a loaded shared box), failing the test even
though every assertion passed. Wrap it like the adjacent leaf-kill.
…IVE (#1248)

The 7 process-spawning subtests in tests/claude-native.test.ts (live ps-walk,
hook e2e x3, watchdog tracker, watcher route, shared-proxy survival) hang or
fail non-deterministically on loaded shared multi-agent sandboxes while every
pure test stays green — Run C's failing set {24,37-42} is exactly this set,
reproduced again in this sandbox ({24,40,42}).

Gate them opt-in behind ACP_TEST_CLAUDE_NATIVE=1, same pattern as ACP_TEST_E2E
for the codex suite: local npm test skips them by default (fast deterministic
signal); ci.yml + both release workflows set the var so dedicated runners keep
running them unchanged.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-24_claude-native-e2e-gate (8ba9e30)

Option A — Install from npm PR tag (recommended)

npm install -g billion-context@pr-1253

Each push to this PR publishes a new version under the pr-1253 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr1253.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review started — this is a [PR] issue, so I'm reviewing rather than re-doing the work. Pulling the branch, checking base freshness vs master, walking the diff, checking CI, and doing targeted local verification of the gate behavior. Full conclusion in a follow-up comment.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review complete — mergeable. (Reviewed on head 8ba9e306; per [PR] policy I reviewed rather than re-did the work — this PR is the deliverable of #1248.)

Base freshness: rebased onto current master (pr-1253~2 == origin/master 3aeb2b03, incl. #1240); GitHub reports mergeable_state: clean.

① Direction (vs #1248): the fix hits the right layer. Root cause is environmental — 7 process-spawning subtests observing real /proc/ps/ports under concurrent sandbox load — and the remedy is execution policy (opt-in env gate, same pattern as ACP_TEST_E2E), not masking a code defect. Matches the issue's suggested fix exactly.

② Regression review — existing behaviors inventoried:

  • tests/claude-native.test.ts: 35 pure subtests untouched — verified locally gate-off: 42 tests, 35 pass, 0 fail, 7 skip, each skip self-documenting (set ACP_TEST_CLAUDE_NATIVE=1 … #1248), file completes in ~2s vs the reported >25 min hangs. Gate set open, platform conditions preserved (LIVE_E2E ? platformCond : liveSkip), so win32/linux scoping behaves byte-for-byte as before when the gate is on.
  • Gated set completeness: grepped every spawn/execFile site in the file — all 7 gated tests account for every process-spawning path (incl. helpers runHook/ensureDistBuilt/spawnProxy, which are only called from gated tests). Nothing spawning is left ungated, nothing pure got gated.
  • Workflows: only ci.yml, release.yml, release-manual.yml run npm test (grepped all 8 workflows) and all three now set ACP_TEST_CLAUDE_NATIVE: "1" → CI/release-gate coverage of the 7 live tests is unchanged. No other workflow silently loses coverage.
  • Incidental ESRCH commit: cleanup-only (finally-block process.kill wrapped like the adjacent leaf-kill); turns a spurious failure (assertions passed, cleanup threw kill ESRCH because the fake claude already exited) into tolerance. No assertion or semantic change.
  • Behavior change old→new: local npm test default — 7 live subtests ran → skip. Disclosed in the PR body with rationale; opt-in available. No wire/config/persistence/updater/session-id surface touched.

③ Code review: minimal (+37/−8, 4 files), follows the established ACP_TEST_E2E idiom, comments cite #1248, no as any/console.error/version churn. Two clearly-labeled commits (gate + incidental fix), diff fully on-purpose.

④ Verification performed: CI on this head is all green (ubuntu 24/22 + windows 24/22 tests, e2e lanes, version-guard, artifact). Locally I reproduced both gate states: off → the exact expected skip profile above; on → the live ps-walk test actually executes and fails here with leaf pid file never appeared — Run C's signature verbatim, independent confirmation of the flake diagnosis (this loaded sandbox is the flaky environment; on a dedicated runner CI shows it green, which is precisely why the gate exists).

Gate verdict: touches release-workflow files + a disclosed local-default change → human merge per §7.4. Nothing blocking.

中文摘要:审查了 #1248 的修复 PR——把 claude-native 文件里 7 个真实起进程的子测试(与 Run C 失败集一一对应,已逐处核对 spawn 点无遗漏)放到 ACP_TEST_CLAUDE_NATIVE=1 开关后,本地默认跳过(已披露旧→新行为),三个 CI/发布工作流全部设置该变量保持原覆盖不变;顺手修的 ESRCH 仅涉及清理逻辑。本地双态验证 + CI 全绿,diff 干净且基于最新 master,可以合并。

@ranxianglei
ranxianglei merged commit c96d91f into master Sep 24, 2026
9 checks passed
@ranxianglei
ranxianglei deleted the 2026-09-24_claude-native-e2e-gate branch October 15, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests/claude-native.test.ts linux live-E2E subtests fail/hang in shared multi-agent sandboxes

1 participant