Skip to content

e2680802 - Gate github-assignment dispatch behind optional policy.json - #50

Open
Danswar wants to merge 21 commits into
developfrom
e2680802-policy-gate-assigned-dispatch
Open

e2680802 - Gate github-assignment dispatch behind optional policy.json#50
Danswar wants to merge 21 commits into
developfrom
e2680802-policy-gate-assigned-dispatch

Conversation

@Danswar

@Danswar Danswar commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

EN:
dispatch_assigned currently starts a coding session for any GitHub issue assignment matched by watch.json's repo allow-list, with no actor check and no kill switch. jobs.py already has a tested, fail-closed admission function (admits()) built for exactly this shape of check, but nothing called it. This adds an optional policy.json (loaded from AGENT_HOME) consulted via the existing admits() before a session starts; when the file is absent, behavior is unchanged, so no currently-running persona is affected. jobs.py is untouched.

DE:
dispatch_assigned startet aktuell für jede GitHub-Issue-Zuweisung, die von watch.jsons Repo-Allowlist erfasst wird, eine Coding-Session — ohne Actor-Prüfung und ohne Kill-Switch. jobs.py hat bereits eine getestete, fail-closed Admission-Funktion (admits()) genau für diese Art Prüfung, die aber bisher nirgends aufgerufen wird. Dieser PR fügt ein optionales policy.json (aus AGENT_HOME) hinzu, das vor dem Sessionstart über das bestehende admits() geprüft wird; fehlt die Datei, bleibt das Verhalten unverändert — keine aktuell laufende Persona ist betroffen. jobs.py bleibt unangetastet.

Details
  • load_policy(home) — parses AGENT_HOME/policy.json if present, None if absent, raises on invalid JSON.
  • scan_assigned now captures the assigning GitHub user's login (payload["assigned_by"]) from the assigned event's actor.login, since admits() needs an actor.
  • dispatch_assigned evaluates admits(policy, actor=assigned_by, repo=repo, job_type="implement", private=...) before any side effect (workspace files, start, knock, unclaim_wake) and returns "denied" with zero state mutation on refusal, so the same queue head re-evaluates cleanly on the next poll.
  • private is derived from a new repos_private policy list (no live GitHub visibility lookup added).
  • Capability only — no persona's policy.json is added or turned on in this PR.

Danswar and others added 21 commits September 1, 2026 14:56
…g; surface denials from agent watch assigned.
…xed behavior, document the watch-assigned denial print.
…tring reference, and isolate 4 more deny-tests from the private-repo fallback.
… requirements to when a policy is actually active.
…lowing them.

pathlib's is_file/exists/is_symlink catch any OSError internally, not just
FileNotFoundError, so a permission or filesystem error on policy.json read
as "no policy" and silently fail-opened the dispatch gate. Use os.lstat/
os.stat directly, which raise, and add a print-denied regression test for
watch assigned that was missing test coverage.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015feCXyaLpnyhxuygxAPU2h
@Danswar

Danswar commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

Ready for review.

Four lane verdicts, all approved, at head 50c1ed6 (round 23):

  • grok-pr quality: approved, 0 findings
  • grok-pr logic: approved, 0 findings
  • codex-pr quality: approved, 0 findings
  • codex-pr logic: approved, 0 findings

CI (pytest): green at this head. No open review threads or comments. mergeStateStatus: CLEAN.

EN: See PR description for scope. Capability only — the admission gate is wired in and tested, but no persona's policy.json exists yet, so no currently-running persona is affected.

DE: Siehe PR-Beschreibung für den Umfang. Nur die Fähigkeit — das Admission-Gate ist verdrahtet und getestet, aber noch kein policy.json einer Persona existiert, also ist keine aktuell laufende Persona betroffen.

@Danswar
Danswar marked this pull request as ready for review September 2, 2026 01:48
@TaprootFreakAI

Copy link
Copy Markdown
Collaborator

EN:
Recommendation: retain this change, resolve its conflicts with current develop, and rerun tests and the required reviews on the resulting head. Reusing the existing admission policy for GitHub assignments is useful, but the gate remains opt-in: without policy.json, the previous dispatch behavior is preserved.

One behavior needs an explicit product decision before approval: a denied assignment remains at the queue head, so later assignments can be blocked behind it. Confirm that this is the intended operator workflow, or provide an explicit way to skip/quarantine a denied item. The earlier ready comment describes a clean merge state; GitHub now reports conflicts, so that part is stale.

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