verify-loop: agent-retry workflow + verification.json producer (consumer side of glimmung#18) #176

Closed
opened 2026-04-30 17:46:13 -07:00 by romaine-life-app[bot] · 3 comments
romaine-life-app[bot] commented 2026-04-30 17:46:13 -07:00 (Migrated from github.com)

Spirelens-side conformance for glimmung's verify-loop substrate (glimmung#18 / glimmung PR #21). The substrate has landed in glimmung; the loop only closes once spirelens emits the contract-shaped artifact and accepts retry dispatches.

What's needed

1. verification.json producer

Update the existing verify phase to emit verification.json and upload it as a GHA artifact named verification.

Schema (from glimmung's VerificationResult model, documented in glimmung README):

{
  "schema_version": 1,
  "status": "pass" | "fail" | "error",
  "reasons": ["short human-readable strings, one per failure"],
  "evidence_refs": ["screenshots/01.png", "logs/verify.log"],
  "cost_usd": 4.20,
  "prompt_version": "v17",
  "metadata": {}
}

Status semantics:

  • pass — verification reached a positive verdict.
  • fail — verification reached a negative verdict (the common retry case).
  • error — verifier itself crashed before reaching a verdict. Treated as a substantive negative verdict (retry up to budget), distinct from a missing artifact.

Missing or schema-invalid artifact triggers ABORT_MALFORMED in glimmung — the run aborts with an issue comment explaining the contract violation, so this contract is load-bearing.

2. agent-retry.yml workflow

A slim retry workflow glimmung dispatches when verification fails within budget. Inputs glimmung will set:

Input Description
lease_id Fresh lease ID for the retry attempt.
host Host the retry was scheduled onto.
issue_number Issue under which the run is tracked.
run_id Glimmung Run ULID (log correlation).
attempt_index 0-based attempt index (initial=0, first retry=1, …).
prior_verification_artifact_url GHA Actions API URL of the previous attempt's verification artifact. The retry workflow pulls it via its own GITHUB_TOKEN.

The retry workflow runs impl + verify with the prior verification context fed back into the implementation prompt, then uploads its own verification.json artifact at completion. Spirelens-specific build/test commands stay in this yaml (which is why it lives here, not in glimmung).

3. Glimmung workflow registration update

Once the retry workflow exists, update spirelens's glimmung workflow registration:

curl -X POST https://glimmung.romaine.life/v1/workflows \
  -H "Authorization: Bearer $TOKEN" \
  -d '{
    "project": "spirelens",
    "name": "issue-agent",
    "workflow_filename": "issue-agent.yml",
    "retry_workflow_filename": "agent-retry.yml",
    "trigger_label": "agent-run",
    "default_budget": {"max_attempts": 3, "max_cost_usd": 25.0}
  }'

This is what flips the verify-loop on for spirelens. Workflows without retry_workflow_filename keep the pre-#18 fire-and-forget behavior unchanged.

Definition of done

The remaining DoD items from glimmung#18 (steps 1–5):

  1. Open a spirelens issue, label agent-run, watch initial dispatch behave as today.
  2. Force a verification failure (intentional).
  3. Glimmung re-dispatches agent-retry.yml with prior_verification_artifact_url set; retry runs impl + verify with that context.
  4. Retry succeeds → PR opens.
  5. Force a budget-exceed case (apply agent-budget:1x10 and a known-failing issue); glimmung aborts cleanly with an issue comment explaining why.
  • glimmung#18 — verify-loop wedge issue (substrate)
  • glimmung#21 — PR landing the substrate
  • spirelens#174 — original verification-failure self-correction proposal (the orchestration moved to glimmung; this issue is what's left here)
Spirelens-side conformance for glimmung's verify-loop substrate ([glimmung#18](https://github.com/nelsong6/glimmung/issues/18) / [glimmung PR #21](https://github.com/nelsong6/glimmung/pull/21)). The substrate has landed in glimmung; the loop only closes once spirelens emits the contract-shaped artifact and accepts retry dispatches. ## What's needed ### 1. `verification.json` producer Update the existing verify phase to emit `verification.json` and upload it as a GHA artifact named `verification`. Schema (from glimmung's `VerificationResult` model, documented in [glimmung README](https://github.com/nelsong6/glimmung/blob/main/README.md#verifyloop-substrate-18)): ```json { "schema_version": 1, "status": "pass" | "fail" | "error", "reasons": ["short human-readable strings, one per failure"], "evidence_refs": ["screenshots/01.png", "logs/verify.log"], "cost_usd": 4.20, "prompt_version": "v17", "metadata": {} } ``` Status semantics: - `pass` — verification reached a positive verdict. - `fail` — verification reached a negative verdict (the common retry case). - `error` — verifier itself crashed before reaching a verdict. Treated as a substantive negative verdict (retry up to budget), distinct from a missing artifact. Missing or schema-invalid artifact triggers `ABORT_MALFORMED` in glimmung — the run aborts with an issue comment explaining the contract violation, so this contract is load-bearing. ### 2. `agent-retry.yml` workflow A slim retry workflow glimmung dispatches when verification fails within budget. Inputs glimmung will set: | Input | Description | |---|---| | `lease_id` | Fresh lease ID for the retry attempt. | | `host` | Host the retry was scheduled onto. | | `issue_number` | Issue under which the run is tracked. | | `run_id` | Glimmung Run ULID (log correlation). | | `attempt_index` | 0-based attempt index (initial=0, first retry=1, …). | | `prior_verification_artifact_url` | GHA Actions API URL of the previous attempt's `verification` artifact. The retry workflow pulls it via its own `GITHUB_TOKEN`. | The retry workflow runs impl + verify with the prior verification context fed back into the implementation prompt, then uploads its own `verification.json` artifact at completion. Spirelens-specific build/test commands stay in this yaml (which is why it lives here, not in glimmung). ### 3. Glimmung workflow registration update Once the retry workflow exists, update spirelens's glimmung workflow registration: ```sh curl -X POST https://glimmung.romaine.life/v1/workflows \ -H "Authorization: Bearer $TOKEN" \ -d '{ "project": "spirelens", "name": "issue-agent", "workflow_filename": "issue-agent.yml", "retry_workflow_filename": "agent-retry.yml", "trigger_label": "agent-run", "default_budget": {"max_attempts": 3, "max_cost_usd": 25.0} }' ``` This is what flips the verify-loop on for spirelens. Workflows without `retry_workflow_filename` keep the pre-#18 fire-and-forget behavior unchanged. ## Definition of done The remaining DoD items from glimmung#18 (steps 1–5): 1. Open a spirelens issue, label `agent-run`, watch initial dispatch behave as today. 2. Force a verification failure (intentional). 3. Glimmung re-dispatches `agent-retry.yml` with `prior_verification_artifact_url` set; retry runs impl + verify with that context. 4. Retry succeeds → PR opens. 5. Force a budget-exceed case (apply `agent-budget:1x10` and a known-failing issue); glimmung aborts cleanly with an issue comment explaining why. ## Related - glimmung#18 — verify-loop wedge issue (substrate) - glimmung#21 — PR landing the substrate - spirelens#174 — original verification-failure self-correction proposal (the orchestration moved to glimmung; this issue is what's left here)
romaine-life-app[bot] commented 2026-04-30 19:12:09 -07:00 (Migrated from github.com)

Deferred. The verify-loop wedge is shifting consumer from spirelens to ambience — ambience is a smaller, more deterministic test target, so the substrate gets validated faster there. Spirelens keeps the pre-#18 fire-and-forget shape until the loop is proven on ambience and we choose to bring spirelens onto it.

Tracked at ambience#131. Same three deliverables (verification.json producer, agent-retry.yml, glimmung registration) plus an agent-triage.yml for the glimmung#19 PR-feedback re-entry path that landed alongside.

Re-open this when we want spirelens on the verify-loop too — most of the conformance work transfers directly (the artifact contract is the same; only the per-project workflow yaml is project-specific).

Deferred. The verify-loop wedge is shifting consumer from spirelens to ambience — ambience is a smaller, more deterministic test target, so the substrate gets validated faster there. Spirelens keeps the pre-#18 fire-and-forget shape until the loop is proven on ambience and we choose to bring spirelens onto it. Tracked at [ambience#131](https://github.com/nelsong6/ambience/issues/131). Same three deliverables (verification.json producer, agent-retry.yml, glimmung registration) plus an agent-triage.yml for the [glimmung#19](https://github.com/nelsong6/glimmung/issues/19) PR-feedback re-entry path that landed alongside. Re-open this when we want spirelens on the verify-loop too — most of the conformance work transfers directly (the artifact contract is the same; only the per-project workflow yaml is project-specific).
Keesan12 commented 2026-05-14 08:14:08 -07:00 (Migrated from github.com)

Making verification.json load-bearing is the right call. I would keep pass / fail / error and add one more explicit field or metadata convention for retry class / stop reason so downstream can tell schema-valid failure, verifier crash, budget exhaustion, and human-blocked apart without reinterpreting strings. Once retries are in play, that distinction matters almost as much as the verdict itself. Same reason we care about explicit halt reasons in MartinLoop run records: replay and debugging get much easier when the contract preserves why the loop continued or stopped.

Making `verification.json` load-bearing is the right call. I would keep `pass` / `fail` / `error` and add one more explicit field or metadata convention for retry class / stop reason so downstream can tell schema-valid failure, verifier crash, budget exhaustion, and human-blocked apart without reinterpreting strings. Once retries are in play, that distinction matters almost as much as the verdict itself. Same reason we care about explicit halt reasons in MartinLoop run records: replay and debugging get much easier when the contract preserves why the loop continued or stopped.
nelsong6 commented 2026-07-05 15:45:19 -07:00 (Migrated from github.com)

Closing during repository issue cleanup. If this becomes active work again, we can reopen or recreate it as a fresh, specific task.

Closing during repository issue cleanup. If this becomes active work again, we can reopen or recreate it as a fresh, specific task.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
romaine-life/spirelens#176
No description provided.