Skip to content

feat(editor,editormcp): Agent panel failure, recovery, and offline states - #1231

Open
houko wants to merge 3 commits into
mainfrom
feat/editor-agent-failure-states-1024
Open

houko wants to merge 3 commits into
mainfrom
feat/editor-agent-failure-states-1024

Conversation

@houko

@houko houko commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

Closes #1024.

Implements the six non-happy-path Agent panel states defined in docs/design/editor/AgentStates.dc.html using exclusively SpecPalette tokens (both Dark and Light appearances), while keeping every manual editing tool (Select, Move, Inspector, CheckProblems, and Play) working in every state.

Summary of Changes

  • Partial (AgentPartialState): renders "Done N of M · couldn't place <target>" with reason, Keep these, Let me point (clicking in the 2D viewport picks world coordinates via PickAgentPointWorld; Esc cancels cleanly), Try another way, and the change-count review strip (N changes · 1 file | +X −Y | Review).
  • Stuck (AgentStuckState): when the same MCP tool (such as scene_edit) fails three times in a row (AgentStuckFailureThreshold = 3), pauses/cancels the active request instead of guessing again, transitions the header chip to Waiting for you, lists all three refused calls with their errors in a recessed monospace log, and offers Hint for the agent with Continue with hint or Stop here (refused edits never touch the scene or disk file).
  • Lost (AgentLostState): when an MCP client drops or a model API fails mid-request, marks the interrupted step "cut off, nothing written", captures completed edits in an unkept AgentTurnReview with no partly written file on disk, shows timestamp and step alongside Reconnect, Review N changes, and Troubleshoot (or Retry now and fallback switching for model errors such as 529 overloaded), and asks before picking up at the next step once reconnected.
  • Stopped (AgentStoppedState): displays DONE and NOT DONE step lists with Resume (starting strictly at the first not-done step without redoing completed steps) and Review N changes; changes stay unkept until reviewed.
  • Mismatch (AgentMismatchReport): checks every turn summary against the actual scene diff (CheckAgentSummaryAgainstDiff) and displays the WHAT · SUMMARY · REVIEW table when they disagree, auto-explaining transient add/remove edits when known, with Ask why and Open review. Keep always applies the actual review diff, never the prose summary.
  • Offline (AgentStatusOffline): displays Disconnected · offline and "You're offline", keeps Select, Move, Inspector, game check, and Play working, queues requests with timestamps and remove actions, and never auto-runs queued items when returning online—each queued request waits for an explicit Send.
  • MCP integration (packages/game/editor/editormcp/server.go): snapshots external edit baselines before ActionEdit calls and records concise call summaries and EditError.Problem messages via Editor.RecordAgentToolCall.
  • Docs, changelog, and note: updated docs/en/editor.md and docs/zh/editor.md (and removed the stray conflict marker), added changelog.d/editor-agent-failure-states.md, and recorded .agents/notes/implemented/feature/2026-11-26-editor-agent-failure-states.md.

Verification

  • env -u GOROOT go tool nsgo check (desktop + -target ios) passed for ./editor, ./editor/editormcp, and ./editor/editorcmd.
  • TMPDIR=/tmp env -u GOROOT go tool nsgo test -run "TestAgent|TestConnectDialog|TestParseClaude|TestLocaleCatalogsComplete" ./editor: 18/18 passed.
  • env -u GOROOT go tool nsgo test ./editor/editormcp: 48/48 passed (including scripted MCP client acceptance tests for 3 failed scene_edit calls pausing the request, dropped connection leaving a review and untouched disk file, Resume after Stop skipping done steps, and summary-vs-diff mismatch).
  • env -u GOROOT go tool nsgo test -target macos -screenshots ... -run TestAgentFailureStatesMacOSScreenshots ./editor/editorcmd: captured and visually inspected real native macOS screenshots for Partial, Partial (pointing), Stuck, Lost, Stopped, Mismatch, and Offline beside docs/design/editor/AgentStates.dc.html.
  • env -u GOROOT go run ./tools/changelog check and bun run verify-notes: passed.

@github-actions github-actions Bot added enhancement New feature or request documentation Improvements or additions to documentation pkg/editor area/agents conflict Conflicts with the target branch; resolve before merging size/XL labels Nov 26, 2026
@houko
houko force-pushed the feat/editor-agent-failure-states-1024 branch from 4508ea6 to 9601581 Compare November 26, 2026 11:17
@github-actions github-actions Bot added conflict Conflicts with the target branch; resolve before merging and removed conflict Conflicts with the target branch; resolve before merging labels Nov 26, 2026
@houko
houko force-pushed the feat/editor-agent-failure-states-1024 branch 2 times, most recently from 869d569 to f51c036 Compare November 26, 2026 12:23
@houko
houko force-pushed the feat/editor-agent-failure-states-1024 branch from f51c036 to 373cd84 Compare November 26, 2026 12:52
@github-actions github-actions Bot added conflict Conflicts with the target branch; resolve before merging and removed conflict Conflicts with the target branch; resolve before merging labels Nov 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/agents conflict Conflicts with the target branch; resolve before merging documentation Improvements or additions to documentation enhancement New feature or request pkg/editor size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editor: what the Agent panel shows when a request is partial, stuck, lost, stopped, mismatched or offline

1 participant