Skip to content

feat(ci): stage catalog sync and auto-fix with review skill - #825

Open
Yimin-Jin wants to merge 15 commits into
template/devfrom
yimin/review-sample-catalog-skill
Open

Yimin-Jin wants to merge 15 commits into
template/devfrom
yimin/review-sample-catalog-skill

Conversation

@Yimin-Jin

@Yimin-Jin Yimin-Jin commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Expose seven dependent jobs in the Actions graph: scan -> metadata -> grouping -> Details -> write/validate -> Draft PR -> AI review. A reusable stage workflow shares setup for the three generation jobs.

  • Pass state and candidate catalog through run/attempt-scoped artifacts; pin every checkout to the workflow SHA. Publish and review create separate short-lived App tokens; no credentials cross job outputs or artifacts.

  • Automatically apply bounded prose corrections: at most two repair passes and one fresh final verification; unresolved findings fail the workflow while preserving the Draft PR. No manual corrections are required on the successful path, and approval/merge remain human-controlled.

  • Run pinned Copilot CLI 1.0.88 in a read-only, network-isolated container with only view/grep/glob/skill tools. The host retains GitHub/Azure credentials and exposes only a bounded inference proxy.

  • Validate field scope, pinned-source line references, catalog invariants, and trusted tests before appending a commit parented to the captured PR head with a non-force ref update. Refuse reruns that would overwrite an existing run branch.

  • Give the reviewer explicit mounted source paths and line markers. Trusted code resolves path/startLine/endLine references to exact original text; copied quotations are no longer required.

  • Persist raw answers, parsed patches, resolved evidence and validation errors before deciding whether to proceed. Rejected patches leave the candidate unchanged and receive specific feedback within the same three-attempt limit. Corrections require a fresh independent clean pass; service/time/budget failures do not start extra recovery calls.

  • Use the same review-sample-catalog skill for CI and maintainer review. The catalog snapshot itself is unchanged.

  • Supply only affected cards and all their member templates to the model; trusted code still validates the full catalog. Stop forwarding retries after reported token exhaustion.

  • Pin all 19 external action usages across both catalog workflows to verified immutable commit SHAs.

  • Protect templateSelection, dimension identities/labels/placeholders and retained option metadata/order; allow only options corresponding to actual template values.

Validation

Review Disposition

  • All five review threads have been answered and resolved. Action mutability and picker metadata were fixed in 1da714f; surviving card identity/ownership was fixed in 2076a55 with four additional regression cases.
  • The dispatch-ref comment was re-evaluated with the owner against the pre-existing maintainer trust model: manual dispatch requires write access, and the base workflow already ran code from the maintainer-selected ref with the same Repository secrets. Writers authorized to edit/dispatch workflows are trusted; unreviewed external refs must not be dispatched.
  • Commit 1a2185e removes the added Environment dependency, restores explicit model-secret forwarding, and documents assumptions in .github/workflows/README.md. github.sha pins execution for reproducibility; it does NOT isolate credentials from malicious write-authorized maintainers. A stronger repository-wide policy remains a separate hardening decision, not a security guarantee claimed by this PR.
  • Existing shared Repository secrets were not modified or deleted. The experimental catalog-sync Environment and its three Azure secrets remain configured but are not referenced by these workflows; no migration is required.
  • Resolving the discussion records this scoped owner-confirmed disposition, not completion of the abandoned migration. Human approval is still required; no review approval or merge was automated.

Guardrails

  • No agent shell, edits, GitHub tools, source execution, or raw write credentials.
  • Maximum three agent passes, 40 model requests per pass and a 300k reported-token stop threshold (one in-flight response may cross it; subsequent retries are rejected), 16k output tokens/request, 12 minutes/pass.
  • Only affected card prose and new template name/description may change; existing identities, membership, Patterns and unaffected metadata/Details are protected.
  • Evidence-reference validation is deterministic, but semantic judgment remains model-based; blocked reports must never be treated as approval.

Add an on-demand repository skill for the agreed CI-generated Draft PR followed by human-led AI review. Define snapshot and structural checks, per-implementation semantic standards, minimal authorized data fixes, validation and release-promotion boundaries. Reference current code rather than hard-coded counts or versions; do not change the sync workflow.
Split incremental generation into resumable stages and append a sandboxed Copilot skill review to the same Draft PR workflow. Keep repository and model credentials outside the agent, constrain prose patches and pinned-source evidence, and publish via non-force Git ref updates after trusted validation. Add offline container smoke coverage and 123 passing regression tests.
@Yimin-Jin Yimin-Jin changed the title docs(skills): define source-grounded sample catalog review feat(ci): stage catalog sync and auto-fix with review skill Sep 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Critical credentialed-workflow trust-boundary issues and moderate validation/reproducibility issues remain unresolved.

Review effort: Lite
Findings: 3 High severity · 1 Medium severity

Open (4)
What changed in this PR

Stages sample-catalog synchronization into dependent CI jobs and adds bounded, sandboxed AI review and correction.

Changes:

  • Split synchronization into seven artifact-backed stages.
  • Added evidence validation, recovery handling, and regression tests.
  • Added isolated Copilot review with human-controlled approval and merging.
File Summary
.github/​workflows/​sync-sample-catalog.yml Orchestrates staged synchronization; critical findings concern mutable action tags, untrusted dispatch revisions, and moderate artifact naming on reruns.
.github/​workflows/​catalog-sync-stage.yml Reusable credentialed workflow; critical finding: actions are tag-pinned instead of immutable SHAs.
.github/​skills/​review-sample-catalog/​SKILL.md Defines review and correction contracts.
.github/​scripts/​sample_catalog_cards.test.mjs Adds staged-sync and review safeguard tests.
.github/​scripts/​review_catalog_pr.mjs Validates evidence and corrections; moderate findings concern protected metadata scope and template path grammar.
.github/​scripts/​generate_sample_catalog.mjs Implements resumable staged catalog generation.
.github/​scripts/​catalog-review.Dockerfile Defines the review container; moderate finding: build dependencies and npm artifacts are not fully immutable.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .github/workflows/catalog-sync-stage.yml
Comment thread .github/workflows/sync-sample-catalog.yml
Comment thread .github/workflows/sync-sample-catalog.yml Outdated
Comment thread .github/scripts/review_catalog_pr.mjs

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Unresolved scope-validation, recovery, artifact, and dependency-pinning issues remain.

Review effort: Lite
Findings: 2 High severity

Open (2)
Resolved since last review (3)
Previously missed (4)

In code that hasn't changed since last review

Medium severity commitSha is not constrained to template-path changes

.github/​scripts/​review_catalog_pr.mjs:36

The review scope never constrains commitSha to the template-path diff. A candidate with unchanged templates can replace it with any valid SHA and still pass; collectSources will then fetch evidence from that different revision, violating the catalog contract that the source revision advances only when templates are added or removed. Compare the base and candidate template-path sets and require the SHA to change iff that set changes.

Medium severity Review coverage omits existing card members

.github/​scripts/​review_catalog_pr.mjs:95

The review contract asks the agent to review every current member of each affected card, but this guard only requires the newly added templates in scope.templates; reviewedTemplates may omit all existing members and still pass with an empty patch and no findings. That allows a clean review to be accepted without coverage of the variants whose Details are being relied on. Require the reviewed-template set to equal the supplied member set (or otherwise validate coverage for every member of each affected card).

Medium severity Recovery validation can clear unresolved findings

.github/​scripts/​review_catalog_pr.mjs:181

When a valid pass reports unresolved factual findings and the next recovery response is rejected, this assignment replaces the feedback with only the validation error and drops the earlier unresolved list. The final pass can then return an empty report without seeing those blockers, and report.unresolved is overwritten with the empty list. Preserve any prior unresolved findings when adding validation feedback so recovery cannot silently clear them.

Medium severity Review report artifact name is not unique per attempt

.github/​workflows/​sync-sample-catalog.yml:432

Unlike the state and catalog artifacts above, this artifact name is not scoped by github.run_id and github.run_attempt. A rerun can reuse the existing catalog-review name, and immutable v4 artifact uploads then fail in the always() reporting step, losing the report for that attempt. Scope the name consistently so each review attempt can publish its own report.

Comment thread .github/scripts/review_catalog_pr.mjs

This branch had an error being deployed

1 failed (outdated) deployment
catalog-sync — c8eed100 Deployed Sep 28, 2026 by Yimin-Jin via 2. Generate template metadata / metadata #104
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.

2 participants