feat(agent): maintainer write-actions layer (#778) - #845
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #845 +/- ##
==========================================
+ Coverage 96.60% 96.64% +0.04%
==========================================
Files 101 104 +3
Lines 14295 14411 +116
Branches 5208 5243 +35
==========================================
+ Hits 13810 13928 +118
Misses 105 105
+ Partials 380 378 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
gittensory · advisory review Reviewed 8 changed file(s) — two independent AI reviewers. Changed files: Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · No blocking issues spotted. |
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
Phase 1 payoff: gittensory acts on a PR's STATE (label / request-changes / approve / merge / close) per the repo's autonomy config — never on source. Built on the Phase-0 gates; deny-toward-safety at every step. Layers: - src/github/pr-actions.ts — the GitHub write primitives (review / merge with a head-sha guard / close / comment). Thin installation-scoped REST wrappers. - src/settings/agent-actions.ts — planAgentMaintenanceActions: the PURE, conser- vative verdict→action mapping. Labels by bucket; requests changes on a blocking verdict / approves a passing one (never both, never re-posts the same state); merges only a clean, approved, passing PR; closes only clear noise (high slop / duplicate) on a non-passing verdict (never both merge and close). Ordered least→most irreversible. - src/services/agent-action-executor.ts — the gate stack each action runs before any GitHub call: pause (#776 kill-switch) → approval (auto_with_approval stages for the #779 queue) → write-permission readiness (#775) → mode (dry_run records the intent, only live mutates). Every path writes one agent.action.<class> audit (#776); a failed mutation is recorded as error, never swallowed. - processors.ts maybeRunAgentMaintenance — the trigger: after the gate runs on a PR webhook, recompute the CANONICAL verdict (confirmed-contributor status + persisted slop score — gittensory never acts on a non-confirmed contributor's PR, same rule the gate uses to never block one), plan, and execute. Best-effort; never blocks the gate or public surface. Reuses the autonomy / autoMaintain / agentPaused / agentDryRun config from #773/#774/#776 — no new setting, migration, or config-as-code surface. The auto_with_approval queue UX + notification land in #779. Tests: planner (coherence rules, idempotency, requiresApproval), executor (live per-class + paused + global kill-switch + approval-staged + permission-denied + dry-run + error), primitives (each REST shape), and webhook-trigger integration (blocking verdict acts in dry-run; non-acting / non-confirmed / closed-PR no-op). New modules 100% covered; full suite green (2067).
5acb4fc to
cec8ae9
Compare
Closes #778
What & why
Phase 1 (#769) payoff. gittensory now acts on a PR's state —
label→request-changes→approve→merge→close— per the repo's autonomy config, ordered least → most irreversible. It never touches source. Everything rides the Phase-0 trust scaffolding and is deny-toward-safety.Layers
src/github/pr-actions.ts— the GitHub write primitives:createPullRequestReview(request-changes/approve),mergePullRequest(with a head-SHA guard so a PR that moved under us fails the merge),closePullRequest,createIssueComment. Thin installation-scoped REST wrappers, mirroringlabels.ts.src/settings/agent-actions.ts—planAgentMaintenanceActions: the pure, deterministic verdict→action mapping. Conservative by design:src/services/agent-action-executor.ts— the gate stack each action passes before any GitHub call:pause (#776 kill-switch)→approval (auto_with_approval → staged for the #779 queue)→write-permission readiness (#775)→mode. Onlylivemutates;dry_runrecords the intent. Every path writes oneagent.action.<class>audit (feat(agent): action audit log + kill-switch + dry-run/shadow mode #776); a failed mutation is recorded aserror, never swallowed.processors.tsmaybeRunAgentMaintenance— the trigger. After the gate runs on a PR webhook, it recomputes the canonical verdict (confirmed-contributor status + the persisted slop score) and runs the plan through the executor. gittensory never acts on a non-confirmed contributor's PR — the same rule the gate uses to never block one. Best-effort: a failure here never affects the gate or public surface.Safety
auto/auto_with_approval); everything else isobserve.agentDryRunto watch the audit feed before going live.auto_with_approvalactions are staged, not executed (the approval queue + notifications land in feat(agent): approval-queue UX + notification channel #779).Scope
Reuses the
autonomy/autoMaintain/agentPaused/agentDryRunconfig from #773/#774/#776 — no new setting, migration, or config-as-code surface.Tests
Planner (coherence rules, idempotency,
requiresApproval, ordering), executor (live per-class, paused, global kill-switch, approval-staged, permission-denied re-consent, dry-run, error capture, defensive defaults), primitives (each REST shape + sparse-response defaults), and webhook-trigger integration (blocking verdict acts in dry-run; non-acting / non-confirmed / closed-PR / no-stale all no-op). New modules 100% covered (statements + branches); full suite green (2067 passed).