feat(addie): secretariat console — human-approved action queue, executor, and admin page - #6064
Open
bokelley wants to merge 1 commit into
Open
feat(addie): secretariat console — human-approved action queue, executor, and admin page#6064bokelley wants to merge 1 commit into
bokelley wants to merge 1 commit into
Conversation
…tor, PR shepherd, admin page Stage A of the Secretariat console (specs/spec-guardian.md): every action the Secretariat wants to take becomes a proposed row a human approves in /admin/secretariat before a worker job executes it as aao-secretariat[bot]. - Migration 528: secretariat_actions with an application-enforced state machine (proposed -> approved -> executing -> done | rejected | failed -> proposed via retry), every transition an atomic UPDATE ... WHERE status = '<from>'. - Executor (2-min tick): kind allowlist (open_pr, post_issue_comment, file_issue, post_slack_message); unknown kinds fail closed; never calls PR-merge or PR-review endpoints. - PR shepherd (hourly): proposes friendly IPR-signature nudges for PRs pending >7 days, dedupe-keyed to one nudge per PR; proposes only. - github-pr.ts refactored into shared internals with multi-file upsertFilesPr (single-file API preserved); postIssueComment added on the filer's auth/timeout/redaction pattern. - Admin routes (all requireAuth+requireAdmin): list/get/approve/reject/ edit/retry/enqueue + watching snapshot + per-kind approved-without-edit stats. Admin page builds all dynamic DOM via textContent helpers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
The automated review encountered an issue (possibly reached max turns, timed out, or failed to post the final gh pr review). A human reviewer should take this PR.
This is an automated message from the Argus AI review workflow.
Contributor
There was a problem hiding this comment.
The automated review encountered an issue (possibly reached max turns, timed out, or failed to post the final gh pr review). A human reviewer should take this PR.
This is an automated message from the Argus AI review workflow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stage A of the Secretariat console (
specs/spec-guardian.md): the operating surface where humans watch and approve everything the AAO Secretariat wants to do. Every intended action becomes a proposed row — nothing executes until an admin approves it at/admin/secretariat; approved actions are executed by a worker job asaao-secretariat[bot].What's in it
secretariat_actions: kind, title, rationale (with evidence links), JSONB payload, dedupe key, edited flag, result/error, decided_by/at. State machineproposed → approved → executing → done(plusrejected, andfailed → proposedvia retry), every transition an atomicUPDATE … WHERE status = '<from>'so nothing double-executes. (Builder originally picked 524; renumbered after verifying main had advanced to 527.)open_pr,post_issue_comment,file_issue,post_slack_message); unknown kinds fail closed; hard rule enforced in code and comments: never calls PR-merge or PR-review endpoints. Executes through the existing Secretariat seams (resolveGitHubToken()→ App token).github-pr.tsrefactored into shared internals with a multi-fileupsertFilesPr(single-file API preserved — the digest job keeps working; multi-file PUT stops at first failure with no orphan PR).postIssueCommentadded on the filer's auth/timeout/secret-redaction pattern.requireAuth + requireAdmin: list/get, approve, reject (reason required), edit-payload (proposed only, setseditedfor the autonomy stats), retry, manual enqueue (kind-validated),/watching(open PRs +needs-wg-reviewqueue snapshot, 5-min cache),/stats(per-kind approved-without-edit rate — the evidence feed for future autonomy toggles)./admin/secretariat: Watching / Proposed inbox (full draft previews) / In-flight / Done+Failed. All dynamic DOM built viatextContenthelpers; the 13innerHTMLuses are container-clears only. Design-system variables, sentence case. Sidebar link added.Safety posture
Nothing self-executes: rows are born
proposedand only a human admin can move them toapproved. The executor's allowlist is the single source (ALLOWED_KINDS), reused by the enqueue route's validation. Merge/review/approve of PRs is structurally outside the action vocabulary. Failed actions surface with errors and require explicit human retry.Test plan
tsc --noEmitclean; full precommit suite passed on commit; branch rebased onto current main./admin/secretariatloads; seed the two Docket Welcome to adcp Discussions! #1 docs-PR actions via the enqueue endpoint; approve; verify both PRs open asaao-secretariat[bot].Implementation by a Sonnet subagent; reviewed by the session orchestrator (migration numbering, state-machine atomicity, executor allowlist, route auth, XSS posture). No changeset — Addie server work.
🤖 Generated with Claude Code