Conversation
This comment was marked as duplicate.
This comment was marked as duplicate.
Skull-boy
left a comment
There was a problem hiding this comment.
Hey @ghzhost — good work overall, the structure is clean.
One failing check to fix before we merge.
Root cause
Fork PRs trigger with a read-only GITHUB_TOKEN by default —
GitHub blocks write operations (like posting comments) from fork
contexts for security reasons. The 403 you're seeing is that restriction.
Fix — split into two workflows
The clean pattern for this is separating validation from commenting:
-
Workflow 1 (
validate-contracts.yml) — triggers onpull_request,
runs validation, saves the report as an artifact. Read-only,
always works on forks. -
Workflow 2 (
post-validation-comment.yml) — triggers on
workflow_run(when Workflow 1 completes), downloads the artifact,
posts the comment. Runs in repo context so it has write permission.
# post-validation-comment.yml
on:
workflow_run:
workflows: ["Validate Agent Contracts"]
types: [completed]
permissions:
pull-requests: write
jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: pr-report
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const body = fs.readFileSync('pr_report.md', 'utf8');
const pr = ${{ github.event.workflow_run.pull_requests[0].number }};
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr,
body
});Separate issue — contract.yml naming
The validator itself flagged .github/workflows/validate-contracts.yml
as using contract.yml instead of contract.yaml. Rename that file
to comply with the spec. Good proof the agent works — it caught
its own contributor's naming error.
62/62 tests passing is great. Once the workflow split is done this
is ready to merge.
Overview
Closes #33.
Implements the Contract Validator GitHub Action as the first live governed agent running directly in this repository.
Key Deliverables:
.github/agents/contract-validator/contract.yaml:github:pull-requests:read,github:pull-requests:write).request-response,stateless..github/agents/contract-validator/README.md:.github/workflows/validate-contracts.yml:validate-pr-contractsjob that triggers on PRs, detects modified.yamlfiles, validates them withscyvera.validate_contract(), and posts/updates an advisory feedback comment on the PR.scripts/validate_pr_contracts.py&tests/test_pr_validator.py:Validation:
pytest -v(62/62 tests passing).scyvera validate .github/agents/contract-validator/contract.yamlandscyvera lint.