Repository navigation
Let invoke_planner start an automatic follow-up behind a system notice - #667
Merged
Merged
Conversation
An attached Planner client or an MCP caller sometimes needs a Planner turn nobody typed, such as updating the document after a workflow run finishes. invoke_planner now takes an optional as: "system". The turn goes through instruct(), so Chat shows "Automatic follow-up requested by @login." instead of the caller's member message, and the instruction reaches the Planner alone, also kept out of the visible queue while it waits. Only the document's creator, or the account whose client holds its Planner, may send one (system-turn-forbidden otherwise), and each document takes at most 10 an hour (system-turn-limited). Accepted and refused follow-ups are logged. An ordinary invoke_planner call is unchanged. Assistant-model: Claude Opus 5.5 (fast) Assistant-workflow: inline (fast subagents) Assistant-verification: unit tests for the system turn, its notice, owner refusal, hourly limit and argument validation, written failing first Assistant-verification: full server, package and web unit suites, type checks and lint/format checks pass Assistant-verification: MCP, Planner attachment and chat mention browser tests pass Co-authored-by: Alex Lavaee <alexlavaee@microsoft.com>
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.
An attached Planner client or an MCP caller sometimes needs a Planner turn that nobody typed, such as "a workflow run finished; update the document". Until now
invoke_plannercould only post the instruction as the caller's member message.What changes
invoke_plannertakes an optionalas: "system":{ "id": "/documents/octo-org/score/release-readiness", "instruction": "The workflow run finished. Read its results and update the document.", "as": "system" }instruct()path. Chat shows the system noticeAutomatic follow-up requested by @login.instead of a member message. The instruction reaches the Planner alone, and it stays out of the visible queue while it waits.system-turn-forbidden. For a child document, the check uses its root.system-turn-limited. A follow-up that is refused later (for exampleplanner-not-attached) does not use up the limit.invoke_plannercalls and every other refusal behave as before. Nothing changes in the agent-connection protocol: an attached client callsinvoke_plannerwith a GitHub token of the account that holds the Planner.Docs: local-agent-mcp.md ("Automatic follow-ups"), hosted-agent.md, agent-connection.md, authentication.md, AGENTS.md.
Verification
apps/server/src/mcp/invoke.test.ts, written to fail first, cover:hosted.test.tschecks thatas: "system"reaches the invocation.bun test apps/server packages apps/web: 5790 pass, 0 fail.bun run typesandbun run cipass.mcp-update,planner-attachment, andchat-mentionse2e pass (13 tests).