fix(herdr): add blocked-transition confirm delay to suppress transient OpenCode false alarms - #1237
Open
burakgizlice wants to merge 1 commit into
Open
Conversation
…t OpenCode false alarms Herdr's agent-status change events can report 'blocked' when the OpenCode TUI briefly shows an input prompt between tool calls. The agent is actually working - it has just finished one tool call and is about to start the next - but the transient 'blocked' edge was treated as actionable immediately, producing a firehose of stale wake notifications. The existing per-pane dedupe marker prevents re-escalating the same blocked edge, but OpenCode cycles through working -> blocked -> working -> blocked on every tool call, so each new blocked transition is a fresh edge that re-escalates. Fix: add a re-check step in fm_backend_herdr_apply_transition. When a blocked transition arrives, wait 3 seconds (FM_BACKEND_HERDR_BLOCKED_CONFIRM_DELAY), then re-query the live agent status via herdr's agent.get API. If the agent has already resumed 'working' (or gone 'idle'/'done'), absorb the transition silently. If the agent is still 'blocked', escalate as before. This also handles long-running commands (e.g. 'sleep 600') correctly: herdr reports 'working' during command execution, so no blocked transition is emitted in the first place. A real wedge (permission dialog, stuck prompt, interactive menu) persists far longer than the 3-second delay, so genuine escalations are only delayed by 3 seconds. Also adds a git-identity rule to the crewmate brief scaffold (fm-brief.sh rule 8) so workers never invent an agent identity for commits. They must use the global git config (user.name/user.email) instead.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Herdr reports agent-status changes via its transition event stream. When a pane
transitions to blocked, firstmate immediately escalates it as a stale wake,
with the message:
stale: <window> (herdr: agent blocked - waiting on human, escalated immediately, not via wedge timer).The OpenCode TUI briefly shows a "waiting for input" state between tool calls
as the agent cycles through its working loop. Herdr correctly reports these
transitions as
blocked->working->blocked->workingon every toolcall. The existing per-pane dedupe marker prevents re-escalating the same
blocked edge, but each
workingtransition clears the marker, so the nextblockededge is treated as a fresh actionable event -- producing a firehoseof stale wake notifications every few seconds.
This is especially visible during:
sleep 600 && no-mistakes axi status(not awedge, just the agent waiting for itself)
Solution
Add a re-check step in
fm_backend_herdr_apply_transition(the herdrbackend function that routes transition events through the shared policy
table). When a
blockedtransition arrives:FM_BACKEND_HERDR_BLOCKED_CONFIRM_DELAY).agent.getAPI.absorb the transition silently -- this was a transient false alarm.
wedge (permission dialog, stuck prompt, interactive menu).
This handles all three cases correctly:
working-> absorbed.workingduring command execution, so no
blockedtransition is emitted at all.blockedfor 3+ seconds -> escalated.The 3-second delay is a deliberate trade-off: a real wedge is delayed by
3 seconds, but the firehose of false alarms (dozens per minute) is eliminated.
The captain sees a notification only when something is genuinely wrong.
Config
FM_BACKEND_HERDR_BLOCKED_CONFIRM_DELAY(default 3, in seconds). Set to 0to skip the re-check entirely (used by tests that lack a live herdr server).
Additional change
Also adds a git-identity rule (rule 8) to the crewmate brief scaffold
(
bin/fm-brief.sh). Workers sometimes invent an agent identity(
firstmate <firstmate@local>) when committing, instead of using thecaptain's global git config. The new rule explicitly forbids overriding any
git identity field.
Testing
apply_transitiontests pass withFM_BACKEND_HERDR_BLOCKED_CONFIRM_DELAY=0function falls back safely to the old escalation behavior (fail-safe)