Skip to content

feat: automations, approvals, secrets ls, run proposals (Agent Automations Phase 2, 0.1.26) - #43

Merged
sre-helmcode merged 11 commits into
mainfrom
feat/automations-phase2
Oct 11, 2026
Merged

sre-helmcode merged 11 commits into
mainfrom
feat/automations-phase2

Conversation

@sre-helmcode

@sre-helmcode sre-helmcode commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What

Agent Automations Phase 2, task T9 (spec: helmcode/nan-devops AGENT-AUTOMATIONS-PHASE2.md §9.4, §7.6, §11, §13 nan-cli; issue helmcode/nan#163). Version 0.1.26. Do not merge until the Lead says so: merging publishes a release.

New commands:

nan automations ls [--json]
nan automations show <id|name> [--json]
nan automations run <id|name> [--input @FILE | - | JSON] [--detach] [--json] [--idempotency-key K]
nan automations deliveries <id|name> [--limit 50] [--json]
nan approvals ls [--state pending|approved|rejected|expired|cancelled|auto|all] [--limit] [--json]
nan approvals show <run-id> [--diff] [--json]      # same as nan runs proposal
nan secrets ls [--json]                            # names and metadata only; session only
nan runs proposal <run-id> [--diff] [--json]
nan runs reject <run-id> [--reason R] [--json]

Changed: nan runs show shows phase, automation, parent run, approval state and apply runs; nan runs ls --state awaiting_approval; the renderer prints approval_required and action events; awaiting_approval exits 10 (nan run, nan runs logs -f, nan automations run) with the hint nan runs proposal <id>, the portal run link and nan runs reject <id>.

Portal-only (owner decision 10, §11.2): there is no nan runs approve, no nan secrets set/rm, no nan automations create/edit/rm/triggers. Typing any of them exits 64 with where to do it and why (a browser sign-in is required so that nothing that can read the CLI session or a token, such as an agent in a workspace or a CI job, can do it). Help text says the same and links https://nan.builders/docs/runs.

Auth: nan auth login now posts client=cli on the magic-link verify, so the platform records the session as cli (T7). Automations and approvals use the existing precedence (NAN_TOKEN, --token-file, saved token, session, saved sk-); token_scope_denied explains how to get a token with automations:read / automations:run. nan secrets ls always uses the saved session (the platform refuses tokens and sk- keys there) and never sends a token.

Every agent-controlled string (proposal bodies, commit messages, titles, labels, diffstat paths, the diff, delivery ids, names) goes through runs.Sanitize/SanitizeLine; --json goes through SafeJSON.

Wire contract assumed (T6 not merged yet)

Coded against the spec's shapes with httptest mocks: the contract the Lead forwarded to T6: run object adds phase, inference {source} (also reads inference_source), automation {id,name} (also reads automation_id or a bare id), parent_run_id, apply_run_ids, approval (§7.6 object), approval_kinds, github_repo, trigger_depth, secrets [{env,exposure}], result.actions_applied [{kind,ok,ref}]; /v1/approvals items carry the approval fields plus run_state, workspace and automation (objects, or workspace_id/automation_id); automation object is snake_case of automations.Automation; /api/account/secrets errors are {"error":code,"message"}. Portal links: run page /workspaces/<ws>/runs/<run>, approvals inbox https://cloud.nan.builders/automations (to confirm with T8a). If T6 picks other names, this PR follows before release.

Tests

go build ./..., go vet ./..., gofmt -l . clean, go test ./... all pass, govulncheck: no vulnerabilities. New tests: internal/api/automations_test.go, internal/runs/proposal_test.go, cmd/automations_test.go, internal/auth (verify sends client=cli, no flow).

Deploy notes

Release only after the platform side (T6) is deployed with the matching wire names, and before any member can reach awaiting_approval (finding 12).

🤖 Generated with Claude Code

barckcode and others added 11 commits October 11, 2026 15:59
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ecrets

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… awaiting_approval

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…roposal/reject

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fallbacks, actions_applied, run secrets)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge, new); review nits

- approvals inbox: /automations?tab=approvals; automation page: /automations/<id>; new: /automations/new
- nan runs approve|accept names the run and points to its proposal
- not-enabled 404 exits 65, not 64; reject message says automatic actions stay applied
- --input help warns against secrets; exit 10 covered for nan runs logs -f

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copied verbatim from nan-cloud-api feat/automations-http-wiring (bafa111),
internal/handlers/testdata/phase2. No non-test code changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…_from 2, has_diff false)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sre-helmcode
sre-helmcode merged commit 88991a6 into main Oct 11, 2026
5 checks passed
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