Skip to content

Fix runtime cancellation state and stop controls / 修复运行取消状态与停止控制#4574

Merged
SivanCola merged 2 commits into
esengine:main-v2from
SivanCola:fix/runtime-cancel-recovery
Jun 16, 2026
Merged

Fix runtime cancellation state and stop controls / 修复运行取消状态与停止控制#4574
SivanCola merged 2 commits into
esengine:main-v2from
SivanCola:fix/runtime-cancel-recovery

Conversation

@SivanCola

Copy link
Copy Markdown
Collaborator

Closes #4404
Closes #4107
Closes #3411
Addresses #4066 (the uninterruptible bash process-tree path)

Related: #4522 repairs stale prompt replay after frontend reconciliation. This PR is complementary: it fixes the authoritative runtime/cancel contract and makes Stop reachable while the turn is waiting for approval or ask input.

Summary

  • Added a structured controller runtime snapshot with running, pendingPrompt, backgroundJobs, cancelRequested, and cancellable.
  • Made Cancel() idempotently mark cancellation immediately, clear pending approval/ask prompts, and still settle through the normal turn completion path.
  • Switched desktop tab/runtime metadata to the backend-authoritative snapshot so sidebar/chrome guards and composer state no longer disagree.
  • Kept Stop reachable during approval and ask prompts, including Esc handling inside those pending-decision surfaces.
  • Added regression coverage for approval cancellation, ask cancellation, desktop runtime metadata, frontend runtime reconciliation, and Windows bash child-process tree cancellation.

Verification

  • go test ./internal/control
  • (cd desktop && go test .)
  • (cd desktop/frontend && npm run typecheck)
  • (cd desktop/frontend && npm run test:typecheck)
  • (cd desktop/frontend && npm test)
  • Windows cross-compile of the ./internal/tool/builtin test package passed.
  • go test ./internal/tool/builtin -run 'TestBashCancelReturnsPromptly|TestReapTreeKillsGroupStragglers' -count=1
  • go test ./internal/provider/openai -run TestStreamStallTimesOut -count=1
  • go test ./internal/agent -run TestRunCancelledMidStreamLeavesResumableSession -count=1
  • go test ./... -skip 'TestSandboxEnforcesWrites|TestBashSandboxConfinement'

The skipped root-suite cases are the existing macOS sandbox-enforcement checks that fail independently in this local environment; the cancellation/runtime changes and focused suites passed.

@SivanCola SivanCola requested a review from esengine as a code owner June 16, 2026 04:22
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) skills Skill system (internal/skill, internal/tool) agent Core agent loop (internal/agent, internal/control) labels Jun 16, 2026
@SivanCola

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dbec1cc306

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread desktop/tabs.go Outdated
@SivanCola

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 0a01ccde99

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@SivanCola SivanCola merged commit 9bf9c36 into esengine:main-v2 Jun 16, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control) desktop Wails desktop app (desktop/**) skills Skill system (internal/skill, internal/tool) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [Bug]: 关于会话被中断的问题 [Bug]: 任务中断后无法继续

1 participant