Commit graph hyperhive/hive-agent
Author SHA1 Message Date
damocles
8ffc22eaea fix hint text per argus review: group into subdirs, not split into more top-level files
argus caught that the previous wording ("splitting a long-lived file
into dated pieces") suggested a remedy that increases top-level entry
count unless the pieces land in a subdirectory - wrong advice for the
exact metric this watch counts.

Also added mara's ask: explicitly note the agent can leave the todo
open and act on it later, no pressure to resolve immediately.
2026-08-18 22:07:05 +02:00
damocles
301a576feb hive-agent: no-pressure hint when state dir top level hits 30+ entries
New state_entry_watch.rs, mirroring disk_watch.rs's shape exactly:
periodic in-process probe, Todos::upsert with a stable count-bucketed
summary (anti-nag - drifting inside one bucket stays silent, crossing
a bucket speaks up again), clears once back under threshold.

Top-level entry count only, deliberately - a large subdirectory (git
clone, build tree) counts as one entry regardless of what's inside it,
which is disk_watch's problem to catch on its own axis (bytes), not
this one's.

Wired into main.rs's spawn_todo_socket alongside disk_watch::run.

closes #3464
2026-08-18 22:07:05 +02:00
iris
85ef5e5fbe hive-agent: show mark_todos_done ids in the terminal, not just a count
fmt_args_generic's generic array handling collapsed `ids: [4]` — the
count — since mark_todos_done had no dedicated match arm. Added one,
matching the file's existing per-tool pattern (extracted into its own
helper to stay under the 100-line clippy limit on fmt_hyperhive_tool).
2026-08-16 15:45:05 +02:00
damocles
f37ef7fa97 hive-agent: remove dead bash-task- wake_from special-case
The #2595 job-queue rework replaced hive-bash-mcp's direct broker send
with a todo push through the in-agent socket, so a bash-task-driven
turn now wakes with from == "todo", never "bash-task-<id>". This
branch has had nothing to match since, so it silently bucketed no
turns under the bash-task label; removed rather than left dead.

Closes #2256.
2026-08-14 12:09:02 +02:00
atlas
be3411e180 feat(#3245): gate rustdoc in nix flake check, and clear the workspace
Nothing in the gate read doc-comments: clippy doesn't check intra-doc
links, cargo test doesn't, and no check built docs. So a [`Foo`] pointing
at a renamed, moved or deleted item rendered as plain text and had no
discoverer but a human happening to read the comment.

That matters here more than in most repos, because the convention is to
put a thing's authoritative description in one doc-comment and point at
it from everywhere else -- the design leans on the pointers being real,
and a dangling link is worse than no link since it names something and
sends the reader looking.

Adds `docs-rustdoc` to nix/checks.nix: craneLib.cargoDoc over
--workspace --no-deps --document-private-items, denying six rustdoc
lints. Listed explicitly rather than -D warnings so a new lint appearing
upstream cannot red the build on a class nobody has triaged.

--document-private-items is load-bearing rather than thoroughness for
its own sake: most of this workspace's doc-comments live on private
items and //! module headers, so without it rustdoc checks a small
fraction of the links and the gate sits green while the rot continues.

Then fixes every error it reports, 40 to 0 across nine crates. The
classes differ and so do the fixes:

- public item, wrong scope -> qualify. Node and Node::parent are both
  public; the link failed only because scheduler.rs does not import
  Node. Six sites become [`crate::Node::parent`].
- private item -> downgrade to backticks. Nothing was made public to
  satisfy a lint; changing API surface to appease a doc check would be
  the tail wagging the dog.
- genuinely dead -> [`JobBuilder::insert_into`] names a method that does
  not exist. Insertion is Scheduler::insert_job.
- prose that looks like markup -> argv[0] parsed as a link, and
  <args>/<hex>/<name> parsed as HTML tags.

Note for future fixes: pub(crate) resolves in an intra-doc link, a plain
private fn in a binary crate does not (wait_for_nodes resolved,
connect_hint did not, same crate, same shape).

The check does not ride the clippy/test artifact cache. It takes
cargoArtifacts, but rustdoc needs its own flavour of dependency
metadata, which cargo build does not produce, so a --no-deps docs build
still compiles dependencies it never documents. Measured at 6m47s cold;
that reasoning is recorded in the check's own comment so the next reader
does not re-derive it.

Verified by running the check's exact command against the pre-cleanup
tree first: 40 errors, build failed. A gate that cannot fail is not
evidence, and building it before the cleanup makes that proof free.
2026-08-14 02:30:55 +02:00
damocles
2c7872841a hive-agent: guarantee a wake after a self-requested /compact 2026-08-13 23:17:10 +02:00
damocles
786e4610f0 hive-agent: replace json! with typed structs in web_ui handlers 2026-08-13 19:43:58 +02:00
damocles
1b72ed56ff todos: reopen an acked keyed row when the caller says so 2026-08-13 12:55:20 +02:00
damocles
20a7a21053 hive-c0re/hivectl/hive-agent: pause as a job-queue DAG node (closes #3056) 2026-08-11 23:47:09 +02:00
damocles
307c335662 hive-agent: guard the unreadable-mtime login fallback against stale re-triggers 2026-08-11 21:27:05 +02:00
damocles
8fd4e5d658 hive-agent: fix login-detection race with a fixed-baseline check (#3057) 2026-08-11 21:27:05 +02:00
iris
5bd085fbac web-ui: expose per-agent paused status, add pause/resume to the agent page's own overflow menu
hive-agent's own web_ui module never exposed the agent's own paused
status to its own /api/state — the dashboard's cross-container view
knew it, but a per-agent page had no way to know it's paused. Added
StateSnapshot.paused (a direct stat of the same harness-local pause
marker hive-c0re's Coordinator::is_paused checks).

The per-agent page's ⋯ overflow menu now has a pause/resume item that
POSTs to hive-c0re's existing /api/pause/<name> / /api/resume/<name> —
the same endpoints the dashboard's <hive-agent-menu> already uses,
same cross-origin form-submit pattern the existing rebuild-container
item uses. The item's label tracks state.paused on every /api/state
refresh so a pause/resume triggered from the dashboard while this page
is open doesn't leave a stale action showing.
2026-08-11 20:42:53 +02:00
atlas
98d895cf9e docs(gateway): describe what is, not what changed
Per review: docs represent current state. Every "used to" / "no longer"
clause this branch introduced is gone — including the History section in
network.md, which was a whole subsection about a sync mechanism that
doesn't exist.

Where the removed clause was carrying a real constraint, the constraint
stays and is stated in the present tense instead of as a delta: nothing
narrows what the gateway's nginx can reach except the directory
permissions in front of a socket, and nothing bounds `ReloadGatewayNginx`
except the hard-coded unit name. Those read as rules now rather than as
the story of how they came to be rules.
2026-08-11 18:09:51 +02:00
atlas
07852cabc1 feat(3088): move the gateway's nginx + dnsmasq onto the host
The gateway's nginx + dnsmasq no longer run in their own nspawn container.
`nix/host-modules/hive-gateway/default.nix` loses the
`containers.hive-gateway` wrapper and everything that existed only to punch
holes in it: `privateNetwork = false`, `CAP_NET_ADMIN`, five bind mounts,
its own `stateVersion`, `networking.firewall.enable = false`,
`networking.resolvconf.enable = false`, and the `hive-gateway-resolv`
path+service pair. 465 -> 303 lines.

The container never bought isolation here. It shared the host netns by
necessity — nginx binds the host's :80/:443, dnsmasq answers on the bridge —
so each of those settings was undoing a boundary the gateway could not
afford in the first place.

Four things made it more than a deletion, none of them visible in the nix
diff:

- The self-signed cert service also imports the hive CA leaf, so removing it
  with the container would have left nginx naming a missing cert file, which
  it refuses to load at all.
- The nginx reload is a hive-priv verb. It still needs root, but no longer
  for the reason its doc gave, and `--machine=` was both transport and
  scope — so the unit name is now hard-coded in the helper as the
  containment.
- The lifecycle verb named a container that stops existing.
- `journalctl -M hive-gateway` had no machine to enter.

Per the operator's ruling, the operator verb keeps working and agents lose
it. `InfraContainer` answered three questions that used to share an answer;
it now splits into `name()` (identity), `target()` (Container vs HostUnit),
`service_unit()` (the systemd unit), and `agent_restartable()`, which the
MCP restart path checks before the capability so the refusal cannot read as
"ask for infra_admin". `SIBLING_CONTAINERS` drops the gateway — it gates the
requests that name a container as a string — while `FromStr` still accepts
it, because that answers what a name is, not who may act on it. The
dashboard's gateway journal reads host journald filtered to `nginx.service`.

Prose was corrected where it only named a location, and re-argued where the
container was doing security work: a `0666` per-agent socket was safe
because only the gateway container had the directory bind-mounted. There is
no mount now, so the directory permissions are the whole of the access
control — the constraint holds, its mechanism doesn't.

Gate: nix fmt / clippy --all-targets -D warnings / cargo test all clean (710
tests); hivectl-cli.md regenerated from the clap tree. The nix eval was run
in both TLS shapes at this commit: every delta in the rendered
virtualHosts is one of the three intended path moves, dnsmasq settings are
byte-identical, and the absence probe flips true -> false with bindMounts
emptied.
2026-08-11 18:01:03 +02:00
damocles
80f16094f1 hive-sh4re: split inbox, container, journal, and schedule wire shapes into their own modules
Closes the #3110 split — lib.rs is now just the crate doc comment and
the pub mod list.

journal.rs's new doc comment fixes a pre-existing bug: the old
JournalPriority doc text in lib.rs was actually half Capability's doc
(a leftover from an earlier reorder that moved the code but not the
comment above it).
2026-08-10 23:26:15 +02:00
damocles
d3ac4de8fb hive-sh4re: split tool-group + capability enums into their own topic module 2026-08-10 23:05:18 +02:00
damocles
138f6b6c10 hive-sh4re: split manager-socket constants + HelperEvent into their own topic module 2026-08-10 23:05:18 +02:00
damocles
02bbff1e34 hive-sh4re: split approval-queue schema into its own topic module 2026-08-10 23:05:18 +02:00
iris
e525dcb6d4 agent icon: 404 when unconfigured, client-side fallback
hive_sh4re::assets::branding_svg() resolved a server-side default
icon at runtime from HIVE_ASSETS_DIR — the only consumer was
serve_icon(), which fell back to it whenever the agent had no
`hyperhive.icon` override. Removed both the fallback and the
function: serve_icon() now 404s when /etc/hyperhive/icon.svg is
absent, and the per-agent web UI (app.js) picks up the existing
dashboard swarm.js pattern — swap the <img> src to the
frontend-bundled /favicon.svg on load failure, guarded against
looping if the fallback itself 404s.

Updated the doc/comment claims that said the server always returns
an image (docs/web-ui/agent.md, nix/agent-modules/default.nix, the
hive-c0re/forge/users.rs comment referencing the old shared-asset
set). forge-avatar-sync and the matrix avatar sync are unaffected —
both are gated on hyperhive.icon != null and never depended on the
removed fallback.
2026-08-10 20:59:59 +02:00
damocles
7ba492b965 move hive-sh4re's harness_dir() into hive-agent-sock, drop the dev-fallback derivation 2026-08-09 19:54:13 +02:00
damocles
2024848251 move hive-sh4re's paused_marker() composition into hive-agent 2026-08-09 18:25:59 +02:00
atlas
1a0cb0fb44 docs: name the swarm display name by its new path
Two sites spelled it as a brace group, services.hyperhive.{hiveName,
swarmName}, which no anchored rewrite can handle correctly now that only
one of the two moves; both are written out separately. One of them is an
MCP tool description, so it is rendered into every agent's system prompt.
2026-08-05 11:15:41 +02:00
damocles
642377c5e0 docs: stop implying matrix/bash/forge is a closed todo-producer list 2026-08-04 00:06:19 +02:00
atlas
cfe965783e fix: set the in-agent socket's mode at bind, not afterwards
hive-c0re pushes todos into each agent over the in-agent socket, and
every one of those dials has been failing with EACCES. The socket is
created by todo_server::bind with no mode set at all, so it lands at
0777 & ~umask -- typically 0755. connect(2) on a unix socket requires
*write* permission, and hive-core is neither the socket's owner nor in
its group, so it is locked out.

The tell is the sibling socket. web.sock is bound in the same
directory, by the same process, as the same user, and does set its mode
(0666) immediately after bind. Only the socket missing that call fails,
which is also why no ownership or chown theory explained it: both
sockets share every directory they live in, so anything at the
directory level would have broken them together.

Fix is the two lines web.sock already had. Access control for these
sockets is the containing directory's job, not the socket's -- the mode
here only has to not exclude the host daemon that is supposed to reach
it.

Observable effect: scheduled prompts and message wakes reach agents
again. An agent whose wake is dropped still sees its messages whenever
something else wakes it, so the failure presents as agents that look
healthy but answer late, or not at all if nothing else is waking them.
2026-08-03 23:01:39 +02:00
damocles
8a16d4ca7e always-on mark_todos_done: no ToolGroup ever exposed it, blocking every agent 2026-08-03 19:09:38 +02:00
iris
04b274753b docs: give turn-loop/ a README.md landing page
Part of hyperhive#1898 (b): every docs subdir should have a top-level
README.md link, achieved by moving/renaming where an existing file
already fits the role.

docs/turn-loop.md already served as the hub + index for the three
sub-pages under turn-loop/ (claude-invocation.md, config.md, mcp.md),
so it moves wholesale rather than leaving a redundant top-level
pointer stub. Fixes every inbound/relative link across the repo
(top-level README.md, CLAUDE.md, docs/persistence.md,
docs/tools/scheduling.md, the sub-pages own back-link, hive-agent
README + doc comments, hive-agent/Cargo.toml, .prettierignore per-file
exemption entry) - grepped the whole tree for both turn-loop.md and
turn-loop/ to find every reference rather than trusting a partial
list.

nix fmt clean, cargo check -p hive-agent clean.
2026-08-03 12:55:18 +02:00
damocles
96ef592fee hive-agent: /cancel matches claude's cmdline, not the kernel comm name 2026-08-03 01:33:09 +02:00
iris
3512e4b019 dashboard: hide forge links instead of guessing <hostname>:3000
Adds services.hyperhive.forge.publicUrl (defaults to the gateway vhost
URL when behindGateway=true, null otherwise). HIVE_FORGE_PUBLIC_URL is
now sourced from it instead of hardcoding https://${forge.domain}
whenever behindGateway is on.

The 4 frontend call sites that built a forge link from
state.forge_public_url now hide the link when that's absent, rather
than guessing http://<browser-hostname>:3000 — a guess that's only
correct by accident once the operator isn't on plain localhost. Fixes
the dashboard H0M3 tile, per-agent-row forge links + agent menu, the
approval-queue PR link, and the per-agent page's own meta-nav forge
link (found during this pass, same defect, not in the original
3-site inventory).

Docs + doc-comments updated to match.
2026-08-03 01:21:11 +02:00
damocles
601cd295e5 docs: describe the push_todo lifecycle-notice migration 2026-08-03 00:04:24 +02:00
damocles
c5fe61777e hive-agent: don't claim 'already logged out' when a credential file is stuck undeletable
Closes #2831. post_logout's wipe_summary only checked whether cleared.wiped
was empty, so a real .credentials.json blocked by EPERM (nothing made it
into wiped) got reported as 'no credential files present (already logged
out)' in the same breath as a warning saying the delete failed -- self
contradictory and misleading, since the file is still there un-deleted.

Extracted the branch into a pure wipe_summary() helper (wiped file(s) named >
warnings-only failure > genuinely nothing found) with unit tests covering
the exact permission-error shape from the issue.
2026-08-02 21:35:06 +02:00
damocles
edb4aa98c6 auto-pause the turn loop after repeated missed get_loose_ends on todo wakes 2026-08-02 17:47:49 +02:00
damocles
2b5e5a30f4 trim verbose todo-tool descriptions, drop exhaustive subsystem list 2026-08-02 16:41:33 +02:00
damocles
bc69ee3b8f revise bulk-clear to explicit ids per mara's feedback, fix clippy line count 2026-08-02 16:41:33 +02:00
damocles
eb570c003d cap get_loose_ends todo output + add ack_todos_until bulk-clear (#2944) 2026-08-02 16:41:33 +02:00
damocles
42fdd98a7a swap hive-claude to the crates.io registry dependency (#2931) 2026-08-02 14:19:26 +02:00
damocles
3617578341 web_ui: scope /cancel and /logout's SIGINT to the harness's own claude child 2026-08-02 13:10:34 +02:00
damocles
ceff662d25 recv: drop wait_seconds from the MCP tool, always an immediate peek 2026-08-02 04:08:14 +02:00
damocles
77e30dd1bc hive-agent: extract turn-error recovery to fix clippy too_many_lines on handle_turn 2026-08-02 02:37:06 +02:00
damocles
a11f945532 hive-agent: surface an interrupted-turn banner in the wake prompt after /cancel 2026-08-02 02:34:05 +02:00
damocles
9f5ce4d941 hive-sh4re: delete now_unix(), the migration's last call sites are gone 2026-08-02 02:12:19 +02:00
damocles
f4a35786b1 hive-agent: finish chrono-clock migration on remaining call sites 2026-08-02 02:12:19 +02:00
damocles
2122e23d81 hive-sh4re/hive-bash-mcp/hive-agent: retype TaskFile timestamps to DateTime<Utc>, drop now_unix from these crates 2026-08-02 02:12:19 +02:00
iris
41c1b1a3fb agent web UI: bulk mark-done for the todos flyout
The per-agent web UI todos flyout (loose-ends v2) had no mark-done
affordance at all — dismissing a todo was only possible via the
cancel_loose_end MCP tool, one id at a time. Add a checkbox per row,
a select-all/select-none/mark-done bulk row, and a new
POST /api/todos/mark-done handler that loops the existing single-id
MarkTodoDone request over the in-agent socket (no new wire request
type needed — the todos list is small, so N same-host round-trips is
cheap).

Fixes #2917
2026-08-01 20:49:07 +02:00
damocles
57009c3fd1 stop telling agents to git against literal localhost:3000, point at $HIVE_FORGE_URL 2026-07-31 18:40:37 +02:00
damocles
f034ffb9d8 hive-forge: infer active repo from cwd's git remote, demote HIVE_FORGE_REPO 2026-07-29 18:37:37 +02:00
damocles
8a81085770 harness todos: ack reconciled todos instead of deleting them 2026-07-28 09:40:15 +02:00
damocles
ef1554a1b2 add per-agent and hive-wide skill invocation stats 2026-07-27 23:53:07 +02:00
damocles
2c11a437b4 hive-agent: enable the Skill built-in tool so installed skills are invokable 2026-07-27 22:28:28 +02:00
damocles
fffe0a2c29 remove request_next_turn: same-turn continuation is always worse than an external wake 2026-07-27 22:15:36 +02:00
damocles
8a7a450240 disk_watch: rebase on main's merged fix, keep the shared-volume rationale in the module doc 2026-07-27 13:05:35 +02:00