Repository navigation
fix(server): give Prime all queued follow-ups when its run would stop - #241
Merged
Merged
Conversation
Pi's default follow-up mode, one-at-a-time, hands a busy agent one queued follow-up each time it would stop, so a backlog of messages to Prime was worked one message per turn. Prime now starts with set_follow_up_mode all and gets the whole backlog in its next turn. Pi 1.6.0 also saves this mode to its global settings, so other Pi processes sharing HOME start with it too.
Hargun3
marked this pull request as ready for review
December 4, 2026 09:45
EdwardGallant
approved these changes
Dec 4, 2026
morgan-wowk
approved these changes
Dec 4, 2026
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 Prime is busy, messages sent to it (from people, River, and its own workers' end-of-run reports) wait in Pi's follow-up queue. Pi's default follow-up mode is
one-at-a-time: each time Prime would stop, Pi gives it just one queued message, so a backlog is worked through one message per turn. In a research session Prime was about 85 minutes behind, answering a 05:05 UTC message at 06:28 UTC, and River worked around it by sending one message that "replaces everything": https://shopify.slack.com/archives/C0CFQF9EB41/p1796020520354999Change
When Tangent starts a Prime process, it sends Pi's RPC command
set_follow_up_modewith modeall. When Prime would stop, it now gets the whole backlog in one turn and can see that a newer message replaces an older one. Sub-agents are not sent the command. It is sent fromspawnAgent, so every Prime start gets it: the first start, a crash respawn, and a model-change respawn.docs/server/orchestrator.mdnow lists the command with the other stdin RPC commands.How tested
piAgentManager.test.ts: Prime getsset_follow_up_mode all, a sub-agent does not, and a crash-respawned Prime gets it again. The test fails without the change. Two existing tests now skip the new command when they look at stdin.pnpm typecheck,pnpm lint(0 errors),pnpm build,prettier --check, andpnpm --filter @tangent/server test(849/849) all pass.get_stategoes fromone-at-a-timetoall. With a mock model, 3 messages queued during a run reached the model in 1 request instead of 3.eadf39b, which includes fix(server): say why a run failed in the run-error notice #231): typecheck, lint and build pass, and the server tests pass (862/862). With feat: tell a human when their message to a busy Prime is queued #232 merged on top as well: 865/865.Limits
$HOME/.pi/agent/settings.json). Other Pi processes that share HOME start withalltoo. In the container (HOME=/tmp) that means sub-agents started after Prime. When you run Tangent locally, it changes your own~/.pi/agent/settings.json. Pi 1.6.0 offers no way to set the mode without saving it.followUpModefrom~/.pi/agent/settings.json.