fix(coding-agent): gate plan.defaultOnStartup on empty session history

The startup plan-mode auto-entry gated on the CLI-derived `resuming` flag
(continue || resume || fork). But `omp --continue` with no recent session
calls SessionManager.continueRecent(), which creates a fresh, empty session
while `resuming` stays true — so the new setting was skipped on what is really
a brand-new session.

Gate on the actual signal instead: this.sessionManager.getEntries().length === 0,
the same "has prior history" check the auto-resume path already uses. A session
that opens empty (new, or a continue/auto-resume that found nothing) honors the
default; one with restored history keeps its reconciled mode. Removed the now-dead
`resuming` InteractiveModeInitOptions field and its init() argument (the runtime
flag is still used for setup-scene selection). Updated the regression test to
seed real history and corrected the CHANGELOG wording.
This commit is contained in:
ephraimduncan
2026-06-05 10:59:21 +00:00
parent 8eea28dddc
commit df114ae042
5 changed files with 20 additions and 17 deletions
@@ -116,10 +116,15 @@ describe("InteractiveMode plan.defaultOnStartup", () => {
expect(session?.getPlanModeState()).toBeUndefined();
});
it("does not enter plan mode when the session is resumed", async () => {
it("does not enter plan mode when the session has restored history", async () => {
// A genuinely resumed session has prior entries; gating on getEntries()
// (not the CLI resume flag) means a `--continue` that created a *fresh*,
// empty session still gets the startup default (the "enters" case above),
// while one with restored history is left in its reconciled mode.
const created = createHarness(Settings.isolated({ "plan.defaultOnStartup": true, "compaction.enabled": false }));
created.sessionManager.appendMessage({ role: "user", content: "prior turn", timestamp: Date.now() });
await created.init({ suppressWelcomeIntro: true, resuming: true });
await created.init({ suppressWelcomeIntro: true });
expect(created.planModeEnabled).toBe(false);
expect(session?.getPlanModeState()).toBeUndefined();