Skip to content

[codex] Stabilize local workspace comments#344

Merged
hqhq1025 merged 3 commits into
OpenCoworkAI:mainfrom
mussonking:codex/comment-mode-local-workspace-test
May 19, 2026
Merged

[codex] Stabilize local workspace comments#344
hqhq1025 merged 3 commits 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
Co-Authored-By: Claude Opus 4.7 <[email protected]>
@github-actions github-actions Bot added the docs Documentation label May 18, 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: follow-up after new commits

Findings

No new issues introduced in this follow-up. The prior [Minor] finding about the missing changeset has been resolved — .changeset/comment-mode-copy.md is now present with appropriate patch bumps for @open-codesign/desktop and @open-codesign/i18n. All user-facing i18n changes are now covered.

Summary
All material concerns from the initial review are addressed. The PR is directionally sound, well-tested, and ready to merge.

Residual observations

  • The findReusablePendingCommentForSelector / findReusableWorkspaceFileCommentForSelector iteration over the comments array from the end is still O(n) per selection. As noted in the initial review, this is a Nit-level concern and not a blocker. If comment counts grow significantly in the future, a Map<snapshotId+selector, index> could be added for O(1) lookup, but that is a follow-up optimization.
  • No new dependencies, no silent fallbacks, no security concerns. All license checks pass per lockfile.

Testing

  • Not run (automation). Existing and new unit tests cover the added functionality well. CI should pass.

Open-CoDesign Bot

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: follow-up after new commits

Findings

No new issues introduced in this follow-up. The incremental diff is a clean refinement:

  • workspace-watcher.ts: Renamed isPermissionWatchError to shouldFallbackToPolling and added EISDIR to the fallback condition. This correctly handles cases where a workspace directory cannot be natively watched (e.g., certain Windows mounts) by falling back to polling instead of surfacing an error.
  • workspace-watcher.test.ts: Refactored the polling fallback test into a parameterized it.each that now covers both EPERM and EISDIR scenarios. Good test hygiene improvement.

All prior concerns remain resolved: the missing changeset was added, the cancellation race condition was fixed, and the comment-mode UX is well-tested.

Residual observations

  • The EISDIR addition is a minor but sensible edge-case catch. No impact on behavior for normal workflows.

Summary
The PR continues to be directionally sound and well-tested. The incremental changes are safe and improve error resilience. Ready to merge.

Testing

  • Not run (automation). Unit tests cover the new polling-fallback paths. CI should pass.

Open-CoDesign Bot

@hqhq1025 hqhq1025 merged commit 8ea4bff into OpenCoworkAI:main May 19, 2026
6 checks passed
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) docs Documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants