Skip to content

feat(herdr): report forge lifecycle state to herdr (opt-in, no-op outside Herdr) - #3974

Open
bugakov wants to merge 1 commit into
tailcallhq:mainfrom
bugakov:feat/herdr-integration-upstream
Open

bugakov wants to merge 1 commit into
tailcallhq:mainfrom
bugakov:feat/herdr-integration-upstream

Conversation

@bugakov

@bugakov bugakov commented Oct 4, 2026

Copy link
Copy Markdown

Summary

Hi! While using forge inside Herdr, I noticed there's no
way for Herdr to know when forge is working, idle, or needs input. Herdr
documents a first-party integration path for exactly this — "Add Herdr support
to your agent" (herdr pane report-agent) — so I implemented it for forge.

The change is fully opt-in and a strict no-op outside Herdr; it cannot
affect normal terminal usage.

How it works

When forge runs inside a Herdr pane it inherits HERDR_ENV, HERDR_PANE_ID,
HERDR_BIN_PATH and HERDR_SOCKET_PATH. A small reporter hooked into forge's
existing lifecycle events turns those into state reports:

Event Report
Start working (+ resume argv)
Response idle
ToolcallStart working (with tool name)
forge exits release-agent

Reports are fire-and-forget (background spawn, short timeout, errors ignored),
so Herdr can never slow forge down. seq is epoch-milliseconds as Herdr
recommends. On the Herdr side this enables: showing forge in the sidebar,
herdr agent wait, completion notifications, and restoring the same session
after a server restart.

Scope (5 files, +314/-5)

  • crates/forge_app/src/hooks/herdr.rs — new reporter using the existing
    EventHandle hook chain (Start/Response/ToolcallStart/End)
  • crates/forge_app/src/app.rs — register the reporter in chat's hook chain
  • crates/forge_main/src/main.rs — release_global() on exit
  • plumbing: hooks/mod.rs, lib.rs

No new dependencies. Uses tokio::process (already a workspace feature).

Testing

Verified against Herdr 0.9.3 (local server):

  • forge appears as forge / working in herdr agent list while a turn runs
  • herdr agent wait <pane> --until idle resolves with agent_status: idle
  • pane is released (agent name cleared) when forge exits
  • both forge -p ... (CLI) and interactive TUI covered
  • outside Herdr (HERDR_ENV unset) — zero impact

Happy to adjust anything (naming, placement, or wiring) to fit your
conventions. Thanks for the great tool!

Adds a HerdrReporter hook that pushes forge state into the herdr agent
pane via `herdr pane report-agent` whenever the process is running inside
a herdr environment ($HERDR_ENV=1):

- Start  -> working
- Response -> idle
- ToolcallStart -> working (with tool name)
- process exit -> release-agent

The reporter is a no-op outside herdr (no active runner, no herdr env),
so impact on plain terminal usage is zero. This is the official "add
Herdr support to your agent" integration path and requires no herdr
binary changes; on the herdr side it enables agent detection, sidebar
presence, `herdr agent wait`, notifications and session resume.
@CLAassistant

CLAassistant commented Oct 4, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added the type: feature Brand new functionality, features, pages, workflows, endpoints, etc. label Oct 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature Brand new functionality, features, pages, workflows, endpoints, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants