Commit graph

2,176 commits

Author SHA1 Message Date
iris
2bfa5bc1a8 feat(schedules): make schedules pausable
Adds pause/resume support for scheduled prompts.

Backend:
- New paused_at_unix column on scheduled_prompts table (added via
  ALTER TABLE migration so existing databases are upgraded on first
  start). The due-rows index is dropped and recreated to also exclude
  paused rows so the worker never fires them while paused.
- Worker's due() query gains AND paused_at_unix IS NULL filter.
- New pause(id) and resume(id) methods on ScheduledPrompts; both are
  idempotent and refuse cancelled rows.
- New POST /api/schedules/{id}/pause and /api/schedules/{id}/resume
  dashboard endpoints (operator-direct, no approval gate). Both emit
  a schedules snapshot on success so the tab updates live.
- WireSchedule gains paused_at_unix: Option<i64> so the frontend can
  render the state without an extra fetch.

Frontend:
- Paused rows render with a distinct row class + muted opacity.
- The next-fire cell shows a yellow pause glyph + tooltip with the
  paused-since timestamp and the would-have-fired time.
- Actions column: pause/resume toggle button (⏸/▶) beside fire/edit/cancel.
  Fire-now is disabled while paused (resume first).
- Sort order: active → paused → cancelled (paused slot keeps schedules
  visible without mixing them into the active top section).
- pauseSchedule() / resumeSchedule() async functions POST to the new
  endpoints and refresh the table on success.
2026-06-27 20:01:16 +02:00
atlas
3fedc102cc refactor(#2051): fold body-return into forge_http instead of a near-copy
Per review: rather than adding forge_http_full (a near-duplicate of
forge_http), change forge_http itself to return (StatusCode, String).
Status-only callers bind (status, _); the branch-protection verify path
uses the body to log the real Forgejo rejection reason. Updates all call
sites accordingly.
2026-06-27 19:52:14 +02:00
atlas
512e9ff09f fix(#2051): verify config-repo branch protection actually applied
apply_config_repo_branch_protection treated 200/409/422 from the
create-branch-protection POST all as success. But a 422 means Forgejo
*rejected* the request and created no rule — so a rejected POST silently
left the agent's config repo unprotected, with nothing logged (a new
agent's config repo was found with no main-branch protection and no
trace of why).

Don't trust the status code:
- On any non-201, GET the single .../branch_protections/main rule and
  only treat it as success if the rule is actually present.
- Otherwise return Err carrying the POST's response body, so the real
  Forgejo rejection reason lands in the host journal. (forge_http
  discarded the body; added forge_http_full that returns it.)

ensure_config_repo runs on every sync_agent sweep (startup + each
rebuild), so a now-Err result is logged and retried next sweep —
self-healing once a real cause is fixed. Net: the failure is loud +
retried instead of silently swallowed.

nix fmt clean.
2026-06-27 19:52:14 +02:00
iris
31433da3aa fix(permissions): propagate I/O errors as 500 from delete_agent_permissions
Both remove_agent() calls now run unconditionally for maximum partial
cleanup, but any I/O error is returned as HTTP 500 instead of silently
200-ing — so the frontend's !resp.ok path fires and the operator sees a
meaningful error rather than the stale row reappearing unchanged.

Also add a clarifying comment on isStale in permissions.js explaining
that containersState is keyed from nixos-container list (which includes
stopped-but-configured containers), so a temporarily-stopped agent is
not treated as stale — only destroyed/renamed agents are absent.
2026-06-27 13:44:11 +02:00
iris
a8fb33e2ee fix(permissions): mark stale agents and allow removing their explicit entries
The P3RM1SS10NS tab showed agents that no longer exist in the live
container roster — e.g. an agent named 'root' that was renamed or
destroyed but still had explicit entries in tool-groups.json and/or
capabilities.json. The roster-union behaviour is intentional for
temporarily-stopped agents, but stale entries from renamed/destroyed
agents are confusing.

Backend (dashboard/permissions.rs):
- New DELETE /api/permissions/{agent} handler that bypasses the live-
  roster guard (intentionally — that's the point). Calls
  tool_groups::remove_agent + capabilities::remove_agent to clear both
  JSON files, then emits live SSE snapshots so the tab updates without
  a page reload. Format-checks the agent name but does not require it to
  be in the containers snapshot.

Frontend (permissions.js):
- renderCapabilities / renderToolGroups now cross-reference agentNames
  against containersState (the live roster, already imported). Agents
  not in the live roster get an isStale flag.
- Stale rows get a '(not running)' label and a '✕ remove' button that
  calls clearStaleAgent() — a new async helper that DELETEs the stale
  entry and re-fetches both perm tables.
- Non-stale agents without explicit assignments still get '(default)'.

CSS (dashboard.css):
- .perm-row-stale (reduced opacity), .perm-stale-label (muted small
  text), .perm-remove-btn (small red-bordered button) + disabled state.
2026-06-27 13:44:11 +02:00
damocles
f060456860 feat(#2024): add /effort terminal slash command 2026-06-27 13:35:14 +02:00
iris
145f58b0b1 fix(core): add rebuild-live-log class to live-log container div
The CSS for the rebuild-queue live-log panel targets .rebuild-live-log
(border, border-radius, margin-top, background) but the HTML element only
had id="rebuild-live-log" — no class. As a result the panel box styles
never applied and the live log rendered unstyled (no border, no background,
no visual separation from the queue rows).

Fix: add class="rebuild-live-log" to the element so the CSS selector
matches.
2026-06-27 13:28:23 +02:00
iris
c65201ed7c fix(dashboard): render update_meta_inputs + schedule_prompt approval cards
Both kinds fell through to the spawn branch in renderApprovals, showing
a misleading 'spawn' chip and agent-spawn body text. Mara saw a meta-input
bump render as a spawn card for agent damocles and denied it.

Backend (dashboard.rs):
- Add commit_ref: None to the MergeConfigPr arm (struct was incomplete).
  All arms of ApprovalView now initialise every field.

Frontend (call.js):
- Add isUpdateMeta / isSchedule booleans alongside the existing kind flags.
- Glyph: update_meta_inputs gets ↻, schedule_prompt gets ⏱.
- Kind chip: 'meta-update' / 'schedule' (no kind-spawn class for either).
- Body: update_meta_inputs parses commit_ref as JSON Vec<String> and shows
  'bump flake inputs: foo, bar' or 'bump all flake inputs'; schedule_prompt
  parses SchedulePromptPayload and shows targets + first-fire time + cadence
  + a truncated body excerpt.
- History row: add 'meta-update' and 'schedule' cases (were both 'spawn').
- Import fmtDuration from util.js (needed for schedule cadence display).
2026-06-27 13:03:41 +02:00
damocles
5972605aeb feat(#2039): drop is_primary from get_agent_meta matrix identities 2026-06-27 12:43:22 +02:00
damocles
5b442796ca feat(#2039): list matrix identities in get_agent_meta 2026-06-27 12:43:22 +02:00
damocles
52de0ca648 feat(#2038): hint matrix bridge errors may be a daemon restart 2026-06-27 11:46:47 +02:00
damocles
f477a2f901 feat(#2039): require explicit account when multiple matrix accounts configured 2026-06-27 11:45:57 +02:00
damocles
e349416d1a fix(#2031): use Duration::from_hours(1) for clippy duration-suboptimal-units 2026-06-27 10:14:47 +02:00
damocles
601ed2429d fix(#2031): backtick paths in vacuum doc comments for clippy doc-markdown 2026-06-27 10:14:47 +02:00
damocles
49fc61212b fix(#2031): move bash-tasks + events vacuum agent-side (privsep ownership) 2026-06-27 10:14:47 +02:00
damocles
09603b77b9 feat(#2006): rename manageRootAgent option to ruthless (invert sense) 2026-06-27 00:37:32 +02:00
damocles
4fa17de387 feat(#2006): add services.hyperhive.manageRootAgent to opt out of root-agent auto-management 2026-06-27 00:37:32 +02:00
damocles
8aba2e5509 fix(#2033): drop tracker tag from code comment (tracker-tag lint) 2026-06-27 00:33:58 +02:00
damocles
652acf8c6e fix(#2033): gate matrix mcp bridge startup on token, not daemon socket 2026-06-27 00:33:58 +02:00
damocles
3b0a914487 feat(#2035): auto-discover dashboard-provisioned matrix accounts via token+homeserver sidecar 2026-06-27 00:30:04 +02:00
damocles
cc73bc7cd0 fix(#2030): point pending-login warning at the dashboard, not a nonexistent hivectl login verb 2026-06-27 00:26:06 +02:00
damocles
afa07d5fc1 fix(#2014): add serde skip_serializing_if to HiveUrls option fields 2026-06-27 00:21:50 +02:00
damocles
cae1dd8147 feat(#2014): hivectl open verb + Urls host request for web surfaces 2026-06-27 00:21:50 +02:00
damocles
c2ba841932 docs(turn-loop): present managed-settings as current state, drop changelog phrasing 2026-06-26 23:06:04 +02:00
damocles
b231ed2392 feat(#1969): ship claude settings via /etc/claude-code/managed-settings.json 2026-06-26 23:06:04 +02:00
damocles
70d1cdc859 feat(#2017): add hivectl agents list verb showing agent status + technical state 2026-06-26 22:28:23 +02:00
damocles
4407967a2f fix(#2018): reword tracker tag in agent_exists doc comment to prose (tracker-tag lint) 2026-06-26 22:13:52 +02:00
damocles
49067ad83e fix(#2018): surface permission error in hivectl agent lookup instead of misleading 'no such agent' 2026-06-26 22:00:13 +02:00
damocles
b0c89af817 chore(#1931): remove non-working hivectl migrate-stats verb 2026-06-26 18:06:46 +02:00
damocles
0d17ae69f4 docs: drop stale 'required infrastructure' framing from ensure_root_agent 2026-06-26 17:42:28 +02:00
damocles
c16eff0d5c fix(#2003): reword root auto-start comment (not 'required infra'; opt-out is a separate host setting) 2026-06-26 17:42:28 +02:00
damocles
916c0b11c5 fix(#2003): drop issue tag from inline comment (tracker-tag lint) 2026-06-26 17:42:28 +02:00
damocles
2cd089b65f fix(#2003): start root container if present-but-stopped on hive-c0re boot 2026-06-26 17:42:28 +02:00
damocles
ad8ed452fd fix(#2002): mkdir container /etc before writing bridge-DNS marker (fresh install) 2026-06-26 17:27:05 +02:00
atlas
8e366c8a10 docs(security): operator-merge IS enforced on the internal forge
Per mara (verified in forge.rs): agents have max_repo_creation=0, so every
internal-forge repo is core-created with branch protection on by default
(merge restricted to operators team + required operators-team approval via
apply_operator_branch_protection / the config-repo equivalent), and agents
(write collaborators, not admins) can't change it or self-merge. So it's
technically enforced there, not just convention — only external VCS (GitHub)
is unprotected. Corrects my prior over-correction.
2026-06-26 17:19:35 +02:00
atlas
524b1de98c docs(security): correct the operator-merge bullet (mara review)
Per mara: branch protection isn't a blanket enforced check, and it's not
set up for external VCS (GitHub). Reframe the bullet as the operator-merge
*convention* — technically enforced only on the core-managed config repos,
and explicitly NOT wired up for GitHub/external VCS (process + accepted
risk there, not a control).
2026-06-26 17:19:35 +02:00
atlas
9daed8acc1 docs(security): restore the State-file endpoint heading
The trust-model insert accidentally consumed the
'## State-file endpoint security model' heading, leaving that section
floating under the new one. Re-add the heading and collapse the extra
blank lines (argus review).
2026-06-26 17:19:35 +02:00
atlas
cf581d14b8 docs(security): document the agent trust model
Add an 'Agent trust model' framing section at the top of docs/security.md
covering the conceptual model the existing mechanism-level sections serve:

- trust boundary = the container, not credential storage (agents have
  passwordless sudo by default; isolating creds from the agent itself is
  not a goal — cross-tenant leakage is)
- scoped per-agent forge/matrix tokens bound the blast radius
- threat model: prompt injection -> confused deputy (untrusted input is
  the adversary; the agent + its tools are trusted)
- branch protection (agents push, operator merges) as the human-in-loop
  checkpoint, incl. external VCS
- capability = accepted risk ('don't grant what you can't afford to lose')
- no auto-sandboxing of external tokens (operator-accepted scope)

Emerged from the 2026-06-24 security discussion. Updates the CLAUDE.md
pointer for findability.
2026-06-26 17:19:35 +02:00
damocles
09dc3682d7 fix(#1995): send {} body on schedule cancel-all (was empty body 400) 2026-06-26 01:23:06 +02:00
damocles
eba637b36c docs(#1990): fix for_agent ordering doc + add # errors (argus review) 2026-06-26 01:22:20 +02:00
damocles
49db9d6e1c feat(#1990): surface pending recv() message count in get_loose_ends 2026-06-26 01:22:20 +02:00
damocles
678f50f3fb docs(#1989): add # errors doc to rebuild_agent + rebuild (argus review) 2026-06-25 23:59:54 +02:00
damocles
1f0cc010ad fix(#1989): don't relock on meta-update cascade rebuilds (was reverting the bump) 2026-06-25 00:36:52 +02:00
damocles
527dff0200 feat(#1985): add # Errors doc to subscription run (argus review) 2026-06-25 00:09:16 +02:00
damocles
fce9bb8c11 feat(#1985): subscription --list to audit watched repos 2026-06-25 00:09:16 +02:00
damocles
9f40bd13f9 fix(#1896): remove dead forge_notify reason drop-list + auto-unsubscribe 2026-06-24 23:07:48 +02:00
damocles
ca44fd56df fix(#1896): drop self-authored issue/pr creation wakes in forge_notify 2026-06-24 22:19:32 +02:00
damocles
c68706e899 fix(#1982): migrate-stats tolerates pre-session_id dbs + skips failed agents 2026-06-24 21:33:25 +02:00
damocles
a94fb9955f fix(#1974): pair token cols by array position (argus review) 2026-06-24 21:17:42 +02:00
damocles
5393f0e7d4 feat(#1974): migrate-stats — add session.id/start_type/terminal.type + session.count (review) 2026-06-24 21:15:30 +02:00