Skip to content

fix: end a run stopped while the operator is asked - #494

Merged
Sequela02 merged 1 commit into
devfrom
fix/stop-permission-prompt
Oct 18, 2026
Merged

Sequela02 merged 1 commit into
devfrom
fix/stop-permission-prompt

Conversation

@Sequela02

Copy link
Copy Markdown
Contributor

Part 7 of the move to Effect became fixing the places in the engine's loop that do not hear a stop (debated with GPT-6 Astra and GPT-6.1 Sol, and measured; the owner approved fixing them directly rather than moving loop.ts to Effect). This is the permission question.

Defect

permitted() (packages/core/src/loop.ts) awaited permissions.ask(call, reason), which takes no signal, and abort() and dispose() await the run. Stopping a run while the operator was asked, and not answering, left abort() waiting until someone answered. Measured: a session whose ask never answers did not end 15 s after the stop.

Reachable through the engine's API (a host that asks and is stopped), not through today's shell: there, Esc with the question open goes to the question and answers no, and a background session's waiting question is refused when it closes.

Change

  • The loop races the operator's answer against the run's stop (untilStopped): a stop ends the wait, records the call as refused ("The run was stopped before the operator answered."), and reports it as stopped. The question itself is left to settle on its own; Permissions.ask keeps its signature, since no host has a stop to pass it today.
  • operatorDecision turns an answer into the decision and reason, which keeps permitted within the lint's complexity limit.

Checks

  • New test in packages/core/tests/permissions.test.ts: a question never answered, a stop, and the run ends aborted, the call not run, the refusal recorded. On dev the run never ends (the test times out); with the change it passes.
  • bun run check locally (Windows): root 264 passed; engine 332 passed, 3 skipped; lint and types clean. The budget fails on shell memory (122 MB, limit 115 MB) on this machine; CI measured 109.6 MB on refactor: run the gate's verification with Effect #487. CI decides.

permitted() awaited the operator's answer with no way to stop, and abort() awaits the run, so a run stopped while a question went unanswered never ended. The loop now races the answer against the run's stop: a stop ends the wait and records the call as refused because the run stopped. Found by Sol reading loop.ts and by measuring stops at each point of a run.
@Sequela02
Sequela02 force-pushed the fix/stop-permission-prompt branch from fc66ab0 to e7eec86 Compare October 18, 2026 15:40
@Sequela02
Sequela02 merged commit 3cd1cb2 into dev Oct 18, 2026
9 checks passed
@Sequela02
Sequela02 deleted the fix/stop-permission-prompt branch October 18, 2026 19:14
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.

1 participant