Skip to content

fix: keep completed reviewed actions terminal on replay - #37

Merged
davidmckayv merged 5 commits into
CopilotKit:mainfrom
kvnloo:fix/completed-action-replay
Sep 26, 2026
Merged

davidmckayv merged 5 commits into
CopilotKit:mainfrom
kvnloo:fix/completed-action-replay

Conversation

@kvnloo

@kvnloo kvnloo commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

What changed

Fixes #36.

The action layer already treats an idempotency replay as the same logical action and can return an existing succeeded proposal. The task/model layer previously treated that returned proposal as though it were a fresh review, reinstalling actionId and setting the task back to waiting_approval.

This patch preserves the terminal receipt:

  • AgentService.prepare() returns an already-succeeded proposal without checkpointing it back into the task.
  • terminal non-success review states remain explicit errors rather than becoming a new review.
  • prepare_email / prepare_event treat a succeeded replay as an existing receipt, checkpoint approvalResult, keep actionId clear, and allow the model run to continue.
  • ordinary awaiting_review behavior is unchanged.

The regression forces the model to call the exact same prepare_event after the reviewed action has succeeded, then verifies there is still exactly one action, the task never ends in a fresh approval state, and the existing receipt is visible to the continuing model run.

Verification

  • Reviewed the branch against current main at 82ff35b.
  • Existing tests/actions.test.ts already pins that an idempotent proposal replay returns the completed action without a second provider preparation.
  • Added a model-worker regression for the missing task/model boundary.
  • Repository tests were not run locally because this execution environment cannot clone/install the repository; CI on this PR is the executable verification.

Integration limits

Fixture-only model/action regression; no live Google write was performed.

AI-use note: I used an AI assistant to trace the reviewed-action state machine, draft the regression and patch, and review the final diff. I verified the replay behavior against the existing action-level idempotency regression before opening this PR.

@davidmckayv

Copy link
Copy Markdown
Contributor

Needs one change before merge. The new test in tests/model-worker.test.ts builds createApp without intelligenceApiKey, so on current main it fails with "OpenMuse requires CPK_INTELLIGENCE_API_KEY". Add intelligenceApiKey: "test-project-key-never-sent", after agentBackend: "model", in that test's config, and remove the trailing blank line at the end of the file.

@kvnloo kvnloo closed this Sep 26, 2026
@kvnloo
kvnloo force-pushed the fix/completed-action-replay branch from 3f1ddc1 to 82ff35b Compare September 26, 2026 01:59
@kvnloo kvnloo reopened this Sep 26, 2026
@kvnloo kvnloo closed this Sep 26, 2026
@kvnloo
kvnloo force-pushed the fix/completed-action-replay branch from da854c2 to 205cc38 Compare September 26, 2026 02:11
@kvnloo kvnloo reopened this Sep 26, 2026

@davidmckayv davidmckayv left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The missing Intelligence test setting is fixed. The merge conflict preserves both this replay regression and the browser-evidence regression from #29. Local lint, typecheck, all 16 focused tests, and the server build pass; merging is gated on the current CI run.

@davidmckayv
davidmckayv merged commit 34b15bc into CopilotKit:main Sep 26, 2026
7 checks passed
markhiltonapps pushed a commit to markhiltonapps/openmuse that referenced this pull request Sep 27, 2026
Brings in five fixes from CopilotKit/OpenMuse main:
- keep browser evidence identity separate from session identity (CopilotKit#29)
- suggest the openai/ prefix for gateway model IDs (CopilotKit#55)
- alert on every failure streak of a watch, not just the first (CopilotKit#60)
- show the browser as offline when its worker is unreachable (CopilotKit#64)
- keep completed reviewed actions terminal on replay (CopilotKit#37)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MfTjvNDS5CdhPPisYxjwAv
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] Replaying a completed prepared action can regress a task to waiting_approval

2 participants