Skip to content

[codex] Stabilize local workspace comments#344

Open
mussonking wants to merge 1 commit into
OpenCoworkAI:mainfrom
mussonking:codex/comment-mode-local-workspace-test
Open

[codex] Stabilize local workspace comments#344
mussonking wants to merge 1 commit into
OpenCoworkAI:mainfrom
mussonking:codex/comment-mode-local-workspace-test

Conversation

@mussonking
Copy link
Copy Markdown
Contributor

Summary

This PR stabilizes comment mode for local workspace previews and fixes a few related local-workspace edge cases found during manual testing.

What changed

  • Saves comments independently from sending them to the agent.
  • Adds an explicit “send to chat” queue so saved-only comments stay in the Comments panel until the user sends them.
  • Reuses the existing pending comment for the same selection instead of creating duplicates.
  • Reopens saved comments with their text prefilled from both the main preview and Files / App.jsx preview.
  • Re-pins/highlights the target element when a saved comment is opened from the Comments panel.
  • Closes stale comment bubbles when the underlying comment is deleted or when leaving the workspace view.
  • Keeps stop/cancel from being undone by late generation stream events.
  • Treats missing/renamed workspace watcher paths as recoverable so they do not surface as renderer errors.

Why

Local workspace comment mode had a few state mismatches between the preview iframe, saved comment rows, and the renderer store. These could leave the UI in stale states: saved comments not appearing in the bubble, duplicated comments on the same selection, deleted comments leaving an orphaned bubble, and saved comments opening without the target element highlighted.

Validation

  • Full pre-push checks passed: workspace typecheck, lint, and full test suite.
  • Targeted desktop tests passed around comments, preview panes, file previews, store behavior, cancellation, and file watcher recovery.
  • Runtime overlay tests cover the saved-comment highlight path, including body-relative XPath selectors.
  • Manual testing covered save, reopen, delete, add-to-chat, apply, stop, and leaving the workspace.

@github-actions github-actions Bot added the area:desktop apps/desktop (Electron shell, renderer) label May 13, 2026
@hqhq1025 hqhq1025 added the bot-rerun Temporary label to rerun automation label May 17, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Review mode: initial

Findings

  • [Minor] Missing changeset for user-visible i18n changes. The PR renames button labels from "Send to Claude" to "Add to chat" and "Comment" to "Save comment", and adds new i18n keys (sendToChat, addedToChat). These are user-facing changes that require a changeset per project convention. Run pnpm changeset, select patch for @open-codesign/i18n and @open-codesign/desktop, and describe the changes. This ensures the changelog and release notes are accurate.
    Suggested fix:

    pnpm changeset

    Then commit the generated .md file.

  • [Nit] The findReusablePendingCommentForSelector and findReusableWorkspaceFileCommentForSelector functions iterate over the comments array from the end for each element selection. If a design accumulates hundreds of comments, this could become a minor performance bottleneck. Consider storing a map from snapshotId+selector to comment index for O(1) lookups if this becomes noticeable. Not a blocker.

Summary
No blockers, security issues, or data-loss risks found. The PR correctly separates comment saving from sending, adds a queued-comment model, reuses existing pending comments per selector, handles cancellation robustly, and treats missing workspace watcher paths as recoverable without spurious error toasts. Test coverage is excellent across main-process, renderer, and runtime overlay layers. The only actionable issue is the missing changeset.

Testing

  • Not run (automation). The PR adds extensive unit tests for store, helpers, and overlay behavior. CI should pass.

Open-CoDesign Bot

@hqhq1025 hqhq1025 removed the bot-rerun Temporary label to rerun automation label May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:desktop apps/desktop (Electron shell, renderer)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants