Skip to content

Fix restored todo state across plan seeds / 修复计划待办恢复状态#4313

Merged
esengine merged 5 commits into
esengine:main-v2from
SivanCola:fix/todo-state-integration
Jun 14, 2026
Merged

Fix restored todo state across plan seeds / 修复计划待办恢复状态#4313
esengine merged 5 commits into
esengine:main-v2from
SivanCola:fix/todo-state-integration

Conversation

@SivanCola

@SivanCola SivanCola commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Fixes #4259.

Also closes #4105, #4170, and #4241; addresses #4169.

Supersedes #4159, #4230, #4271, and #4309 with one integrated implementation.

Summary

  • Seed the agent's canonical todo state from approved plan-seed todos so later complete_step calls can advance the visible todo after approval.
  • Rebuild restored desktop history by replaying todo_write and complete_step only when their matching tool result is explicitly successful.
  • Treat restored tool outputs starting with error:, blocked:, Error:, or [error as failures, and treat missing tool results as non-successful instead of silently completed.
  • Hide the todo panel once all todos are complete, while keeping dismissal keyed to stable todo content/state rather than array identity.
  • Add Go and frontend regression coverage for plan seeding, canonical todo rebuild, desktop history replay, restored frontend tool status, and todo panel visibility.

Prior PR Contributions

Thank you to the authors of the related PRs. This integration PR keeps the useful pieces from each one and adds the missing success/error invariants found during review.

The commit includes co-author trailers for @JesonChou, @ashishexee, and @GTC2080.

Review Fixes Added Here

  • Restored history no longer treats failed lowercase error: or blocked: tool results as successful todo_write / complete_step calls.
  • Restored history no longer treats an assistant complete_step call with no corresponding tool result as success; replay now requires an explicit successful RoleTool result.

Verification

  • go test ./...
  • (cd desktop && go test ./...)
  • (cd desktop/frontend && npm run test:typecheck)
  • (cd desktop/frontend && npm run test)
  • (cd desktop/frontend && npm run build)
  • git diff --check

Co-authored-by: JesonChou <51042251+JesonChou@users.noreply.github.com>

Co-authored-by: ashishexee <144021866+ashishexee@users.noreply.github.com>

Co-authored-by: GTC2080 <140309575+GTC2080@users.noreply.github.com>
@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: fb1891b230

ℹ️ 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 internal/control/controller.go
@SivanCola SivanCola enabled auto-merge June 13, 2026 16:17

@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: fb1891b230

ℹ️ 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 internal/agent/agent.go Outdated
Comment thread desktop/frontend/src/lib/useController.ts
@SivanCola

Copy link
Copy Markdown
Collaborator Author

approve

@esengine

Copy link
Copy Markdown
Owner

Thanks for pulling these four PRs together — the integration reads well, and the success/error invariants you added on top (requiring an explicit successful tool result before replaying todo_write/complete_step) are the right call. Reviewed, and CI is green.

One mechanical thing before this can land: #4312 just merged and touches the same files, so package.json now conflicts. It's only the test and test:all script chains, and it's a clean union — please merge main-v2 and keep both sides' additions:

  • from main-v2: reasoning-display, tool-data-archive, render-optimization
  • from this branch: the leading node scripts/test-todo-visibility.mjs and history-tool-status.test.ts (after send-failed)

Everything else (the Go and TS sources) auto-merges cleanly. Once main-v2 is merged in and CI is green again, I'll merge.

@esengine

Copy link
Copy Markdown
Owner

main-v2 has moved on a fair bit since my last note — several PRs landed that touch the same files. Could you merge main-v2 and resolve? The package.json test chain is still the main spot — take the union of both sides' added tests (main-v2 keeps growing it). Once it's green again I'll merge.

@SivanCola

Copy link
Copy Markdown
Collaborator Author

Merged the latest main-v2 into this branch and resolved the package.json script conflict by keeping the union of both test chains: the todo visibility precheck, history-tool-status after send-failed, and the newer main-v2 frontend tests.

Pushed fix commit dc4f86c. Local verification passed:

  • npm --prefix desktop/frontend run test:all
  • go test ./...

GitHub checks are green again.

@esengine esengine merged commit 95d64f7 into esengine:main-v2 Jun 14, 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/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

2 participants