prompts: stop steering agents to busy-wait on recv when idle
This commit is contained in:
parent
c0c8e2a2d6
commit
aedfd512c6
2 changed files with 12 additions and 8 deletions
|
|
@ -273,10 +273,16 @@ impl AgentServer {
|
|||
an empty marker if nothing is waiting. \n\n\
|
||||
**Single-message default**: with no args (or `max: 1`) you get the next message — \
|
||||
same behaviour the harness uses to drive a turn. Without `wait_seconds` (or with 0) \
|
||||
the call returns immediately — a cheap 'anything pending?' peek. Pass a positive \
|
||||
`wait_seconds` (capped at 180) to park the turn waiting for new work — incoming \
|
||||
messages wake you instantly, otherwise the call returns empty at the timeout. \
|
||||
That's strictly better than a fixed shell `sleep`. \n\n\
|
||||
the call returns immediately — a cheap 'anything pending?' peek. \n\n\
|
||||
**When idle, prefer ending the turn over parking here.** Ending the turn is the \
|
||||
ONLY path that observes an in-container todo wake (bash-task completions, matrix \
|
||||
unread, forge activity) — that signal reaches the harness loop between turns, never \
|
||||
a live `recv` call, so parking in `wait_seconds` while a todo lands means sitting \
|
||||
blind until the timeout. Ending the turn also checkpoints your session, and costs no \
|
||||
latency vs. parking for a real inbox message either way — the broker wakes the next \
|
||||
turn just as fast. Reach for a positive `wait_seconds` (capped at 180) only for a \
|
||||
short, deliberate in-turn block — e.g. confirming something you just triggered lands \
|
||||
within seconds — not as the default way to wait for more work. \n\n\
|
||||
**Batch drain**: pass `max: N` (capped at 5) to drain up to N messages in one \
|
||||
round-trip. Use this when the wake prompt told you the inbox has more queued, or \
|
||||
any time you expect a burst — one tool call beats N consecutive single recvs. \
|
||||
|
|
@ -284,9 +290,7 @@ impl AgentServer {
|
|||
up to `max` in total. Empty result reported the same way regardless of `max`. \n\n\
|
||||
After popping, the result appends a `(N more message(s) pending …)` line whenever the \
|
||||
inbox still has queued messages — so you know whether to drain again (or `ack_until`) \
|
||||
without a separate status check. No line means the inbox is empty. \n\n\
|
||||
Typical pattern: when you have nothing else useful to do, call \
|
||||
`recv(wait_seconds: 180)` to park until something arrives."
|
||||
without a separate status check. No line means the inbox is empty."
|
||||
)]
|
||||
async fn recv(&self, Parameters(args): Parameters<RecvArgs>) -> String {
|
||||
let log = format!("{args:?}");
|
||||
|
|
|
|||
Loading…
Reference in a new issue