New-session draft shows no model picker when its folder was deleted · Issue #56476 · anomalyco/opencode · GitHub
Skip to content

New-session draft shows no model picker when its folder was deleted #56476

Open

Description

@rohankc69

Description

If a new-session draft points at a folder that no longer exists (for example a worktree removed with git worktree remove from a terminal), the draft still shows the composer, but every location request returns LocationNotFoundError. The composer stays in its loading state, so the model and variant controls never appear and nothing says why. Sessions already handle this with a "Session location unavailable" notice; drafts don't.

Plugins

None

OpenCode version

dev (8c173a8)

Steps to reproduce

  1. Create a worktree from the new-session screen and leave a draft on it.
  2. Remove the worktree outside the app.
  3. Reopen the draft: no model/variant controls; the workspace chip says "No Git".

Screenshot and/or share link

No response

Operating System

macOS

Terminal

Desktop app

Activity

  1. opencode-agent commented on Oct 17, 2026

    @opencode-agent
    Contributor

    Thanks for the clear report. I could reproduce this on dev at 8c173a8, which is also the newest dev commit.

    I ran the app UI in Chromium against a mock server, with one new-session draft whose folder was gone. Every location request returned LocationNotFoundError, as you describe. I couldn't run the macOS desktop app here.

    The draft still showed the composer, but the model/variant control never appeared, nothing explained why, and the workspace chip said "No Git". The screenshot and recording below show this, and the Playwright spec below reproduces it.

    Your PR #56477 addresses exactly this case; maintainers will review it.

    recording.mp4

    Screenshot

    Reproduction script (issue-56476.spec.ts)
    // Reproduction for anomalyco/opencode#56476: a new-session draft whose folder is gone.
    // Copy to packages/app/e2e/reproduction/ and run from packages/app:
    //   bunx playwright test e2e/reproduction/issue-56476.spec.ts --project chromium
    import { expect, test } from "@playwright/test"
    import { draftHref } from "../utils/app"
    import { mockMissingLocation } from "../utils/mock-server"
    import { mockWorkspace } from "../utils/workspace"
    
    test("draft on a removed folder shows the model picker or a missing-folder notice", async ({ page }) => {
      const gone = "C:/OpenCode/DraftGone-removed-worktree"
      await mockWorkspace(page, {
        name: "DraftGone",
        sessions: [],
        fileList: () => [],
        seed: { tabs: [{ draft: "draft_gone", directory: gone }] },
      })
      // Every request for the removed folder fails the way the server answers for a missing Location.
      await mockMissingLocation(page, gone)
      await page.goto(draftHref("draft_gone"))
    
      await page.waitForTimeout(8000)
      await page.screenshot({ path: "/workspace/repro/issue-56476-draft.png" })
    
      const notice = page.getByText(/unavailable/i)
      const model = page.locator('[data-action="composer-model"]')
      console.log("composer editor count:", await page.locator('[data-component="composer-editor"]').count())
      console.log("model control visible:", await model.isVisible())
      console.log("unavailable notice count:", await notice.count())
      // Expected: either the model control or an explanation. Bug: neither appears.
      await expect(model.or(notice).first()).toBeVisible({ timeout: 2000 })
    })

    Run it: bun issue-56476.spec.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions