feat(herdr): report session activity to herdr agent panel - #17
Conversation
Add integration to publish and release crabcode agent state via Herdr pane socket RPC when running inside a herdr pane. Introduce a new `herdr` module to emit startup/teardown reports and map session statuses to herdr states, add RAII session guard in `main`, and propagate active-session status updates from `SessionManager`.
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Deploying crabcode with
|
| Latest commit: |
f07e209
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1a291c74.crabcode.pages.dev |
| Branch Preview URL: | https://feat-herdr-agent-reporting.crabcode.pages.dev |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f07e209a42
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if self.current_session_id.as_deref() == Some(id) { | ||
| crate::herdr::report_session_status(status); | ||
| } |
There was a problem hiding this comment.
Reset the report when the active session is cleared
When a user chooses New/Home or archives/deletes the current session while it is Streaming or Waiting, clear_current_session sets the current ID to None without reporting idle. Subsequent completion of that background session also skips this conditional because it is no longer current, so Herdr can continue displaying working or blocked until another session changes state or Crabcode exits.
Useful? React with 👍 / 👎.
| "params": params, | ||
| }); | ||
|
|
||
| let _ = send_rpc(&env.socket_path, &payload); |
There was a problem hiding this comment.
Cache a state only after its report succeeds
If Herdr is restarting or the socket otherwise fails during connect/write, this result is discarded after LAST_STATE has already been updated. Every later report of the same state is then treated as a duplicate and suppressed, so a transient socket failure can leave the panel stale for the entire working or blocked interval; update the cache only after a successful RPC, or clear it on failure.
Useful? React with 👍 / 👎.
| let started = Instant::now(); | ||
| let mut stream = UnixStream::connect(socket_path)?; |
There was a problem hiding this comment.
Enforce the connect timeout before blocking
When the Unix socket's accept queue is stalled or full, UnixStream::connect is a blocking call and can exceed the intended 80 ms limit because elapsed time is checked only after it returns. Since reporting runs synchronously from session-status handling, an unhealthy Herdr daemon can stall Crabcode's event loop well beyond the configured timeout; the connection itself needs to be nonblocking or moved off the event-loop thread.
Useful? React with 👍 / 👎.

Add integration to publish and release crabcode agent state via Herdr pane socket RPC when running inside a herdr pane. Introduce a new
herdrmodule to emit startup/teardown reports and map session statuses to herdr states, add RAII session guard inmain, and propagate active-session status updates fromSessionManager.