Add plan and goal command actions#293
Conversation
14d06d3 to
f6f2313
Compare
Restore collaboration mode when sessions are loaded and publish authoritative goal snapshots without allowing stale reads to overwrite live updates. Keep goal control responses typed and preserve stable goal identity for UI replay.
f6f2313 to
77cc1b0
Compare
Ololoshechkin
left a comment
There was a problem hiding this comment.
@nikita-ashihmin please check the session/goal_control method -- if it's an extension, please use https://agentclientprotocol.com/protocol/v1/extensibility guidelines
| } from "@agentclientprotocol/sdk"; | ||
|
|
||
| export const LEGACY_SET_SESSION_MODEL_METHOD = "session/set_model"; | ||
| export const GOAL_CONTROL_METHOD = "session/goal_control"; |
There was a problem hiding this comment.
@nikita-ashihmin it's non-standard method in ACP, isn't it?
There was a problem hiding this comment.
Couldn't find it in ACP spec, so it looks like an extension to me. The protocol reserves any method name starting with an underscore (_) for custom extensions. See https://agentclientprotocol.com/protocol/v1/extensibility
There was a problem hiding this comment.
Fixed in 41ceacf: the custom request is now namespaced as _codex/session/goal_control, so it starts with the underscore reserved for ACP extension methods. The advertised controlMethod metadata and snapshots were updated as well.
| const goal = await this.runWithProcessCheck(() => this.codexAcpClient.getGoal(sessionState.sessionId)); | ||
| const snapshot = goal === null ? null : toThreadGoalSnapshot(goal); | ||
| if (!this.goalPublishIsCurrent(sessionState, sessionGeneration) | ||
| || sessionState.goalRevision !== requestRevision) { |
There was a problem hiding this comment.
Is there a test for this thread matching by goalRevision?
There was a problem hiding this comment.
Yes — the test "ignores an older goal refresh that completes after a newer refresh" exercises this exact goalRevision race by resolving the newer refresh first and the stale one afterward, then asserting that only the current goal is published. I reran it as part of the full suite (310 tests passed).
Summary
collaboration_modeas an ACP session config option and restore it when sessions are resumed or loaded/planthrough neutral_meta.commandActionmetadata as a statefulsetConfigOptionaction/planlocally as a toggle without starting a model turn and publishconfig_option_updatethread/settings/update/goalas a statefulprefixPromptaction so clients collect an objective and send/goal <objective>Why
ACP available commands describe command names and arguments, but that is not enough for clients to distinguish a raw slash command from a client-side interaction. Plan changes persistent session configuration; Goal changes how the next prompt is composed, starts a goal turn, and then becomes durable session state.
The optional
_meta.commandActionhint lets capable clients provide those interactions without hard-coding Codex command names. Goal state is published through session metadata so clients can render and restore a persistent goal panel. The advertised control method avoids trying to start a second ACP prompt while the goal turn is active. Start and Resume continue through the Goal prompt path because they create a model turn; Pause and Clear use the control extension because they do not.Clients that do not understand these optional metadata fields continue to treat both entries as ordinary slash commands.
Tests
npm test(310 passed, 28 skipped)npm run typechecknpm run build