Archived
Watch
2
1
Fork
You've already forked embodied-ai
0

flower: retry prompts that pi 1.x rejects without calling preflightResult #40

Closed
turnercore wants to merge 0 commits from flower/preflight-reject-compat into main
Contributor

Splits the one code change that the pi-coding-agent 1.x bump in #39 needs out of that PR. It works on both versions, so it can land first.

The problem. In 1.x, PromptOptions.preflightResult is no longer called when pi rejects a prompt (an auth failure or a missing API key). In 0.84.4 it was called with false. On acceptance, 1.x passes "handled" | "queued" | "started" where 0.84.4 passed true. runtime.mjs checked preflightAccepted === false, so on 1.x a rejected prompt counted as an accepted turn. Flower then failed closed with "outcome is uncertain" and refused every retry. The existing test didn't catch this because its mock still calls preflightResult(false).

The fix. modules/flower/pi/runtime.mjs:276-282 records acceptance as accepted !== false, and a throw is treated as a rejection unless the callback ran.

  • 0.84.4: the callback receives false, so the turn counts as rejected (same behaviour as before).
  • 1.x: the callback never runs, so the turn counts as rejected (fixed).
  • Both versions: a throw after acceptance still fails closed.

Test. runtime.test.mjs adds a case where prompt throws without calling preflightResult; the retry must succeed. I ran it in a throwaway node:22 container with no network:

  • with the fix, 8/8 pass;
  • on the old runtime.mjs, the new case fails.

🤖 Generated with Claude Code

Splits the one code change that the pi-coding-agent 1.x bump in #39 needs out of that PR. It works on both versions, so it can land first. **The problem.** In 1.x, `PromptOptions.preflightResult` is no longer called when pi rejects a prompt (an auth failure or a missing API key). In 0.84.4 it was called with `false`. On acceptance, 1.x passes `"handled" | "queued" | "started"` where 0.84.4 passed `true`. `runtime.mjs` checked `preflightAccepted === false`, so on 1.x a rejected prompt counted as an accepted turn. Flower then failed closed with "outcome is uncertain" and refused every retry. The existing test didn't catch this because its mock still calls `preflightResult(false)`. **The fix.** `modules/flower/pi/runtime.mjs:276-282` records acceptance as `accepted !== false`, and a throw is treated as a rejection unless the callback ran. - 0.84.4: the callback receives `false`, so the turn counts as rejected (same behaviour as before). - 1.x: the callback never runs, so the turn counts as rejected (fixed). - Both versions: a throw after acceptance still fails closed. **Test.** `runtime.test.mjs` adds a case where `prompt` throws without calling `preflightResult`; the retry must succeed. I ran it in a throwaway `node:22` container with no network: - with the fix, 8/8 pass; - on the old `runtime.mjs`, the new case fails. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
flower: treat a prompt rejected without preflightResult as retryable
Some checks failed
ci / currency (pull_request) Has been cancelled
ci / python-tests (pull_request) Has been cancelled
ci / dev-smoke (pull_request) Has been cancelled
ci / production-manifests (pull_request) Has been cancelled
ci / rust-tests (pull_request) Has been cancelled
ci / frontend-tests (pull_request) Has been cancelled
ci / supply-chain (pull_request) Has been cancelled
ci / container-build (pull_request) Has been cancelled
566e52bf0e
pi-coding-agent 1.x no longer calls preflightResult when it rejects a
prompt (0.84 called it with false), and passes a disposition string
instead of a boolean on acceptance. Flower read the missing callback as
an accepted turn and failed closed, refusing retries after an auth or
missing-key rejection. Count the turn as accepted only when the callback
ran with something other than false, which works on both versions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Contributor

Landed in #39 (merged together with the npm audit fixes). Closing.

Landed in #39 (merged together with the npm audit fixes). Closing.
turnercore closed this pull request 2026-10-29 17:45:09 +01:00
Commenting is not possible because the repository is archived.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
daisy/embodied-ai!40
No description provided.