Commit Graph

1 Commits

Author SHA1 Message Date
roboomp 111de5ab71 fix(agent): commit plan-reference flag on delivery, not construction
#buildPlanReferenceMessage set #planReferenceSent = true while building the
message, before it was handed to agent.prompt. Any pre-send setup bail (the
four #promptGeneration generation-bail returns) or throw (@-mention reads,
before_agent_start hooks) between build and delivery left the flag true with
nothing delivered, and the #promptWithMessage finally never cleared it — so the
retry short-circuited at `if (this.#planReferenceSent) return null` and the
approved plan was silently dropped for the rest of the session.

Move the flag commit to the delivery hand-off point in #promptWithMessage: set
it only when a plan-reference message was built AND we are about to call
#promptAgentWithIdleRetry. Every bail/throw now leaves the flag clear so the
next prompt re-injects the plan. The compaction-success resets (issue #1246)
still clear it for re-injection on the next turn.

Fixes #4094
2026-07-23 19:54:52 +00:00