Skip to content

fix: correct architect use of plan exit to save the plan file correctly#10798

Merged
johnnyeric merged 2 commits into
mainfrom
johnnyeric/fix-architect-plan-exit
Jun 2, 2026
Merged

fix: correct architect use of plan exit to save the plan file correctly#10798
johnnyeric merged 2 commits into
mainfrom
johnnyeric/fix-architect-plan-exit

Conversation

@johnnyeric

@johnnyeric johnnyeric commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Issue

N/A

Context

Fix CLI plan follow-up after plan_exit for Architect/plan-style flows. The plan file was saved successfully, but the CLI could stop without showing the “Ready to implement?” prompt when the follow-up needed to read the saved plan file.

Implementation

Bind the Kilo-owned plan follow-up entrypoint before running the async follow-up flow. This preserves the active instance context across the Effect.promise boundary, so PlanFollowup.ask can still resolve the saved plan path when it falls back to reading the plan file from disk.
Kept the fix in Kilo-owned code instead of changing shared opencode logic.

Screenshots / Video

Screenshot 2026-06-01 at 21 32 50 Screenshot 2026-06-01 at 21 34 19

How to Test

Reviewer test steps

  • Tested different scenarios on the architect agent to build a plan and continue implementation on a new session
  • Tested CLI and Extension

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 45b1a88153

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/opencode/src/kilocode/session/prompt.ts
@kilo-code-bot

kilo-code-bot Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
.changeset/ No changeset added for this user-facing bug fix
Observations

Fix correctness (InstanceState.bind): Calling InstanceState.bind(PlanFollowup.ask) before the Effect.promise boundary correctly preserves the active instance context so Instance.current calls inside PlanFollowup.ask work after the async boundary. The bind function gracefully returns fn unchanged when no context is present, so there is no regression risk.

Architect condition: The condition input.agent.options?.id !== "architect" correctly gates plan-file injection on the options.id field as defined by Agent.Info. The access is type-safe since Agent.Info.options is Record<string, unknown>.

InstanceState.bind for Session.plan: The InstanceState.bind(() => Session.plan(input.session, Instance.current))() pattern is correct — it captures the current instance context synchronously before the async boundary, then immediately invokes the bound function. No issue here.

Architect prompt text: The differentiated system-reminder for the architect agent (requiring the user to explicitly choose "Finalize and save the plan" or "Continue refining" before writing the plan file) is a reasonable guard to prevent premature plan saves. The relaxed limit text for architect (allowing other files when the user explicitly asks) is also a sound change.

Missing changeset (unchanged from previous review): This PR fixes a user-visible regression. A .changeset/*.md with patch severity should be added. No changeset file was added in either of the two commits on this PR.

Files Reviewed (1 file)
  • packages/opencode/src/kilocode/session/prompt.ts — 1 suggestion (in summary)

Fix these issues in Kilo Cloud


Reviewed by claude-4.6-sonnet-20260217 · 494,586 tokens

Review guidance: REVIEW.md from base branch main

Comment thread packages/opencode/src/kilocode/session/prompt.ts Outdated
@johnnyeric johnnyeric force-pushed the johnnyeric/fix-architect-plan-exit branch from 45b1a88 to 4d27232 Compare June 2, 2026 12:31
@johnnyeric

Copy link
Copy Markdown
Contributor Author

Now architect agent will create multiple files if asked.
Screenshot 2026-06-02 at 14 13 23

@johnnyeric johnnyeric enabled auto-merge (squash) June 2, 2026 12:37
@johnnyeric johnnyeric merged commit b7764d6 into main Jun 2, 2026
17 checks passed
@johnnyeric johnnyeric deleted the johnnyeric/fix-architect-plan-exit branch June 2, 2026 12:47
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