Commit graph hyperhive/hive-agent
Author SHA1 Message Date
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
atlas
c3e6e23d22 disk_watch: stay silent when the agent owns nothing worth deleting
The todo fired on filesystem usage alone, so every agent on a busy host
got woken by a disk it had no power over. Measured case: a 927G volume
at 81%, 742G used, of which one agent's entire tree was 5.3G. The todo
cost that agent a full turn to arrive at "not actionable".

`summary_for` now also requires a non-empty `big_dirs()` result. An
agent that owns no oversized directory cannot free meaningful space, so
there is nothing to say to it; the shared store filling up is the host's
signal. Agents that ARE sitting on a stale `target/` still get told, with
the same bucketed anti-nag summary as before.

Drops the conditional around the "Biggest directories" section, which is
now unreachable when empty. Existing tests passed `&[]` as a
don't-care — they now pass a directory, since that argument became
load-bearing.

Closes #2759
2026-07-27 12:10:27 +02:00
atlas
7a826f9ee2 refactor(sock): one socket client, retry as a policy value
Six places in the tree hand-rolled the same connect / write one JSON
line / read one JSON line back. Two of them — the harness serve loop's
client and the MCP server's — were byte-identical apart from a six-line
wrapper, ~145 lines of literal copy-paste. The other four each
reimplemented a subset, and the subsets had drifted: some named the
socket path in their errors and some did not, one classified transient
against fatal failures and the rest retried nothing at all, two drained
the response and two decoded it.

That duplication was defended when the daemons were split out, on the
grounds that a daemon's socket etiquette should stay visible in the
crate that depends on it. The etiquette genuinely does differ. The code
does not, and five copies is where "each daemon documents its own
etiquette" stops paying for itself.

`hive-sock-client` now owns the transport once, generic over the
request and response types so it is protocol-agnostic: the host-served
control socket and the harness's in-agent socket both use it with their
own wire-type crates. The two real differences become values instead of
forks. Retry is `Retry::RideOutRestart` (2/4/8/16/30s, sized to ride out
a service restart) for callers with no natural retry of their own, or
`Retry::None` for callers already inside a poll loop where the poll
interval is the retry — and the reason each caller picked one is a
comment at the call site rather than a reimplementation. The response is
either decoded (`request`) or half-closed and drained (`notify`, where
the drain exists so the server's write-back doesn't land on a closed
socket). Whether a failure propagates or is logged and swallowed stays
at the call site, because that is the caller's choice and not a property
of the transport.

Errors always name the socket path now, everywhere. That detail is
load-bearing: a permission problem on a socket that reads as "is the
daemon running?" sends the operator to fix the wrong thing.

The transient-against-fatal enum is gone rather than moved. Serialising
happens before the retry loop and deserialising after it, so only
connect, I/O and short-read failures can reach the loop at all — a
deterministic failure is now unretryable by construction instead of by
classification.

It is deliberately a new crate and not part of `hive-agent-sock`. The
`*-sock` crates are pure wire types by convention — `hive-agent-sock`
depends on serde and nothing else — and the two largest copies talk to
the host socket, whose types live in a different crate entirely. A
transport in either wire-type crate would drag tokio into it and point
the wrong way besides.

No wire-format change: same JSON line in, same line out.
2026-07-26 22:44:48 +02:00
atlas
246c9471b1 refactor(hive-agent): split the forge notification poller into its own crate
The poller was a `tokio::spawn` inside the `hive-agent` serve loop. It
never needed anything from that loop except a socket path, so being
in-process bought nothing and cost two things: a harness restart took
forge notifications down with it, and the whole forge/HTTP dependency
tree was linked into the serve-loop binary.

It is now `hive-forge-notify`, a per-agent daemon with its own systemd
unit, a sibling of `hive-bash-daemon` and `hive-matrix-daemon`. Same
contract as those two: it reaches the harness only by upserting todos on
the in-agent socket, and nowhere else.

The module moves verbatim (`notify.rs`) — the formatters, the activation
gates, the dedupe map and all 33 tests are unchanged. Only the socket
call sites are rewritten, onto a small local `todo_client` rather than
the harness's. That mirrors what both sibling daemons already do, and
the etiquette differs on purpose: the harness's client carries a 60s
backoff schedule sized to ride out a hive-c0re restart, which its
callers need because they have no retry of their own. This poller's two
call sites both sit inside the 30s poll loop and both treat a failure as
"leave the thread unread, try next tick", so the poll interval already
is the retry; a second backoff would only stack sleeps and delay the
rest of the batch.

The unit is `Restart=on-failure`, not `always`. An agent with no forge
account is a supported configuration and the poller reports it by
logging why and exiting 0 — under `always` that clean exit would be a
restart loop on every forge-less agent.

`forgejo-api`, `url` and `time` drop out of `hive-agent`'s dependencies
with the module.

Also corrects docs that outlived the code they described: the persisted
`forge_cursor` field is long gone (forge's own read-state is the durable
record of what has been delivered), but `docs/persistence.md` and the
`harness_state` module docs still documented it as live.
2026-07-26 21:30:29 +02:00
iris
7320e2ba3d feat(forge_notify): assigned-issues rollup todo
After each notification poll, query GET /api/v1/issues/search with
assigned=true for both issues and pulls, read X-Total-Count, and
upsert/clear a keyed 'rollup' todo (subsystem=forge, key=rollup).

When the total is > 0 the summary reads e.g. '3 open assigned: 2 issues,
1 PR'. When it drops to 0 the rollup todo is cleared. The 'rollup' key is
distinct from per-thread numeric keys so clearing it never touches
notification todos.

Closes #2725.
2026-07-26 17:59:20 +02:00
atlas
7ba90d5a3f feat(agent): raise a todo when the agent's disk gets tight
Closes 2718.

The operator has been going through agent dirs by hand with ncdu,
deleting 20+GB target dirs. Agents had no way to know they were the
ones sitting on the space.

New `disk_watch` module in the harness: every 15 minutes it statvfs's
the filesystem backing the agent's state dir and, past 80%, raises a
keyed `disk` todo telling the agent to free space — with the operator's
rules inline: only delete things that are actually big, build output
first, and never delete something still needed, ask for more space
instead.

Over threshold it also walks the agent's own tree (`/agents/<label>`
plus `$HOME`) and names the directories worth looking at, so the todo
says where the bytes actually went rather than just that the disk is
full. The walk is bounded on every axis — entry budget, recursion cap,
report depth — pinned to the state dir's device so it can't wander into
`/nix` or the shared bind mounts, and it does not traverse symlinks. It
reports the deepest oversized directory on each branch, so the agent
gets pointed at `<workspace>/target` rather than at `/agents/<label>`.

Anti-nag is the whole design constraint. The todo is keyed, and the
summary is deliberately stable: the percentage is bucketed to 5 points
and no raw byte counts appear anywhere in it. An unchanged situation
re-upserts as `changed == false` and never fires the wake, so a disk
that has been steady at 89% for a week sits quietly in the loose-ends
list; crossing into a new bucket speaks up once. Dropping back under
the threshold clears the row.

Harness-local by construction, per the operator's call that this gets
no core wiring: hive-c0re cannot push a todo at all (the store and its
wake live inside the container), and running in-process means this
skips even the in-agent socket and calls `Todos::upsert` directly.

Worth recording, since it shaped the scope: btrfs does NOT fold qgroup
limits into statfs. Measured with quota counting enabled and a 20G
limit set on a real subvolume, statvfs returns byte-identical whole-FS
numbers for that subvolume, an ordinary agent dir, and the root. So
this watches host-FS pressure, which is valid before and after the
planned subvolume migration; per-agent quota awareness would need the
limit handed to the agent explicitly.
2026-07-26 17:59:13 +02:00
damocles
053bbb1bb7 prompts: fix rebase conflict + qualify inbox tool names consistently 2026-07-26 17:33:41 +02:00
damocles
c42d02e12a prompts: collapse tool bullet list to avoid duplicating mcp descriptions 2026-07-26 17:33:41 +02:00
damocles
aedfd512c6 prompts: stop steering agents to busy-wait on recv when idle 2026-07-26 16:46:56 +02:00
atlas
31008c83df feat: pause an agent's turn loop without stopping its container
A paused agent keeps its container, its claude session and its
dashboard/todo servers up, but stops driving turns. Messages queue
unacked and are drained on resume.

The whole protocol is a single marker file, `<harness>/paused`. That
directory is already a bind-mount shared between host and container, so
both sides just stat the same path: the harness reads it to decide
whether to drive a turn, hive-c0re reads it to render the badge and
writes/removes it for `hivectl pause|resume`. No new wire protocol, no
container round-trip, and it is sticky across restarts by construction.

Not calling `recv_next` while paused *is* the queueing semantic, so
there is no fencing to get wrong: reminders buffer in their unbounded
channel, the todo `Notify` permit coalesces, and a `request_next_turn`
that raced the pause survives because the gate sits above
`self_continue.take()`.

Graceful stop is handled host-side rather than in the harness: a paused
agent provably has no turn in flight, so `run_signal` skips the fence
entirely instead of eating the full `GRACEFUL_STOP_TIMEOUT` waiting for
a checkpoint turn that will never run.

`paused` is reported on `ContainerView` / `AgentStatusRow` for the
dashboard, orthogonal to `running` and reported for stopped containers
too.

Closes: hyperhive/hyperhive issue 2271
2026-07-26 03:11:33 +02:00
damocles
7b2645078a fix(#2635): close review nits on the questions mirror (inc2 pt2) 2026-07-26 02:07:33 +02:00
damocles
e5ef5a72be feat(#2635): wire harness-local questions mirror (inc2 pt2) 2026-07-26 02:07:33 +02:00
damocles
9471201698 feat(#2635): add harness-local questions mirror store (inc2 pt2, unwired) 2026-07-26 02:07:33 +02:00
damocles
001ea38ea4 gate stale todo wakes on an emptiness check (#2678) 2026-07-25 22:28:38 +02:00
damocles
2316287327 remove hive-agent-wake — no shipped consumer 2026-07-25 20:05:32 +02:00
damocles
6c886d3fa6 hive-agent: inline todo dispatch arms instead of a sub-match + unreachable!
per mara's review on #2679: replace the separate dispatch_todo sub-match
(with its trailing unreachable! arm) with four small handler functions
called directly from dispatch's existing match. same behavior, no
unreachable! left in the todo path.
2026-07-25 18:42:10 +02:00
damocles
2dcbb78b40 hive-agent: add debug logging around todo upsert/clear/mark-done
diagnostic instrumentation for #2678 (phantom 'you have todos' wakes
after clearing bash-task todos). logs subsystem/key/id/changed on
UpsertTodo, subsystem/key/all/count on ClearTodo, id/count on
MarkTodoDone, and a marker when the serve loop actually consumes a
todo_wake notification. no behavior change - RUST_LOG=debug only.
2026-07-25 17:40:11 +02:00
damocles
c4fcf7fbf1 feat(#2659): serve hive-bash-mcp over persistent streamable-http, drop stdio bridge 2026-07-23 18:01:20 +02:00
damocles
29f45ddd48 docs(#2627): crate READMEs for the harness column (hive-agent, hive-agent-mcp, hive-agent-wake, hive-bash-mcp) 2026-07-23 16:41:05 +02:00
damocles
a7f0f3d231 fix(#2635): drop obsolete todos_db/reminders_db path aliases 2026-07-23 15:05:19 +02:00
damocles
c316dc852d feat(#2635): consolidate todos + reminders into one hyperhive-state.sqlite 2026-07-23 15:05:19 +02:00
damocles
e9df5def02 add agent-facing compact tool gated on context usage 2026-07-23 12:34:20 +02:00
damocles
ee072149c9 fix(#2038): don't treat MCP 'pending' status as degraded
pending is the claude CLI's normal init-event race for a freshly
spawned stdio server (status reported before the handshake completes,
then flips to connected moments later in the same turn — see
anthropics/claude-agent-sdk-typescript#368). flagging it fired on
nearly every turn for all three configured servers with zero actual
impact, which is why #2038's persistent-vs-one-turn repro question
looked answered when it wasn't — that was this false positive, not
the real bug.
2026-07-23 07:47:56 +02:00
damocles
dcb2b79715 strip issue-tag comments from #2635 inc1 commits per hive-rules 2026-07-23 00:12:30 +02:00
damocles
e11e8294a3 repoint post_turn_counts + dedup web_ui stats onto todo_server::dial (#2635 inc 1) 2026-07-23 00:12:30 +02:00
damocles
8b35b8c4af repoint per-agent stats reminder rollup off the broker (#2635 inc 1) 2026-07-23 00:12:30 +02:00
damocles
ecd9030305 wire reminder ops into the in-agent socket dispatch (#2635 inc 1) 2026-07-23 00:12:30 +02:00
damocles
174e277340 add reminder delivery timer + main.rs wiring (#2635 inc 1) 2026-07-23 00:12:30 +02:00