Skip to content

Add plan and goal command actions#293

Merged
Ololoshechkin merged 5 commits into
agentclientprotocol:mainfrom
nikita-ashihmin:codex/plan-command-action
Jul 15, 2026
Merged

Add plan and goal command actions#293
Ololoshechkin merged 5 commits into
agentclientprotocol:mainfrom
nikita-ashihmin:codex/plan-command-action

Conversation

@nikita-ashihmin

@nikita-ashihmin nikita-ashihmin commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • expose collaboration_mode as an ACP session config option and restore it when sessions are resumed or loaded
  • advertise /plan through neutral _meta.commandAction metadata as a stateful setConfigOption action
  • handle /plan locally as a toggle without starting a model turn and publish config_option_update
  • apply Codex collaboration mode through thread/settings/update
  • advertise /goal as a stateful prefixPrompt action so clients collect an objective and send /goal <objective>
  • publish authoritative goal snapshots in session metadata, including stable identity, status, elapsed time, and an advertised out-of-band control method
  • restore or clear the current goal when an existing session is resumed or loaded, while preventing stale reads from replacing newer live updates
  • support typed out-of-band Pause and Clear controls while the goal turn is active

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.commandAction hint 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 typecheck
  • npm run build

@nikita-ashihmin nikita-ashihmin changed the title Add plan mode command action Add plan and goal command actions Jul 13, 2026
@nikita-ashihmin nikita-ashihmin force-pushed the codex/plan-command-action branch from 14d06d3 to f6f2313 Compare July 13, 2026 21:51
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.
@nikita-ashihmin nikita-ashihmin force-pushed the codex/plan-command-action branch from f6f2313 to 77cc1b0 Compare July 14, 2026 10:55
@Ololoshechkin Ololoshechkin self-requested a review July 14, 2026 13:16

@Ololoshechkin Ololoshechkin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikita-ashihmin please check the session/goal_control method -- if it's an extension, please use https://agentclientprotocol.com/protocol/v1/extensibility guidelines

Comment thread src/AcpExtensions.ts Outdated
} from "@agentclientprotocol/sdk";

export const LEGACY_SET_SESSION_MODEL_METHOD = "session/set_model";
export const GOAL_CONTROL_METHOD = "session/goal_control";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nikita-ashihmin it's non-standard method in ACP, isn't it?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@nikita-ashihmin nikita-ashihmin Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/CodexAcpServer.ts
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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a test for this thread matching by goalRevision?

@nikita-ashihmin nikita-ashihmin Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@Ololoshechkin Ololoshechkin self-requested a review July 15, 2026 14:58
@Ololoshechkin Ololoshechkin merged commit 52d637a into agentclientprotocol:main Jul 15, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants