Skip to content

feat: provider-agnostic reusable gaze AI report workflow - #300

Merged
jflowers merged 12 commits into
unbound-force:mainfrom
jflowers:reusable-gaze-ai-report
Oct 19, 2026
Merged

jflowers merged 12 commits into
unbound-force:mainfrom
jflowers:reusable-gaze-ai-report

Conversation

@jflowers

Copy link
Copy Markdown
Collaborator

Summary

Adds a provider-agnostic reusable workflow that runs the gaze AI quality report with opencode, dogfoods it in Test, and documents the consumer contract.

  • Reusable workflow (.github/workflows/reusable_gaze_ai_report.yml): caller uploads a coverprofile artifact; the workflow installs pinned toolchains (gaze v2.2.0, opencode-ai 1.19.0), runs gaze report ./... --ai=opencode, enforces thresholds, and appends the report to the step summary.
  • Config as the single org secret: the consumer's entire opencode config — provider, model, permissions, and literal API key — arrives through one optional secret, opencode-config, exported verbatim as OPENCODE_CONFIG_CONTENT. No OPENCODE_PROVIDER_KEY, no repo-level provider key for any consumer. The optional model input overrides the config's top-level model only when set.
  • Fork-PR safe: report steps are gated on secret presence (HAS_OPENCODE_CONFIG env indirection); PR runs still validate checkout, toolchain install, and artifact handoff, then post a skip notice.
  • Dogfood (test.yml): replaces the GCP Vertex/claude-opus chain (WIF auth, setup-gcloud, opencode install, quality report) with an Upload coverage step and a gaze-ai-report job consuming the reusable workflow with thresholds 38/6/8 and the org secret.
  • Docs (docs/guides/ci-integration.md): new Reusable Workflow section — contract, inputs table, canonical config shape, consumer example.

OpenSpec change: openspec/changes/reusable-gaze-ai-report/ (proposal, design, spec delta, tasks; the Phase 5 amendment records the config-as-org-secret contract).

Validation

  • Payload budget: compact AI payload 160,212 B for this repo — fits GLM 5.3's 262,144-token context.
  • CI-faithful dry run: fresh HOME, only OPENCODE_CONFIG_CONTENT (literal-key config), no --model flag — full GLM 5.3 quality report produced, exit 0.
  • openspec validate reusable-gaze-ai-report --strict: valid.
  • yamllint on both workflows: pass.

Post-merge actions

  1. Create the org-level secret OPENCODE_CONFIG_CONTENT (unbound-force org, scoped to gaze and consumers) using the canonical config from docs/guides/ci-integration.md, with the literal API key in apiKey.
  2. Verify task 4.5: PR run executes artifact handoff and skips the report; post-merge push run produces the first org-secret-driven EnMaaS report.
  3. Tag a release so downstream consumers can pin the ref.

@jflowers jflowers self-assigned this Oct 18, 2026

@jflowers jflowers left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES (posted as COMMENT — GitHub does not allow the PR author to submit a REQUEST_CHANGES event on their own PR)

A well-executed, fully spec'd CI refactor that improves the security posture (removes id-token: write, unsets tokens in the report step, tightens permissions), with fork-PR gating and artifact handoff empirically validated by this PR's own green dogfood run. All 6 CI checks pass.

Two pre-merge items drive the verdict:

  1. [MEDIUM] The consumer example pins @v2.2.0, a ref that verifiably 404s and can never contain this workflow (inline at docs/guides/ci-integration.md:223) — one-line fix.
  2. [MEDIUM] The AGENTS.md Website Documentation Gate is unsatisfied — no tracking issue exists in unbound-force/website for this new consumer-facing contract (inline at docs/guides/ci-integration.md:132). Create the issue pre-merge or explicitly waive.

Additional inline findings: design.md D5 misstates PR behavior for same-repo PRs (LOW); no concurrency group (CI-012, LOW).

Findings without a diff anchor:

  • [LOW] AGENTS.md documentation impact not addressed — the CI/CD section still enumerates "Three GitHub Actions workflows" (already stale pre-PR) and there is no Recent Changes entry for this capability.
  • [LOW] Review Council Gate — the constitution requires /uf.review-council APPROVE from all four reviewers before PR submission; CI workflow changes are not on the exemption list. This review contributes; complete the council or waive explicitly as repo owner.
  • [LOW] Pre-existing residual — the opencode adapter's empty-output error appends truncated stderr (formatStderrSuffix); if the pinned opencode-ai ever printed config fragments, GitHub masks the full secret value but not substrings (the bare apiKey inside the JSON). Consider follow-up stderr scrubbing.

Verified sound (no action needed): secret gating empirically confirmed on the fork-PR dogfood run (install/report steps skipped, notice posted); no artifact-poisoning path (same-run artifacts consumed only in trusted runs); no command injection (env-var indirection throughout); minimal permissions (contents: read); version-pinned toolchain installs (gaze v2.2.0 via go install, opencode-ai 1.19.0 via npm); all 4 action SHAs verified against their tags; thresholds carried through unchanged at 38/6/8 (no gate loosening); spec-first and Spec Commit Gate ordering satisfied.

This review was generated by /uf.review-pr (AI-assisted).

Comment thread docs/guides/ci-integration.md Resolved
Comment thread docs/guides/ci-integration.md Resolved
The consumer example pinned @v2.2.0, a tag that predates the workflow
file (404 at that ref; Go module proxy immutability prevents
re-tagging). Pin @v2.3.0 — the first release that will ship the
workflow — and add guidance to pin the latest release tag when
adopting.

Addresses PR unbound-force#300 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
Org secrets resolve for pull_request runs from same-repo branches, so
the EnMaaS report and threshold enforcement run on same-repo PRs, not
only push to main. Correct design.md D5, the Risks entry, delta-spec
R4, and the two-step CI description in ci-integration.md to state the
accurate scoping (fork PRs skip via the secret gate).

Addresses PR unbound-force#300 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
The Test workflow (now the first API-spending workflow via the
gaze-ai-report job) lacked a concurrency group (CI-012 [SHOULD]):
overlapping runs on the same ref fired redundant paid LLM reports.
Add a workflow-level group keyed on ref + workflow name with
cancel-in-progress for non-default branches (PR runs cancel on
supersede; main runs queue one in-progress plus one pending so the
post-merge report record is never lost). Workflow-level concurrency
in the workflow_call reusable workflow itself is inert (called
workflows never admit runs), so the reusable workflow instead
documents the contract: concurrency policy is caller-owned.

Addresses PR unbound-force#300 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
The CI/CD section said 'Three GitHub Actions workflows' — stale before
this PR and now missing the reusable gaze AI report workflow. Describe
the actual inventory (Test, MegaLinter, Release, Reusable Gaze AI
Report, fullsend/Prioritize) and add a Recent Changes entry for the
reusable gaze AI report capability.

Addresses PR unbound-force#300 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
Review-council pre-flight (CI parity with MegaLinter) found the
troubleshooting list missing a surrounding blank line. Add it.

Found during /uf.review-council pre-flight for PR unbound-force#300.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
- Add CI-011 purpose header to test.yml (sole workflow without one)
- Set persist-credentials: false on checkout so the job token does not
  persist into .git/config for the AI subprocess to read
- Make the skip notice event-aware: genuine fork PRs keep the friendly
  notice; non-fork runs with a missing secret get a ::warning::
  pointing at the secret name and scope
- Assert the coverprofile file exists inside the downloaded artifact
  in the skip step, so every run that reaches the job validates the
  full handoff contract (name, content, and path) — not just the
  artifact name
- Document the optional-threshold omit behavior (unset type: number
  inputs render as empty env vars; explicit 0 stays a live threshold)
- Reword the coverprofile input description to reflect artifact
  extraction rather than the checked-out repository

Found during /uf.review-council for PR unbound-force#300 (iteration 1).

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
- Reconcile the Full Example section: scope the AI-report bullet to the
  example's actual push-only gating with a pointer to the Reusable
  Workflow section for same-repo PR runs; pin [email protected]; fix
  the stale --max-gaze-crapload=5 example value (repo uses 6); frame
  the section as the manual path
- Add a Concurrency section to the Reusable Workflow docs documenting
  the caller-owned policy with gaze's own pattern (CI-012)
- Add a Requirements and limitations section: permission floor
  (contents: read), Go-module-at-root assumption, GitHub-token
  providers cannot work, SHA-pinning option for uses:
- Reword the coverprofile description to match artifact extraction
- Document the coverprofile-file validation and the non-fork
  missing-secret warning in the fork-skip paragraph
- Add a troubleshooting bullet for malformed opencode-config secrets
  (validate strict JSON with jq)
- AGENTS.md: add reusable-gaze-ai-report/ as the active OpenSpec change
  (the two previously listed entries are archived); fix 'install and
  report steps' to 'opencode install and report steps'

Found during /uf.review-council for PR unbound-force#300 (iteration 1).

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
- design.md Risks: provider availability and org-secret integrity now
  gate same-repo PR runs (with per-run LLM cost); dogfood installs the
  released gaze (consumer experience), version defaults are known-good
  floors re-evaluated at release time
- tasks.md: record the CI-012 concurrency amendment to test.yml in the
  section-5 amendment style; extend task 4.5 with the same-repo
  verification steps (threshold-omit report-only mode, breach negative
  check)
- spec.md: 'the opencode install and report steps' precision; the
  fork-skip scenario now includes coverprofile validation
- proposal.md: record the Website Documentation Gate decision
  (satisfied via unbound-force/website#311)

Found during /uf.review-council for PR unbound-force#300 (iteration 1).

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
@jflowers

Copy link
Copy Markdown
Collaborator Author

Addressed in 63b6e96: the AGENTS.md CI/CD section now inventories all workflows under .github/workflows/, including a full description of the Reusable Gaze AI Report workflow (inputs, secret semantics, dogfood job, thresholds), and a reusable-gaze-ai-report: entry was added to Recent Changes. A later pass (e631b1c) also refreshed the OpenSpec tree entry.

@jflowers

Copy link
Copy Markdown
Collaborator Author

Addressed: /uf.review-council was run on the cumulative changes. Iteration 1 returned REQUEST CHANGES; all findings were fixed in 7c949c3, e631b1c, and 0f62758 (workflow hardening, docs reconciliation, spec amendments). Iteration 2 returned APPROVE from all nine seats (adversary, architect, curator, envoy, guard, herald, scribe, sre, testing), with only LOW/informational residuals — all dispositioned via follow-up issues gaze#301 and website#311. No code changes were made after the APPROVE verdict.

@jflowers

Copy link
Copy Markdown
Collaborator Author

Rejected with evidence — tracked as follow-up #301 instead.

  • Gaze never touches the secret: OPENCODE_CONFIG_CONTENT is delivered as an env var and runSubprocess (internal/aireport/adapter.go) never overrides cmd.Env — the config is a pure passthrough to the opencode CLI, with zero references to it anywhere in Go source.
  • A partial mitigation already exists by design: the 512-byte stderr cap (maxAdapterStderrBytes) was added explicitly to bound secret leakage from AI CLI output.
  • The leak requires an unevidenced four-condition chain (opencode-ai echoing config fragments on stderr, within the first 512 bytes, containing the apiKey specifically) — no such behavior has been observed at 1.19.0.
  • Scope/process: the adapter code is pre-existing and untouched by this diff, and design.md lists adapter Go-code changes as an explicit Non-Goal; per the spec-first mandate that work needs its own change.

The one real regression this PR introduces — the single-secret shape means GitHub masks only the full JSON document, not an embedded apiKey substring — is exactly what gaze#301 addresses (adapter-level env-value redaction, plus optional org-level masking registration of the bare key as a second secret).

@jflowers
jflowers merged commit c133b11 into unbound-force:main Oct 19, 2026
6 checks passed
jflowers added a commit that referenced this pull request Oct 19, 2026
The consumer example pinned @v2.2.0, a tag that predates the workflow
file (404 at that ref; Go module proxy immutability prevents
re-tagging). Pin @v2.3.0 — the first release that will ship the
workflow — and add guidance to pin the latest release tag when
adopting.

Addresses PR #300 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
jflowers added a commit that referenced this pull request Oct 19, 2026
Org secrets resolve for pull_request runs from same-repo branches, so
the EnMaaS report and threshold enforcement run on same-repo PRs, not
only push to main. Correct design.md D5, the Risks entry, delta-spec
R4, and the two-step CI description in ci-integration.md to state the
accurate scoping (fork PRs skip via the secret gate).

Addresses PR #300 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
jflowers added a commit that referenced this pull request Oct 19, 2026
The Test workflow (now the first API-spending workflow via the
gaze-ai-report job) lacked a concurrency group (CI-012 [SHOULD]):
overlapping runs on the same ref fired redundant paid LLM reports.
Add a workflow-level group keyed on ref + workflow name with
cancel-in-progress for non-default branches (PR runs cancel on
supersede; main runs queue one in-progress plus one pending so the
post-merge report record is never lost). Workflow-level concurrency
in the workflow_call reusable workflow itself is inert (called
workflows never admit runs), so the reusable workflow instead
documents the contract: concurrency policy is caller-owned.

Addresses PR #300 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
jflowers added a commit that referenced this pull request Oct 19, 2026
The CI/CD section said 'Three GitHub Actions workflows' — stale before
this PR and now missing the reusable gaze AI report workflow. Describe
the actual inventory (Test, MegaLinter, Release, Reusable Gaze AI
Report, fullsend/Prioritize) and add a Recent Changes entry for the
reusable gaze AI report capability.

Addresses PR #300 review feedback from @jflowers.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
jflowers added a commit that referenced this pull request Oct 19, 2026
Review-council pre-flight (CI parity with MegaLinter) found the
troubleshooting list missing a surrounding blank line. Add it.

Found during /uf.review-council pre-flight for PR #300.

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
jflowers added a commit that referenced this pull request Oct 19, 2026
- Add CI-011 purpose header to test.yml (sole workflow without one)
- Set persist-credentials: false on checkout so the job token does not
  persist into .git/config for the AI subprocess to read
- Make the skip notice event-aware: genuine fork PRs keep the friendly
  notice; non-fork runs with a missing secret get a ::warning::
  pointing at the secret name and scope
- Assert the coverprofile file exists inside the downloaded artifact
  in the skip step, so every run that reaches the job validates the
  full handoff contract (name, content, and path) — not just the
  artifact name
- Document the optional-threshold omit behavior (unset type: number
  inputs render as empty env vars; explicit 0 stays a live threshold)
- Reword the coverprofile input description to reflect artifact
  extraction rather than the checked-out repository

Found during /uf.review-council for PR #300 (iteration 1).

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
jflowers added a commit that referenced this pull request Oct 19, 2026
- Reconcile the Full Example section: scope the AI-report bullet to the
  example's actual push-only gating with a pointer to the Reusable
  Workflow section for same-repo PR runs; pin [email protected]; fix
  the stale --max-gaze-crapload=5 example value (repo uses 6); frame
  the section as the manual path
- Add a Concurrency section to the Reusable Workflow docs documenting
  the caller-owned policy with gaze's own pattern (CI-012)
- Add a Requirements and limitations section: permission floor
  (contents: read), Go-module-at-root assumption, GitHub-token
  providers cannot work, SHA-pinning option for uses:
- Reword the coverprofile description to match artifact extraction
- Document the coverprofile-file validation and the non-fork
  missing-secret warning in the fork-skip paragraph
- Add a troubleshooting bullet for malformed opencode-config secrets
  (validate strict JSON with jq)
- AGENTS.md: add reusable-gaze-ai-report/ as the active OpenSpec change
  (the two previously listed entries are archived); fix 'install and
  report steps' to 'opencode install and report steps'

Found during /uf.review-council for PR #300 (iteration 1).

Signed-off-by: Jay Flowers <[email protected]>
Assisted-by: glm
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.

1 participant