Skip to content

fix(app): use worktree inventory for session accents - #45506

Merged
Hona merged 1 commit into
anomalyco:v2from
Hona:sunny-harbor
Aug 27, 2026
Merged

Hona merged 1 commit into
anomalyco:v2from
Hona:sunny-harbor

Conversation

@Hona

@Hona Hona commented Aug 27, 2026

Copy link
Copy Markdown
Member

Summary

  • Detect existing-session workspaces from the shared project inventory enriched by the worktree API, using the same project selector as the timeline.
  • Keep the raw project accessor used by review and metadata consumers unchanged. No new cache, fetch, path rule, API change, or CSS change.
  • Add full-app regression coverage for enabled Send buttons, inventory updates, and unchanged local/disabled/Stop styling.

Reproduction and Cause

  1. Return a project whose raw sandboxes is empty from /api/project.
  2. Return its canonical directory and a linked Git workspace from /api/worktree/{projectID}.
  3. Open an existing session located in that workspace and enter a draft so Send is enabled.

Before this change, the button remains neutral. useSessionModel().workspace.current() classified the session against raw client project metadata, which lacks the discovered workspace. Global sync already enriches project inventory with the worktree response, and the timeline already uses that inventory.

The regression runs the production app route, client synchronization, session model, and composer against isolated API fixtures. Before the fix, the managed-worktree and live-inventory-update checks failed on the actual rendered button background; the local-root control passed. All pass with the fix.

Coverage

  • Canonical and nested local directories remain neutral.
  • Internal and external Git worktrees receive the accent, including nested paths and Windows casing/separators.
  • An unregistered sibling with the same path prefix remains neutral.
  • Other worktree strategies and registered directories without a strategy retain existing classification behavior.
  • A worktree.updated event refreshes the button without navigation or losing the draft.
  • Disabled Send and Stop remain neutral; an enabled follow-up becomes accented.
  • Narrow-screen rendering and existing local/workspace user-message colors are checked.

Validation

Run from packages/app on Windows:

  • bun run test:unit: 543 passed.
  • bun run test:browser: 56 passed.
  • bun test ./e2e/performance/unit: 48 passed.
  • bun typecheck and bun run typecheck:e2e: passed.
  • Production Chromium E2E: workspace-accent.spec.ts, composer-command-draft.spec.ts, new-session-workspace-branch.spec.ts, and prompt-thinking-level.spec.ts: 14 passed, one worker, no retries.
  • Prettier and git diff --check: passed. Scoped Oxlint: no errors; two pre-existing consistent-return warnings on unchanged lines in model.ts.
  • Normal pre-push hook: 33 package typecheck tasks passed, with hooks enabled.

The test captures a fixture-only composer screenshot in its Playwright report. Before/after screenshots were inspected locally: neutral before, blue after. GitHub image upload was unavailable in this environment.

Performance

Production session-tab-switch benchmark, serial Chromium execution, three samples per scenario before and after. Baseline: 8252897a33. All 15 samples passed in each phase. No wrong-destination or unknown samples; no blank samples in cached scenarios.

Median sampled DOM observation times, milliseconds:

Scenario First correct before First correct after Stable before Stable after
Unmounted, review closed 137.7 120.5 229.7 196.8
Unmounted, review open 127.2 98.6 197.0 169.6
Cached, review closed 34.1 30.7 103.0 102.4
Cached, review open 37.5 32.7 116.1 105.2
Cached, review open, resized 46.3 40.6 170.2 164.6

No timing regression was observed in this small local sample; this is not a performance-improvement claim or a packaged Electron benchmark. Raw benchmark logs and observations were retained locally.

Evidence Limits

The installed 0.0.0-beta-18371 message-bubble behavior is separate: its commit predates #45486. This PR does not duplicate that restoration or change the installed executable.

Validation used the real production renderer with controlled API fixtures, not the installed desktop end to end. The installed frontend cache was not inspected, and stale frontend refresh or server corruption is not claimed as the cause. No existing desktop or OpenCode service restart was initiated for validation.

Requested by: @Hona (Hona via Slack)

@Hona
Hona requested a review from Brendonovich as a code owner August 27, 2026 06:56
Copilot AI lite review requested due to automatic review settings August 27, 2026 06:56

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Hona
Hona enabled auto-merge (squash) August 27, 2026 06:56
@Hona
Hona merged commit 2af02d0 into anomalyco:v2 Aug 27, 2026
10 checks passed
jinhuang712 pushed a commit to jinhuang712/opencode that referenced this pull request Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants