Skip to content

fix: keep plan runs active while questionnaire input is pending#95

Open
kesslerio wants to merge 3 commits into
pwrdrvr:mainfrom
kesslerio:fix/plan-pending-questionnaire-run-lifecycle
Open

fix: keep plan runs active while questionnaire input is pending#95
kesslerio wants to merge 3 commits into
pwrdrvr:mainfrom
kesslerio:fix/plan-pending-questionnaire-run-lifecycle

Conversation

@kesslerio
Copy link
Copy Markdown

What

  • keep an active run registered while Codex is still waiting on pending questionnaire input
  • move the duplicated cleanup work behind one small controller helper
  • add a regression for the /cas_plan questionnaire path

Why

/cas_plan could ask the first question and then drop the run that was supposed to receive the answer. The questionnaire stayed visible, but answering it failed with No active Codex run is waiting for input.

The controller was cleaning up the run as soon as the initial turn result settled, even when Codex was still blocked on requestUserInput. This patch keeps the run alive until that pending input actually clears, then cleans it up normally.

Tests

  • pnpm test src/controller.test.ts
  • pnpm typecheck
  • pnpm test

AI assistance

Codex drafted the patch and regression. I reviewed the cleanup logic, the repro, and the test results before opening the PR.

Fixes #93

@kesslerio
Copy link
Copy Markdown
Author

Follow-up patch for the pending-input lifecycle fix.

The first version kept the run alive long enough for questionnaire callbacks to get through, but it could still leave a restored run behind after the last answer. This update closes that hole.

What changed:

  • restored runs are now marked as already settled when they come back after the original path
  • questionnaire submission now triggers the same final cleanup path once the pending request is gone
  • late pending input from an older run is ignored if a newer run is already active for the conversation

Coverage added:

  • restored questionnaire run is cleaned up after submission
  • older late questionnaire input cannot replace a newer active run

Verified with:

openclaw-codex-app-server@0.0.0 test /home/art/worktrees/openclaw-cas-plan
vitest run src/controller.test.ts

 ELIFECYCLE  Test failed. See above for more details.
 WARN  Local package.json exists, but node_modules missing, did you mean to install?

openclaw-codex-app-server@0.0.0 typecheck /home/art/worktrees/openclaw-cas-plan
tsc --noEmit

 ELIFECYCLE  Command failed.
 WARN  Local package.json exists, but node_modules missing, did you mean to install?

openclaw-codex-app-server@0.0.0 test /home/art/worktrees/openclaw-cas-plan
vitest run

 ELIFECYCLE  Test failed. See above for more details.
 WARN  Local package.json exists, but node_modules missing, did you mean to install?

@kesslerio
Copy link
Copy Markdown
Author

Follow-up patch for the pending-input lifecycle fix.

The first pass kept the run alive long enough for questionnaire callbacks to get through, but it could still leave a restored run behind after the last answer. This update closes that hole.

What changed:

  • restored runs now remember that the original run had already settled
  • questionnaire submission now runs the same final cleanup path once the pending request is gone
  • late questionnaire input from an older run is ignored if a newer run is already active for the conversation

Coverage added:

  • restored questionnaire runs are cleaned up after submission
  • older late questionnaire input cannot replace a newer active run

Verified with:

  • pnpm test src/controller.test.ts
  • pnpm typecheck
  • pnpm test

@Yehonal
Copy link
Copy Markdown

Yehonal commented Apr 16, 2026

Thanks for this PR! I have a similar issue, however, after the first question CAS automatically replies to me that I have not selected any question. Does it happen to you as well?

Anyway is this project still alive? there are so many unanswered PR/issues lately. I love this plugin and I'm extensively using it every day.

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.

bug: cas_plan questionnaire callbacks lose active run after the first question

3 participants