feat(mobile): create "No project" sessions from the composer and Home

Merged
SA
2mo ago
+161-138

Links

Summary

  • The mobile composer's project picker offers "No project" first, like desktop's picker. Sending creates a project-less session through the host's workspaces.createSession, the backend desktop already uses.
  • Home's "No project" section gets a "+" that preselects it and focuses the composer.
  • That section now ranks by activity like any project and actually collapses. The creating screen skips worktree steps for a session.

Why / Context

Desktop has had project-less sessions since #6274 (host 1.19.0, below the 1.21.0 floor), but mobile could only create into a project. On a host with no projects the composer had nothing to create into at all.

How It Works

  • NewChatTarget.projectId becomes string | null. Null means "No project", matching desktop's projectId === null convention. targetKeyFor(null, machineId) keys it as none:<machineId>, so the last pick persists like any other.
  • useNewChatTargets adds the "No project" target per online host, sorted first, only once that host's project.list has answered. Otherwise it's briefly the only target, becomes the default, and a quick send starts a session where the last-used project was meant.
  • useCreateTerminalWorkspace calls createSession when projectId is null, and createEnqueued (with the legacy create fallback) otherwise. The optimistic flow is unchanged: mint the id, push the workspace screen, poll until the row and terminal appear, retry from the failed state. After a synchronous create both paths refetch the host's workspace and terminal lists (refetchCreated), so the screen doesn't wait for the next poll.
  • NewChatWidget: no branch query or branch chip for a session, and no letter avatar on the chip.
  • HomeScreen: "No project" is built as one of the sections instead of a separate block appended at the bottom. So it ranks by activity and uses the collapse store, which its caret already wrote to but the list never read.
  • WorkspaceCreatingState: a session shows Preparing → Starting <agent> with ~10s typical, instead of fetch/worktree steps that never happen.

Manual QA Checklist

iPhone 17 Pro Max sim (iOS 26), production API, host satyas-mbp 1.29.0. Screenshots of each are on the linked page.

  • Home shows "No project" (2 existing sessions) with the box icon and "+", ranked among projects by activity
  • "+" on "No project" focuses the composer with "No project" preselected, with no branch chip or avatar
  • Picker lists "No project" first and checked. Picking Boid Home restores its avatar and main chip; picking "No project" again removes them
  • Send → "Creating workspace · No project", Preparing → Starting Claude. Agent running ~8s after send
  • Host lists the result as type: session at ~/.superset/sessions/sedate-teacher, with an AI title. Claude replied to the prompt
  • Back on Home the new session leads "No project" (count 3)
  • "No project" caret collapses and re-expands the section
  • Test session deleted with superset ws delete --local; folder removed
  • Not exercised: relay 30s timeout on a session create (see Known Limitations), host offline, attachments on a session create

Testing

  • bunx turbo run typecheck --filter=@superset/mobile: no errors in touched files. The only failures are the known local-only unref errors in packages/port-scanner and packages/workspace-fs
  • bunx biome check apps/mobile packages/i18n
  • bun test in apps/mobile: 94 pass
  • bun run check:i18n: 0 missing in every locale. No new strings; the catalog diff drops mobile's ~{TYPICAL_SECONDS}s typical duplicate because it now reuses desktop's ~{totalSeconds}s typical

Design Decisions

  • "No project" in copy, not "session": in mobile's UI "session" already means a terminal tab ("New session", "Manage sessions"), so the new UI never says "session". Code still uses isSession, matching the backend.
  • No enqueued variant for sessions: createSession is synchronous on the host, and desktop calls it synchronously too. It has no worktree work, so it's well under the relay cap in practice.

Known Limitations

  • A session create is one request, so the relay's 30s cap applies as it does to creates on older hosts. If it times out, the screen shows the "unknown" failure and keeps polling, which heals it when the row lands. createSession is idempotent on the optimistic id.

Summary by cubic

Lets the mobile composer and Home create "No project" sessions, matching desktop's project-less workspaces. Previously mobile could only create into a project, so on a host with no projects the composer had nothing to create into.

  • The composer's project picker lists "No project" first, and the Home section of the same name gets a "+" that preselects it and focuses the composer.
  • "No project" joins the target list only after the host's project list resolves, so it can't briefly become the default and intercept a quick send.
  • Sending calls the host's workspaces.createSession; the optimistic create flow is unchanged, and both create paths refetch the host's workspace and terminal lists after a synchronous create.
  • The Home "No project" section ranks by activity like any project and honors its collapse state, which it previously stored but never applied.
  • Session creates skip the fetch and worktree steps in the creating screen and show a shorter Preparing → Starting <agent> flow.
  • NewChatTarget.projectId is now string | null, where null means "No project"; the last pick persists via a none:<machineId> key, and the composer shows no branch chip or avatar for sessions.

Known Limitations

  • A session create is a single request, so the relay's 30-second cap applies; if it times out, the screen shows the unknown failure, retries on the same id, and keeps polling, which heals it when the row lands.

Summary by CodeRabbit

  • New Features

    • Added a “No project” option for creating standalone sessions.
    • No-project sessions now appear alongside regular project sections and can be created directly.
    • Added distinct icons and navigation behavior for standalone sessions.
  • Bug Fixes

    • Improved session creation progress states with session-specific preparation messaging and timing.
    • Updated localized duration estimates to use the correct value consistently.