Skip to content

fix: New Workspace session hangs — WorktreeState never transitions to ready #1073

Open

Description

@jeonghun-jj-lee

Important

Problem — Selecting "New workspace" in the session picker creates the worktree and session, but the prompt is held by waitForWorktree which blocks on WorktreeState.wait(). Nothing ever calls Worktree.ready(), so the state stays "pending" indefinitely — the message appears in the UI (optimistic) but never reaches the server, and no agent responds.

Approach — Overlay submit.ts to remove the fragile WorktreeState.pending → wait state machine. After client.worktree.create() succeeds, immediately create the session scoped to the worktree directory and send the prompt — no waiting, matching the robust pattern from amicode_session tool handler (Slice 1, #1060). Add a 30s timeout on worktree.create() itself and surface errors as toasts.

Scope — in: overlay of packages/app/src/components/prompt-input/submit.ts, removal of WorktreeState.pending/wait usage in the new-session worktree path · out: the WorktreeState utility itself (may still be used elsewhere), amicode_session tool changes

Acceptance Criteria

  • An overlay file exists at packages/app-bundle/overlay/packages/app/src/components/prompt-input/submit.ts
  • When worktreeSelection === "create", the handler creates the worktree, then immediately creates the session scoped to the worktree directory and sends the prompt — no WorktreeState.pending() or waitForWorktree blocking
  • Worktree creation failure shows an error toast and aborts (no silent fallback)
  • The sendFollowupDraft before: waitForWorktree guard is removed (or bypassed) for the new-workspace path so the prompt sends immediately
  • Existing behavior for worktreeSelection === "main" and existing-worktree paths is unchanged
  • The overlay file is added to manifest.json with classification M

Prior Art

  • packages/app-bundle/.materialized/packages/app/src/components/prompt-input/submit.ts — the upstream file to overlay
  • packages/app-bundle/.materialized/packages/app/src/utils/worktree.ts — the WorktreeState utility (the broken state machine)
  • packages/extension/src/amicode_tools_core.ts lines 1996+ — the amicode_session handler with the robust worktree flow
  • packages/app-bundle/overlay/packages/app/src/components/prompt-input/ — existing overlays in the same directory

Source

Follow-up to #1059 / #1060

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions