Skip to content

Keep audit-only Agent Law provisioner runs green#48

Merged
simongonzalezdc merged 1 commit into
mainfrom
codex/fix-agent-law-provisioner-audit-status
May 21, 2026
Merged

Keep audit-only Agent Law provisioner runs green#48
simongonzalezdc merged 1 commit into
mainfrom
codex/fix-agent-law-provisioner-audit-status

Conversation

@simongonzalezdc
Copy link
Copy Markdown
Member

@simongonzalezdc simongonzalezdc commented May 21, 2026

Summary

Fix the Agent Law provisioner so scheduled audit-only runs report missing admin-org scope as skipped:* instead of failing the default branch.

Why

The workflow already downgrades to audit-only when AGENT_LAW_ADMIN_TOKEN is absent. The script still returned exit 2 for the expected org-ruleset admin-scope check, creating noisy default-branch failures even though no write operation was attempted.

Verification

  • python3 -m py_compile scripts/provision-agent-law.py
  • git diff --check
  • python3 scripts/provision-agent-law.py --owner KyaniteLabs --ensure-org-ruleset --ensure-repo-rulesets --repair-files exited 0 and reported KyaniteLabs org-ruleset skipped:admin-org-scope-required

Constraint: scheduled audit-only runs use a repo-scoped token when AGENT_LAW_ADMIN_TOKEN is not configured.
Rejected: keep failing audit-only runs for expected missing admin scope | it burns attention without representing a failed write.
Confidence: high
Scope-risk: narrow
Directive: admin-scope failures must remain blocking when --apply is used.
Tested: py_compile; git diff --check; exact audit-only provisioner command exited 0.
Not-tested: scheduled GitHub Actions run after merge.


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

Constraint: Scheduled Agent Law provisioner runs without AGENT_LAW_ADMIN_TOKEN intentionally run audit-only with the repo-scoped token.\nRejected: Treat expected missing admin scope as a hard failure in audit-only mode | it creates noisy default-branch failures while no write was attempted.\nConfidence: high\nScope-risk: narrow\nDirective: Continue treating admin-scope failures as blocking when --apply is used; audit-only should report skipped scope, not fail.\nTested: python3 -m py_compile scripts/provision-agent-law.py; git diff --check; python3 scripts/provision-agent-law.py --owner KyaniteLabs --ensure-org-ruleset --ensure-repo-rulesets --repair-files exited 0\nNot-tested: Scheduled GitHub Actions run after merge.
@simongonzalezdc simongonzalezdc merged commit 0b04581 into main May 21, 2026
1 check passed
@simongonzalezdc simongonzalezdc deleted the codex/fix-agent-law-provisioner-audit-status branch May 21, 2026 03:39
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cc56ce0935

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +166 to +167
if not apply:
return "skipped:admin-org-scope-required"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Only skip dry-run when permission failure is confirmed

In scripts/provision-agent-law.py (checked alongside .github/workflows/agent-law-provisioner.yml), this dry-run branch now converts any gh api failure into skipped:admin-org-scope-required; because main() only exits non-zero for blocked:* statuses, transient API/network/auth failures in scheduled audits will be silently reported as success instead of surfacing a broken audit. This should only downgrade known permission-denied cases (and keep other non-zero outcomes blocked), and the same broad downgrade pattern appears in ensure_repo_ruleset as well.

Useful? React with 👍 / 👎.

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