Skip to content

fix(web): resolve optimistic edit refresh race - #753

Merged
pancacake merged 1 commit into
HKUDS:devfrom
szzhoujiarui:260802-fix-edit-message-refresh-race
Aug 6, 2026
Merged

fix(web): resolve optimistic edit refresh race#753
pancacake merged 1 commit into
HKUDS:devfrom
szzhoujiarui:260802-fix-edit-message-refresh-race

Conversation

@szzhoujiarui

Copy link
Copy Markdown
Contributor

Description

Fix the first edit attempt for a recently persisted non-initial user message. loadSession() now returns its hydrated message snapshot, and the edit flow resolves an optimistic negative ID from that snapshot directly instead of immediately reading a stale React state ref.

A focused regression test covers the race where the local state still contains the optimistic ID after the refresh has returned the persisted message.

Related Issues

Module(s) Affected

  • agents
  • api
  • config
  • core
  • knowledge
  • logging
  • services
  • tools
  • utils
  • web (Frontend)
  • docs (Documentation)
  • scripts
  • tests
  • Other: ...

Checklist

  • I have read and followed the contribution guidelines.
  • My code follows the project's coding standards.
  • I have run pre-commit run --all-files and fixed any issues.
  • I have added relevant tests for my changes.
  • I have updated the documentation (if necessary).
  • My changes do not introduce any new security vulnerabilities.

Additional Notes

Validation completed:

  • npm run test:node: 367 tests passed
  • node ./node_modules/typescript/bin/tsc --noEmit: passed
  • ESLint on the three changed files: passed
  • git diff --check: passed

The repository-wide ESLint run currently reports existing errors in unrelated modules; this change adds no lint findings in the files it modifies.

@pancacake
pancacake merged commit 525a171 into HKUDS:dev Aug 6, 2026
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