Skip to content

Commit 65ebc01

Browse files
committed
Clarify orchestrator only collects pointer metadata
Round 4 review caught three places where the wording still described the old read-side model. The Stage 5 purpose text said the orchestrator "collect[s] failure logs and send[s] them to Agent A", and the orchestrator-managed-operations section said CI polling "collect[s] failure details" — both contradict the pointer-based contract this PR establishes. The TSDoc on `buildCiInspectionContext` also referred to "the ref for code scanning queries", which is easy to misread back into the SHA-as-alert-ref bug from Round 3. Reword these descriptions to make the bounded-pointer contract explicit, and clarify in the helper's TSDoc that its `ref` is a commit SHA and is not the right input for the code-scanning alerts API. Part of #316
1 parent ee7c418 commit 65ebc01

2 files changed

Lines changed: 26 additions & 12 deletions

File tree

docs/pipeline.md

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -566,10 +566,14 @@ subsequent stages depend on the PR.
566566
### Stage 5: CI check loop
567567

568568
**Agent:** A (only on failure or findings review)\
569-
**Purpose:** Wait for CI to pass. If CI fails, collect failure
570-
logs and send them to Agent A for a fix. If CI passes but check
571-
runs report findings (annotations), present them to Agent A for
572-
review.
569+
**Purpose:** Wait for CI to pass. If CI fails, build a bounded
570+
pointer-based inspection context (failing run/job IDs, check-run
571+
IDs, the commit SHA, and incomplete-metadata flags) and send it to
572+
Agent A so the agent can fetch the failure logs itself. If CI passes
573+
but check runs report findings (annotations), pass the same pointer
574+
context to Agent A for review — the agent reads annotation bodies
575+
and code scanning alerts on demand rather than receiving them
576+
inlined.
573577

574578
The orchestrator polls CI status at 30-second intervals. The CI
575579
verdict includes both **workflow runs** (Actions API) and **check
@@ -1870,10 +1874,13 @@ details.
18701874

18711875
- **PR number extraction:** After Agent A creates a PR, extract
18721876
the number via `gh pr list --head {branch} --json number`.
1873-
- **CI status polling:** Check CI status and collect failure
1874-
details. A CI check is considered passed when all required
1875-
checks succeed. `pending` -> wait and re-poll. `skipped` ->
1876-
ignore. `cancelled` -> treat as failure.
1877+
- **CI status polling:** Check CI status and build a bounded
1878+
pointer-based inspection context (failing run/job IDs,
1879+
check-run IDs, ref/SHA, incomplete-metadata flags) — never
1880+
raw failure logs, annotation bodies, or alert payloads, which
1881+
the agent fetches itself. A CI check is considered passed
1882+
when all required checks succeed. `pending` -> wait and
1883+
re-poll. `skipped` -> ignore. `cancelled` -> treat as failure.
18771884
- **Mergeable status checking:** Query the GitHub API with
18781885
exponential backoff to handle the `UNKNOWN` state that occurs
18791886
while GitHub computes mergeability.

src/ci.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,10 +571,17 @@ function fetchFailedJobs(
571571

572572
/**
573573
* Build a small, bounded inspection context that points the agent at
574-
* the failing CI surfaces (workflow runs/jobs, check runs, the ref
575-
* for code scanning queries). The agent uses the pointers to fetch
576-
* logs, annotations, and alerts itself rather than receiving them
577-
* inlined in the prompt.
574+
* the failing CI surfaces (workflow runs/jobs, check runs, and the
575+
* commit SHA used for `commits/{ref}/check-runs`-style lookups).
576+
* The agent uses the pointers to fetch logs, annotations, and alerts
577+
* itself rather than receiving them inlined in the prompt.
578+
*
579+
* Note: the `ref` field on the resulting context is a commit SHA and
580+
* is **not** the right input for the code-scanning alerts API, which
581+
* filters by Git ref (branch / `refs/pull/<n>/merge`). Code-scanning
582+
* alert reads use the branch/PR ref from the stage context instead;
583+
* see `buildFetchHints` in `src/stage-cicheck.ts` and the
584+
* `CiInspectionContext.ref` TSDoc.
578585
*
579586
* **Contract for future edits:** this helper must NOT pull raw step
580587
* logs, raw alert payloads, or annotation bodies — those are exactly

0 commit comments

Comments
 (0)