docs(constitution): add anti-polling rule for sub-agent waiting strategy#4098
Open
Mr-Moon121 wants to merge 2 commits into
Open
docs(constitution): add anti-polling rule for sub-agent waiting strategy#4098Mr-Moon121 wants to merge 2 commits into
Mr-Moon121 wants to merge 2 commits into
Conversation
When the parent launches sub-agents and runs out of independent work, it currently falls into a wasteful peek+sleep polling loop instead of passively waiting for subagent_completion events. This burns turns and budget without changing the outcome (sub-agents don't finish faster because you polled them). Add explicit 'Waiting, not polling' guidance to the Sub-Agent Strategy section: do not poll with peek/status, do not use sleep as a wait primitive, and if the runtime gives you a new turn with no user message while children are running, stop immediately. Closes Hmbown#4097
|
Thanks @Mr-Moon121 for taking the time to contribute. This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered. Please read |
…agents When the parent turn ends because it has no independent work left but sub-agents are still running, inject a runtime event telling the model to wait passively instead of polling with peek/status/sleep. This is the runtime-side complement to the constitution.md anti-polling rule. Together they form a two-layer defense against the wasteful polling loop documented in Hmbown#4097. Refs: Hmbown#4097
83 tasks
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
When the parent launches sub-agents and runs out of independent work, it falls into a wasteful peek-sleep-peek-sleep polling loop instead of passively waiting for subagent_completion events. This burns turns and budget without changing the outcome (sub-agents don't finish faster because you poll them).
Evidence: issue #4097 documents a real session where 3 sub-agents triggered 13 peek calls and 5 artificial sleep calls (140s blocked), with $0.086 sub-agent cost where the majority was polling overhead.
Solution
Add explicit "Waiting, not polling" guidance to the Sub-Agent Strategy section in constitution.md:
The runtime already delivers subagent.done sentinels as user messages when children complete. Polling is pure waste.
Change
One file: crates/tui/src/prompts/constitution.md — new bullet in the Sub-Agent Strategy section.
Closes #4097