Skip to content

fix(goal): protect V1 foreground chat from stale concurrent Goal writes (#275) - #280

Merged
ByBrawe merged 4 commits into
mainfrom
fix/v1-chat-stale-write-20261019
Oct 27, 2026
Merged

ByBrawe merged 4 commits into
mainfrom
fix/v1-chat-stale-write-20261019

Conversation

@ByBrawe

@ByBrawe ByBrawe commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Scope / reproduction

Issue #275 includes a deterministic GoalStoreConcurrencyError(kind=stale_write) in chat.message when a wrapper/progress writer commits between the core Goal load/save. This change fixes only the two V1 foreground/owned chat execution-context writes rather than merging the broader external PR #276 without trusted CI.

Changes

  • Add bounded (1–8 attempts, default 6) mutateGoal fresh-snapshot helper in persistence. Retry only stale_write, rethrow lock owner, unsafe path, corrupt state, all other errors unchanged.
  • Rebase V1 chat.message execution context onto freshest Goal. Re-check the exact turn owner for authorized turns; guard Goal ID and revision for normal user steering so a replaced Goal cannot receive stale context updates.
  • Deterministic competing writer interleaving regression in test/adapter.test.mjs, direct cross-writer merge and retry-budget tests in test/store-concurrency.test.mjs.

Verification required

Resolves immediate V1 chat reproduction for #275 only after passing CI.

Copilot AI balanced review requested due to automatic review settings October 19, 2026 20:53

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T20:55:21.559316Z 7bae80e PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

2 participants