Skip to content

fix(web): prepared worktrees attach to the project's mapped draft, not the invoking draft #6

Description

@Artic0din

Problem

openOrReuseProjectDraftThread in apps/web/src/components/ChatView.tsx always reuses the draft currently mapped to the project, not the draft the user started from.
When a project has more than one retained draft (for example after New thread while an older draft still has text), starting from an older draft navigates to and rewrites the other draft's worktree context and prompt.
The setup-script RPC is given the invoking draft's thread ID, so the setup script and the navigated draft can disagree.

This affects both Checkout pull request and Start work from issue; both call the same opener.

Expected

The prepared worktree attaches to the draft that started the action, or the action explicitly creates a new draft, and the setup script runs for that same thread.

Source

Raised by Codex review on #5 (comment 4182817116). Not fixed there because the behaviour is shared with the existing PR checkout flow.

Activity

  1. Artic0din commented on Oct 5, 2026

    @Artic0din
    OwnerAuthor

    Triage

    Verdict: Confirmed on current main (5cebd3b8). Shared draft-opener behaviour matches the reported bug.

    What I checked

    Not a duplicate of #3 (feature) or #7/#8 (server path/cwd).

    Likely code: openOrReuseProjectDraftThread + logical-project draft mapping in ChatView.tsx / draft session stores.

    Fix direction: Prefer attaching prepared worktree context to the invoking draft thread ID (or explicitly create a new draft), and ensure setup-script RPC thread ID matches the draft that receives the prompt. Add a multi-retained-draft regression test.

    Workaround: Keep only one retained draft per project, or start the action from the already-mapped draft.

    Outcome: ready-for-agent — clear repro shape and fix locus on main.


    Generated by Claude Code

  2. added
    ready-for-agentSpecified sufficiently for implementation and verification
    on Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-for-agentSpecified sufficiently for implementation and verification

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions