Skip to content

fix(prompt): keep homepage drafts global across workspaces - #1216

Merged
Astro-Han merged 6 commits into
devfrom
codex/global-homepage-draft
Jun 9, 2026
Merged

fix(prompt): keep homepage drafts global across workspaces#1216
Astro-Han merged 6 commits into
devfrom
codex/global-homepage-draft

Conversation

@Astro-Han

@Astro-Han Astro-Han commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

Keep the homepage composer draft global while workspace switching only changes the route-backed send target. There is no linked issue; this is a user-reported regression from workspace switch recordings where the prompt text could disappear or bleed through during folder changes.

Why

The previous fix still treated homepage drafts as per-workspace state plus a runtime carryover owner. That made route changes capable of clearing, moving, or briefly exposing the wrong draft. The safer model is simpler: the homepage composer has one stable draft store, and submit captures the current route directory as the target.

Related Issue

None. User-reported regression from local workspace switch recordings.

Human Review Status

Pending

Review Focus

Please focus on the ownership boundary: ordinary homepage drafts should be route-owned/global prompt-store state, pinned deep-link prefills should remain directory-bound, and session routes should remain isolated. Also check the file/context path anchoring when context selected in one workspace is submitted after switching to another.

Risk Notes

Migration now copies the current legacy route-scoped homepage draft into the global flow without deleting the old legacy store, reducing data-loss risk at the cost of leaving an inert old key behind. Screenshots/recordings are not attached because there is no visual styling or copy change; the visible workspace-chip composer path was verified by Playwright E2E. Deleted obsolete draft carryover code and a remove-only migration storage test that no longer applies after migration stopped deleting legacy draft storage.

How To Verify

Focused prompt tests: 434 passed across src/components/prompt-input, src/context/prompt.test.ts, src/pages/session/use-session-commands.test.ts, and src/pages/session/file-tabs.test.ts.
Typecheck: bun run typecheck completed successfully for all 8 turbo tasks.
Workspace chip E2E: 5 passed in e2e/app/composer-workspace-chip.spec.ts, including the new draft-visible/send-target regression.
Diff check: git diff --check reported no whitespace errors.

Screenshots or Recordings

Not attached. This is a behavior fix with no visual styling or copy change; the visible composer workspace switch route was checked through Playwright E2E.

Checklist

  • Type label — this PR carries exactly one of bug, enhancement, task, documentation. Type labels are author-added; the labeler bot does NOT assign them. Add the label in the GitHub UI, then tick this.
  • Routing labels — this PR carries at least one of app, ui, platform, harness, ci. The labeler bot assigns these on PR open based on changed paths. Confirm the bot's choice (or override if wrong), then tick this.
  • Priority label — this PR carries exactly one of P0, P1, P2, P3. The priority-triage bot suggests one on PR open. Confirm or override, then tick this.
  • Human Review Status above is set to Pending, Approved by @<reviewer>, or Not required: <reason> (default is Pending; "not required" is restricted to bot-authored low-risk PRs).
  • I linked the related issue, or stated in Summary why there is no issue.
  • I described the review focus and any meaningful risks.
  • I replaced the example block in How To Verify with the real verification steps and the key result for each.
  • I did not introduce unrelated refactors, dependencies, generated files, or file changes beyond the stated scope.
  • (conditional) I manually checked visible UI or copy changes when needed, with screenshots or recordings. Leave unticked only if no visible UI or copy changed.
  • (conditional) I considered macOS and Windows impact for platform, packaging, updater, signing, paths, shell, or permissions changes. Leave unticked only if no platform/packaging surface was touched.
  • (conditional) I called out docs, release notes, dependencies, permissions, credentials, deletion behavior, generated content, or local file changes when relevant. Leave unticked only if none of those surfaces was touched.
  • I reviewed the final diff for unrelated changes and suspicious dependency changes.
  • I am targeting dev, and my PR title and commit messages use Conventional Commits in English.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Fixed homepage draft preservation when switching workspaces; drafts and file context now properly remain anchored to their originating workspace even after migration.
    • Improved comment routing to use correct file path references while maintaining absolute path consistency.
  • Improvements

    • Simplified draft ownership logic for clearer behavior across route-scoped and pinned drafts.
    • Enhanced file path canonicalization to ensure consistent context handling across the application.

@Astro-Han Astro-Han added bug Something isn't working P1 High priority app Application behavior and product flows ui Design system and user interface labels Jun 9, 2026
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Astro-Han, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 2 minutes and 55 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ed65a03b-bd7f-4f7e-b6b1-ee249fe11aa2

📥 Commits

Reviewing files that changed from the base of the PR and between cee6602 and 9e2ab6f.

📒 Files selected for processing (3)
  • packages/app/src/components/prompt-input/history-comment-map.ts
  • packages/app/src/components/prompt-input/prompt-draft-lifecycle.test.ts
  • packages/app/src/components/prompt-input/prompt-draft-lifecycle.ts
📝 Walkthrough

Walkthrough

This PR removes the portable-draft homepage-consumption API and consolidates draft ownership to pinned + route scopes. It introduces cross-workspace draft persistence via a global homepage storage key, canonicalizes file paths with separate commentPath routing for comments/UI, and simplifies the migration flow from one-shot adoption without legacy clearing.

Changes

Homepage Draft Refactoring: Portable Removal and Path Canonicalization

Layer / File(s) Summary
Path canonicalization and commentPath routing
packages/app/src/components/prompt-input.tsx, packages/app/src/components/prompt-input/comment-routing.ts, packages/app/src/components/prompt-input/history.ts, packages/app/src/pages/session/file-tabs.tsx, packages/app/src/pages/session/use-session-commands.tsx, packages/app/src/pages/session/use-session-comment-context.ts, packages/app/src/pages/session/use-session-comment-context.test.ts
File paths are canonicalized to absolute workspace-scoped form (path) for context persistence across workspace switches, while commentPath preserves the workspace-relative original path for comment routing and UI lookups. Comment routing, history handling, and context item matching now use commentPath when present as a fallback-safe routing key.
Portable draft refactored to migration-only owner
packages/app/src/components/prompt-input/portable-draft.ts, packages/app/src/components/prompt-input/portable-draft.test.ts
Removes consumeForHomepage and hide methods from PortableDraftOwner interface. The owner is now a legacy migration snapshot store (record, restore, clear) without homepage-move semantics. Record logic retains path canonicalization and empty-snapshot clearing. Test coverage narrowed to revision behavior, path canonicalization, and restore/clear operations without move scenarios.
Owner mirror simplified to pinned-only recording
packages/app/src/components/prompt-input/owner-mirror.ts, packages/app/src/components/prompt-input/owner-mirror.test.ts
Removes portable draft from owner mirror effect wiring. Pinned slot is now the single source for draft mirroring on homepage. Tick outcome type updated: replaces recorded-portable with skip-unpinned-homepage when no pinned slot matches the current directory. Corresponding test changes assert pinned state only, removing all portable snapshot assertions.
Submit ownership reduced to pinned + route
packages/app/src/components/prompt-input/submit-ownership.ts, packages/app/src/components/prompt-input/submit-ownership.test.ts
Removes portable from SubmitOwnership union type and detectSubmitOwnership parameters. Homepage ownership now returns pinned (if slot exists and directory matches) or route-scoped prompt store (kind: "route"), eliminating portable fallback. Test coverage updated with explicit "migration snapshot matches directory → returns route" scenario and pinned-match assertions.
Draft lifecycle route-based clearing and restoration
packages/app/src/components/prompt-input/prompt-draft-lifecycle.ts
Removes portable from PromptDraftLifecycleInput. Route-draft clearing now gates on "submitted draft still current" check (prompt equality + context JSON comparison). Route restoration simplified to prompt.context.replaceAll(...) without comment-item restore helper. Portable ownership handling branch removed from both clearInput and restoreInput.
Submit flow removes portable draft
packages/app/src/components/prompt-input/submit.ts
Removes usePortableDraft import and usage. Both detectSubmitOwnership and createPromptDraftLifecycle no longer receive portable draft value; ownership/lifecycle frozen via pinned prefill revision captured before async operations. Queue-path comments clarified (unreachable for homepage submits, synchronous teardown).
Homepage migration simplified to one-shot adoption
packages/app/src/components/prompt-input/homepage-migration.ts, packages/app/src/components/prompt-input/homepage-migration.test.ts, packages/app/src/components/prompt-input/homepage-migration-storage.ts, packages/app/src/pages/layout/layout-homepage-migration.ts
Removes clearLegacyHomepage dependency and no longer clears legacy route-scoped draft after migration adoption. Removes remove operation from RawStorageIO interface. Migration remains idempotent via sentinel; adopts content only when legacy store is non-empty. Test harness simplified to remove cleared-tracking assertions.
Global homepage prompt storage and scope normalization
packages/app/src/context/prompt.tsx, packages/app/src/context/prompt.test.ts
Introduces GLOBAL_HOMEPAGE_PROMPT_STORAGE_KEY and normalizes prompt binding scopes: routes without id load from global homepage directory. createPromptSession routes homepage prompts to global persistent storage; session routes use scoped fallback. Enables draft preservation across workspace switches while keeping session drafts isolated.
Editor input homepage hydration refactored
packages/app/src/components/prompt-input/editor-input.ts
Removes portable.hide() for session routes. Homepage hydration now checks pinned scope first: hydrates pinned when active and draft is empty; otherwise performs one-shot portable.restore() migration only when homepage is empty and restored directory matches. Owner-mirror effect now records pinned slots only.
History comment handling centralized
packages/app/src/components/prompt-input/history-comment-map.ts, packages/app/src/components/prompt-input/history-navigation.ts, packages/app/src/components/prompt-input/history-navigation.test.ts
Centralizes prompt history transformations via buildPromptHistoryComments and buildPromptHistoryCommentRestore. Removes route/portable-specific comment reconstruction. History navigation delegates to centralized helpers. Tests cover path preservation (absolute path, commentPath for metadata keys).
Test cleanup and E2E updates
packages/app/e2e/app/composer-workspace-chip.spec.ts, packages/app/src/components/prompt-input/draft-carryover.test.ts, packages/app/src/components/prompt-input/draft-carryover.ts, packages/app/src/components/prompt-input/draft-isolation.integration.test.ts, packages/app/src/components/prompt-input/homepage-migration-storage.test.ts, packages/app/src/components/prompt-input/pinned-draft.test.ts, packages/app/src/components/prompt-input/pinned-draft.ts, packages/app/src/components/prompt-input/submit.test.ts
Removes draft-carryover.test.ts and homepage-migration-storage.test.ts. Refactors draft-isolation.integration.test.ts to validate homepage draft ownership invariants (route ownership persists despite migration snapshots, pinned beats route when bound, absolute paths anchor context across workspaces). Updates workspace-chip e2e test to assert workspace state via menuitemradio checked property and adds test for draft visibility during target switching. Adds session-creation gate coordination to submit tests. Updates coexistence test naming from portable to migration owner.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Astro-Han/pawwork#1043: Updates submit/draft lifecycle and homepage draft detachment/restore behavior with async failure recovery changes.
  • Astro-Han/pawwork#515: Modifies submit ownership/lifecycle wiring and createPromptSubmit readiness flow in prompt submission.
  • Astro-Han/pawwork#765: Further refines prompt composer isolation codepaths including comment routing, history restoration, and pinned/portable ownership logic.

🐰 With paths now rooted and comments tracked by their home,
Drafts hop freely across workspaces, never alone,
Portable flows fade—pinned and routes share the throne,
While history's whispers remember each zone. 📝✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 24.24% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and specifically describes the main change: making homepage drafts global across workspace switches instead of per-workspace, which directly addresses the user-reported regression.
Description check ✅ Passed The PR description is comprehensive and well-structured. It includes all required sections: Summary, Why, Related Issue (explicitly stating none), Human Review Status, Review Focus, Risk Notes, How To Verify (with specific test results), and a fully completed Checklist.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/global-homepage-draft

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot 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.

Suggested priority: P2 (includes user-path files (packages/app/src/components/prompt-input/draft-carryover.test.ts, packages/app/src/components/prompt-input/draft-carryover.ts, packages/app/src/components/prompt-input/draft-isolation.integration.test.ts, packages/app/src/components/prompt-input/editor-input.ts, packages/app/src/components/prompt-input/history-comment-map.ts, packages/app/src/components/prompt-input/history-navigation.test.ts, packages/app/src/components/prompt-input/history-navigation.ts, packages/app/src/components/prompt-input/homepage-migration-storage.test.ts, packages/app/src/components/prompt-input/homepage-migration-storage.ts, packages/app/src/components/prompt-input/homepage-migration.test.ts, packages/app/src/components/prompt-input/homepage-migration.ts, packages/app/src/components/prompt-input/owner-mirror.test.ts, packages/app/src/components/prompt-input/owner-mirror.ts, packages/app/src/components/prompt-input/pinned-draft.test.ts, packages/app/src/components/prompt-input/pinned-draft.ts, packages/app/src/components/prompt-input/portable-draft.test.ts, packages/app/src/components/prompt-input/portable-draft.ts, packages/app/src/components/prompt-input/prompt-draft-lifecycle.ts, packages/app/src/components/prompt-input/submit-ownership.test.ts, packages/app/src/components/prompt-input/submit-ownership.ts, packages/app/src/components/prompt-input/submit.test.ts, packages/app/src/components/prompt-input/submit.ts, packages/app/src/context/prompt.test.ts, packages/app/src/context/prompt.tsx, packages/app/src/pages/layout/layout-homepage-migration.ts, packages/app/src/pages/session/file-tabs.tsx, packages/app/src/pages/session/use-session-commands.tsx)).

P1/P0 are reserved for maintainer confirmation. Please relabel manually if this is a release blocker, security issue, data-loss risk, or updater/runtime failure.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request transitions the homepage draft model from a per-workspace "portable draft" model to a single global homepage draft model shared across all workspaces. The legacy PortableDraftOwner has been repurposed into a one-shot migration owner that copies legacy per-workspace drafts into the new global homepage prompt store upon first boot. The homepage owner mirror now only tracks pinned drafts, and the portable draft concept has been removed from the submit ownership, history navigation, and draft lifecycle systems. Additionally, file paths in context items and comments are now canonicalized to absolute paths to ensure they remain correctly anchored. I have no feedback to provide as there are no review comments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
packages/app/src/components/prompt-input/homepage-migration.ts (1)

89-92: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

The global completion sentinel strands legacy drafts in unopened workspaces.

This marks migration complete after looking at only currentDirectory, and every later boot exits immediately at Line 90. Any route-scoped homepage draft that lived under another workspace will never be projected into the new global store and becomes effectively unreachable after upgrade. Consider tracking completion per directory, or postponing the global complete state until each visited workspace has been checked.

Also applies to: 121-127

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/app/src/components/prompt-input/homepage-migration.ts` around lines
89 - 92, The migration currently marks the global sentinel complete after only
checking the current directory (readSentinel / existing?.status === "complete"),
which leaves drafts in other workspaces un-migrated; change the sentinel
strategy to be directory-scoped or to defer marking global "complete" until all
visited workspaces are checked — e.g., modify readSentinel/writeSentinel (and
any code using them in homepage-migration.ts, including the logic around lines
referenced and the other block at 121-127) to accept a directory key or to store
a map of completed directories, and update the completion check to verify the
currentDirectory entry (or iterate visited directories) before returning/setting
complete.
packages/app/src/components/prompt-input/portable-draft.ts (1)

87-89: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep the revision counter monotonic across clear → retype cycles.

Because the revision only lives on snapshot, an empty record/reset makes the next non-empty snapshot start back at 1. If a submit captured revision 1, the user clears the draft, types again, and the await resolves, clear(1) will now delete the newer draft because the revision was reused. The stale-clear guard needs a counter that survives clears.

Suggested direction
 export function createPortableDraftOwner(): PortableDraftOwner {
   const [snapshot, setSnapshot] = createSignal<PortableDraftSnapshot | null>(null)
+  let lastRevision = 0
 ...
   function record(input: { sourceFilesystemDirectory: string } & PortableDraftPayload): void {
     if (isPayloadEmpty(input)) {
+      if (snapshot() !== null) lastRevision += 1
       setSnapshot(null)
       return
     }
 ...
-    const nextRevision = (current?.revision ?? 0) + 1
+    const nextRevision = lastRevision + 1
 ...
+    lastRevision = nextRevision
     setSnapshot({
       prompt: canonicalPrompt,
       context: canonicalContext,
       images: input.images,
       resolvedMentions: input.resolvedMentions,
       sourceFilesystemDirectory: input.sourceFilesystemDirectory,
       revision: nextRevision,
     })
   }
 ...
   function clear(expectedRevision?: number): boolean {
     const current = snapshot()
 ...
+    lastRevision += 1
     setSnapshot(null)
     return true
   }

Also applies to: 103-105, 140-155

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/app/src/components/prompt-input/portable-draft.ts` around lines 87 -
89, The snapshot revision must be monotonic across clears: create a persistent
counter (e.g., revisionRef or nextRevision) that lives outside the transient
snapshot state and is incremented whenever you produce a new non-empty snapshot
(use it when calling setSnapshot) so clears/resetting snapshot to null does not
reset the counter; update places that create snapshots (the branch using
isPayloadEmpty and the other snapshot setters around the submit/await logic) to
read and increment this persistent counter and include that revision on the
snapshot object, and update the clear/stale-check code (the clear function and
any resolution handlers that compare revisions) to compare against the
persistent revision-based id on the snapshot rather than assuming snapshot
nulling resets revision.
packages/app/src/pages/session/use-session-comment-context.ts (1)

77-91: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep the original absolute prompt-context path for comment updates/removals.

Lines 83-91 recompute the prompt-context key from the current sourceFilesystemDirectory(). After a comment is added in workspace A and the global homepage draft is then viewed from workspace B, comment.file is still relative (src/a.ts) but the stored prompt-context entry is keyed by the original absolute path (/repo-A/src/a.ts), so updateComment and removeComment will miss the existing item and leave stale comment context behind. Pass the original absolute prompt-context path through these mutation calls instead of deriving it from ambient route state.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/app/src/pages/session/use-session-comment-context.ts` around lines
77 - 91, The update/remove handlers recompute the prompt-context key using
toAbsoluteFilePath(input.sourceFilesystemDirectory(), comment.file) which can
differ from the original absolute key; change these handlers in
use-session-comment-context.ts (functions update and remove) to accept and pass
through the original absolute prompt-context path instead of deriving it from
input.sourceFilesystemDirectory() — i.e., extend the comment payload to include
the stored absolute path (e.g., originalPromptPath or promptContextPath) and
call input.promptContext.updateComment(originalPromptPath, comment.id, ...) and
input.promptContext.removeComment(originalPromptPath, comment.id) (keeping
input.comments.update/remove calls the same) so
input.promptContext.updateComment and input.promptContext.removeComment target
the exact stored key rather than a recomputed one.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/app/src/components/prompt-input/prompt-draft-lifecycle.ts`:
- Around line 58-60: submittedDraftStillCurrent currently demands exact context
equality, but removeSubmittedCommentItems runs before clearInput so
comment-backed items have been stripped and the equality fails; update
submittedDraftStillCurrent to compare a normalized form of the prompt context
and submittedDraft by removing/comment-item-normalizing both sides (or by
running the same removeSubmittedCommentItems transformation on
prompt.context.items(scope) before JSON.stringify) so the guard matches
comment-backed submits; apply the same normalized-comparison change where the
guard is used before calling prompt.reset to ensure clearInput/prompt.reset
executes for submitted comment items.

---

Outside diff comments:
In `@packages/app/src/components/prompt-input/homepage-migration.ts`:
- Around line 89-92: The migration currently marks the global sentinel complete
after only checking the current directory (readSentinel / existing?.status ===
"complete"), which leaves drafts in other workspaces un-migrated; change the
sentinel strategy to be directory-scoped or to defer marking global "complete"
until all visited workspaces are checked — e.g., modify
readSentinel/writeSentinel (and any code using them in homepage-migration.ts,
including the logic around lines referenced and the other block at 121-127) to
accept a directory key or to store a map of completed directories, and update
the completion check to verify the currentDirectory entry (or iterate visited
directories) before returning/setting complete.

In `@packages/app/src/components/prompt-input/portable-draft.ts`:
- Around line 87-89: The snapshot revision must be monotonic across clears:
create a persistent counter (e.g., revisionRef or nextRevision) that lives
outside the transient snapshot state and is incremented whenever you produce a
new non-empty snapshot (use it when calling setSnapshot) so clears/resetting
snapshot to null does not reset the counter; update places that create snapshots
(the branch using isPayloadEmpty and the other snapshot setters around the
submit/await logic) to read and increment this persistent counter and include
that revision on the snapshot object, and update the clear/stale-check code (the
clear function and any resolution handlers that compare revisions) to compare
against the persistent revision-based id on the snapshot rather than assuming
snapshot nulling resets revision.

In `@packages/app/src/pages/session/use-session-comment-context.ts`:
- Around line 77-91: The update/remove handlers recompute the prompt-context key
using toAbsoluteFilePath(input.sourceFilesystemDirectory(), comment.file) which
can differ from the original absolute key; change these handlers in
use-session-comment-context.ts (functions update and remove) to accept and pass
through the original absolute prompt-context path instead of deriving it from
input.sourceFilesystemDirectory() — i.e., extend the comment payload to include
the stored absolute path (e.g., originalPromptPath or promptContextPath) and
call input.promptContext.updateComment(originalPromptPath, comment.id, ...) and
input.promptContext.removeComment(originalPromptPath, comment.id) (keeping
input.comments.update/remove calls the same) so
input.promptContext.updateComment and input.promptContext.removeComment target
the exact stored key rather than a recomputed one.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 94c4e783-081c-43d4-be30-f212f063f289

📥 Commits

Reviewing files that changed from the base of the PR and between 2bb883a and cee6602.

📒 Files selected for processing (33)
  • packages/app/e2e/app/composer-workspace-chip.spec.ts
  • packages/app/src/components/prompt-input.tsx
  • packages/app/src/components/prompt-input/comment-routing.ts
  • packages/app/src/components/prompt-input/draft-carryover.test.ts
  • packages/app/src/components/prompt-input/draft-carryover.ts
  • packages/app/src/components/prompt-input/draft-isolation.integration.test.ts
  • packages/app/src/components/prompt-input/editor-input.ts
  • packages/app/src/components/prompt-input/history-comment-map.ts
  • packages/app/src/components/prompt-input/history-navigation.test.ts
  • packages/app/src/components/prompt-input/history-navigation.ts
  • packages/app/src/components/prompt-input/history.ts
  • packages/app/src/components/prompt-input/homepage-migration-storage.test.ts
  • packages/app/src/components/prompt-input/homepage-migration-storage.ts
  • packages/app/src/components/prompt-input/homepage-migration.test.ts
  • packages/app/src/components/prompt-input/homepage-migration.ts
  • packages/app/src/components/prompt-input/owner-mirror.test.ts
  • packages/app/src/components/prompt-input/owner-mirror.ts
  • packages/app/src/components/prompt-input/pinned-draft.test.ts
  • packages/app/src/components/prompt-input/pinned-draft.ts
  • packages/app/src/components/prompt-input/portable-draft.test.ts
  • packages/app/src/components/prompt-input/portable-draft.ts
  • packages/app/src/components/prompt-input/prompt-draft-lifecycle.ts
  • packages/app/src/components/prompt-input/submit-ownership.test.ts
  • packages/app/src/components/prompt-input/submit-ownership.ts
  • packages/app/src/components/prompt-input/submit.test.ts
  • packages/app/src/components/prompt-input/submit.ts
  • packages/app/src/context/prompt.test.ts
  • packages/app/src/context/prompt.tsx
  • packages/app/src/pages/layout/layout-homepage-migration.ts
  • packages/app/src/pages/session/file-tabs.tsx
  • packages/app/src/pages/session/use-session-commands.tsx
  • packages/app/src/pages/session/use-session-comment-context.test.ts
  • packages/app/src/pages/session/use-session-comment-context.ts
💤 Files with no reviewable changes (3)
  • packages/app/src/components/prompt-input/draft-carryover.test.ts
  • packages/app/src/components/prompt-input/homepage-migration-storage.test.ts
  • packages/app/src/components/prompt-input/draft-carryover.ts

Comment thread packages/app/src/components/prompt-input/prompt-draft-lifecycle.ts Outdated
@Astro-Han
Astro-Han merged commit 6bfc668 into dev Jun 9, 2026
34 checks passed
@Astro-Han
Astro-Han deleted the codex/global-homepage-draft branch June 9, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Application behavior and product flows bug Something isn't working P1 High priority ui Design system and user interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant