Repository navigation
feat(agent): give the Bot a sleep tool that waits for events - #6505
Conversation
sleep takes no arguments and has no duration. It ends the Turn through the engine's existing FinishTurn semantics, and the Bot is woken again by a user message, a WorkHub result or a scheduled event, each of which already starts its own Turn. It is refused only while a queued message is already bound for the running Invocation's next step, so a promoted message is read first. Like SendUser it is granted by Bot identity, always visible, hidden from other Sessions and rejected from a requested tool list. The standing instructions tell the model to call it on its own, not in the same step as SendUser, which FinishTurn would reject. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
A small check with a real model in the desktop app, on a build of this branch (merged with #6491 and #6503 locally). I read the event log afterwards.
This is two Turns, so it shows the prompt works for that model, not that it always will. I only checked the event structure, not the message text or the Chat view. Not tried with a real model yet: a WorkHub result or a scheduled event waking the Bot, and |
Preserve both the Sleep regressions and workspace-free Bot opening tests. Update the existing retirement test to observe a removed Session through its public API, since deletion now collects the original history material. Generated-by: OpenAI Codex
Generated-by: OpenAI Codex
Astro-Han
left a comment
There was a problem hiding this comment.
Automated review notice: This comment was posted by an automated review agent. It is not an independent human review and does not replace one.
I reviewed all five changed files at cfb19672cfcbddb8f8e2c3c6c2cf04569c8ee30e. I found no confirmed P0–P2 issue in this source review. The implementation gives the registered Bot an always-visible, direct-only sleep, rejects requests for it when creating ordinary Sessions, and uses the existing FinishTurn settlement rather than introducing a timer or another wake mechanism. The effect rechecks Bot/Invocation identity and refuses a message already promoted to that Invocation; an ordinary queued follow-up remains a separate Turn. Existing call admission makes sleep exclusive within its step. This is a model-callable way to end a Turn, not a guarantee that the model can end only by sleeping.
Integration remains incomplete: an actual merge calculation against rust-preview at c07c5ac1d60650f9bb73ce9001c713e7870c7b3c conflicts in plugins/agent/native/src/owner/tests/bot_tests.rs. GitHub reports the PR as conflicting and lists no checks on this head. Resolve the test conflict and validate the resulting integration.
P3 — AI attribution: the PR discloses Claude's contribution and the commit has Co-Authored-By, but lacks the Generated-by trailer required by CONTRIBUTING.md. Preserve that trailer in the eventual squash commit.
Validation boundary: I traced the production registration, schema, identity checks, queue predicate, exclusive-step admission, successful-result settlement and recovery paths, and read the three new Rust tests. I did not execute Rust, the Host, a real model or the native UI on this machine. The Bot/full-suite test counts in the PR description are the author's results, not mine.
Automated review notice: This comment was posted by an automated review agent operated by Astro-Han. It is not an independent human review and does not replace one.
# Conflicts: # plugins/agent/native/src/owner/tests/bot_tests.rs
Generated-by: OpenAI Codex
…6505 Co-Authored-By: Claude Opus 5.5 <[email protected]>
What
Stage two of the Always-on Bot discussed in #6464: the Bot gets a
sleeptool that waits for events. It has no arguments and no duration (no floor, ceiling or budget), as agreed in the review.How it works
sleepis a Bot-onlyDirectOnlytool with the engine's existingFinishTurnsemantics (the same mechanism asyield_agent_graph). When it succeeds the Turn ends and the model is not called again.sleepfails, with a message to the model, only while a queued message is already bound to this Invocation's next step (a promoted message, which the engine delivers at the next step boundary). Ordinary queued follow-ups are not counted: the model cannot read them mid-Turn, so refusing would make it loop, and they start the next Turn on their own.SendUser: granted by Bot identity, always visible, hidden from every other Session, and rejected from a requested tool list.sleepon its own, never in the same step asSendUser, becauseFinishTurnis exclusive within a step and its siblings are rejected.Not in this PR
tool_choice: required(all three adapters hardcode auto today, so it would touch the model request path) and a step limit for a Turn that never callssleep. Without either, a model that ends with plain text still ends the Turn harmlessly, sosleepis mainly an explicit, loggable "waiting for events" state plus the refusal above.Verification
sleepand ordinary creation cannot request it; a promoted message makessleeprefuse and then arrives with the Turn. Bot tests: 15 pass.cargo clippy -p maka-agent-native --no-deps --all-targets: clean.cargo test -p maka-agent-native: 220 pass, 1 fails. The failing test isapproval_park::exclusive_session_retirement_settles_parked_work_without_a_new_activation(MaterialCollected). It fails the same way onrust-previewat 0ee4114 without this change, so it is not caused by this PR.Not checked here: behaviour with a real model in the desktop app, and whether models reliably call
sleepin a separate step.Compatibility: this changes the Bot's tool set, so a request parked before an upgrade can fail with
agent_tools_changed.🤖 Generated with Claude Code