You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[idea] Atomic expected-session precondition for agent prompt
#6175
agent.prompt targets a pane or agent, then submits text. A caller can read the agent's native session first (agent get), but the read and the prompt are two operations. If the agent exits and a new occupant starts in the detection lag between them, the prompt reaches the new occupant. #4764 describes this race.
For a message relay this matters. The relay pastes a short, bodyless wake hint that is meant for one specific agent session. Delivering it to a different session is a misdelivery, and the relay cannot detect or prevent it today.
Request
A maintainer-supported precondition on agent.prompt: submit only if the target's current native session is the expected one, checked and submitted in one server-side operation.
Input: the existing target, text and wait, plus an optional expected native session id (CLI: herdr agent prompt <target> --expect-session <id> ...).
On match: unchanged behaviour.
On mismatch, or when the session is not yet known: nothing is typed, and the call fails with a distinct error code (for example agent_prompt_precondition_failed) that reports the observed session state, so the caller can leave the message queued and retry later.
feat: add atomic preconditions to agent.prompt #5480 implemented --expect-session with a precondition error. It was closed unmerged because the project does not take PRs from unapproved contributors, so I am raising it here as an idea instead.
Would the maintainers support this operation, or prefer a different shape for it?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Problem
agent.prompttargets a pane or agent, then submits text. A caller can read the agent's native session first (agent get), but the read and the prompt are two operations. If the agent exits and a new occupant starts in the detection lag between them, the prompt reaches the new occupant. #4764 describes this race.For a message relay this matters. The relay pastes a short, bodyless wake hint that is meant for one specific agent session. Delivering it to a different session is a misdelivery, and the relay cannot detect or prevent it today.
Request
A maintainer-supported precondition on
agent.prompt: submit only if the target's current native session is the expected one, checked and submitted in one server-side operation.Sketch, following the shape in closed PR #5480:
target,textandwait, plus an optional expected native session id (CLI:herdr agent prompt <target> --expect-session <id> ...).agent_prompt_precondition_failed) that reports the observed session state, so the caller can leave the message queued and retry later.Prior work
--expect-sessionwith a precondition error. It was closed unmerged because the project does not take PRs from unapproved contributors, so I am raising it here as an idea instead.Would the maintainers support this operation, or prefer a different shape for it?
All reactions