mirror of
https://github.com/redwoodjs/local-ci.git
synced 2026-09-19 07:54:29 +08:00
edce84b8b1
* fix(cli): unblock --pause-on-failure in non-TTY pipes (#315) Spawn the run as a detached worker when stdout isn't a TTY (and we're not under an LLM harness), then exit 77 the moment the worker emits a `run.paused` NDJSON event — freeing the caller's pipe while the worker keeps the container + DTU alive for `agent-ci retry`. Retry tails the same log so a re-failure surfaces as another exit-77. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(cli): NDJSON event stream behind --json (#289) Extends the existing pause/finish sentinel emitter into a full lifecycle event stream. New `--json` flag (and `AGENT_CI_JSON=1` env var) emits `run.start`, `job.start`/`finish`, `step.start`/`finish`, `run.paused`, `run.finish`, `diagnostic` events on stdout — one JSON object per line — each carrying an `event` discriminator and a `schemaVersion: 1` on `run.start`. `--json` is decoupled from `--quiet` so existing `-q` callers keep silent stdout; the diff renderer is auto-suppressed under `--json` so ANSI sequences don't collide with the stream. Detached-worker mode (#315) keeps emitting only sentinels — the launcher filters non-sentinel events anyway, so non-JSON callers don't pay the cost. Renames `run.completed` -> `run.finish` to match the issue's naming. Closes #289. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(cli): suppress printSummary under --json The ━━━ FAILURES ━━━ / ━━━ SUMMARY ━━━ blocks write to stdout unconditionally, which interleaves with the NDJSON event stream and breaks line-based parsers. Skip them when isJsonMode() — consumers get the same information from job.finish + run.finish events. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * feat(cli): AGENT_CI_DETACHED=1 forces detached launcher on TTY Overload AGENT_CI_DETACHED so it can serve both roles: - `=<absolute path>` → set by the launcher on its worker child; `isDetachedWorker()` returns true. - `=1` (or any non-absolute value) → caller-side opt-in: force the launcher path even when stdout is a TTY. Useful for manual verification of the #315 pause-then-exit-77 flow without having to construct a non-TTY pipe. The two are distinguished by whether the value starts with `/`. New `isForceDetachedRequested()` helper drives a `forceDetached` arg into `shouldLaunchDetached`, which still respects `alreadyWorker`, `agentMode`, and the `pauseOnFailure` requirement. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * test(ci): smoke for --json NDJSON event stream (#289) scripts/smoke-289.sh creates a tmp repo with a 2-step passing workflow, runs `agent-ci run --json`, and asserts: - run.start carries schemaVersion=1 - step.start + step.finish for each declared step - job.finish status=passed - run.finish status=passed - every JSON-shaped line on stdout has a recognized event field .github/workflows/smoke-json-events.yml runs the script in CI on every PR (gated by the same safe-to-run / collaborator predicate as the other smokes). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(ci): stop smoke-resource-mismatch from hanging on real GitHub runners The fixture in .github/workflows/smoke-resource-mismatch.yml declares `runs-on: ubuntu-latest-999-cores` so agent-ci's resource-fidelity classifier deterministically tags the job as `degraded` on any host. With its previous `pull_request_target` trigger, GitHub Actions also picked it up on every PR and queued a job that no real runner can satisfy — five queued runs piled up on PR #323 alone, each timing out after hours. Switch the workflow to `workflow_dispatch:`-only so GitHub never auto-dispatches it, and teach `isWorkflowRelevant` to treat `workflow_dispatch:`-only workflows as relevant for `agent-ci run --all` so the local smoke keeps running. The opt-in is gated to the sole-event case to avoid overriding `pull_request` / `push` path/branch filters on workflows that legitimately combine triggers. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>