Skip to content

Plan mode "Start new session" handoff no longer specifies plan file name #8478

@shssoichiro

Description

@shssoichiro

Description

In the latest CLI update from yesterday, Plan mode seems to have stopped telling the new Code mode session the filename it wrote the Plan to, so Code mode redoes all the exploratory work. It is writing the file, but the implementation session doesn't know it should read it.

I'll attempt a fix on this shortly, but wanted to have it documented via an issue.

AI Guided Diagnosis:

Most likely causes (distilled)

  1. Primary root cause: handoff architecture changed and dropped explicit plan-file instruction
  • In older plan mode flow (0a3c72d), plan_exit directly created a code-mode user message including:
    • The plan at ${plan} has been approved...
  • In current flow (introduced in 0886ef8), plan_exit no longer performs the handoff; it only signals completion.
  • The handoff now happens in packages/opencode/src/kilocode/plan-followup.ts (startNew()), which builds:
    • Implement the following plan:\n\n${input.plan}
    • optional handover + todo sections
  • No plan filename/path is included in this injected code message.
    So when a new session is created, code mode is not told “read plan file X”.
  1. Secondary contributor: plan path exists but is ignored by follow-up handoff
  • PlanExitTool still returns metadata: { plan } and output text with plan path.
  • PlanFollowup does not consume that metadata/path at all.
  • resolvePlan() prefers assistant text first; if assistant text is non-empty but not the real plan, it may skip the file fallback.

Why this appears “recent”
The regression behavior likely became visible now because recent changes made plan-file writing more consistent, but the Start-new-session handoff still lacks plan-file instruction.
The Apr 1 worktree fix (a2fc2ad) did not change handoff text content; it changed session directory/worktree context only.

Evidence points

  • Current handoff text source: packages/opencode/src/kilocode/plan-followup.ts lines around sections = [\Implement the following plan...`]`
  • Old behavior with explicit path: git show 0a3c72d:packages/opencode/src/tool/plan.ts
  • Transition point: 0886ef8 (“fix(plan): Show implementation suggestions...”) moved handoff logic away from plan_exit
  • Current tests pass but do not assert plan path presence in new-session handoff:
    • bun test test/kilocode/plan-followup.test.ts
    • bun test test/kilocode/plan-exit-detection.test.ts

Diagnosis: The Start new session handoff path no longer carries the plan filename by design since the Feb plan-exit refactor, and no fallback mechanism reintroduces it.

Plugins

No response

Kilo version

latest main

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions