fix(loops): backfill directory from root session on create #185

Merged
dries merged 1 commit from fix/loop-empty-directory into main 2026-06-30 20:54:48 +02:00
Owner

Summary

  • A loop created without an explicit directory (the MCP create_loop tool makes it optional) was invisible in the project-scoped Loops sidebar (which filters by directory) and failed prompt_root/spawn actions with an opaque "error" — the action had no directory to launch OpenCode in.
  • Service.Create now backfills the directory from the root session via a new SessionDirResolver dep when none is supplied. REST and MCP both route through Create, so both paths are covered.

Testing

  • go test ./internal/loops/ ./internal/server/ ./internal/mcp/
  • New: TestCreate_BackfillsDirectoryFromRootSession, TestCreate_KeepsExplicitDirectory
## Summary - A loop created without an explicit directory (the MCP `create_loop` tool makes it optional) was invisible in the project-scoped Loops sidebar (which filters by directory) and failed `prompt_root`/`spawn` actions with an opaque "error" — the action had no directory to launch OpenCode in. - `Service.Create` now backfills the directory from the root session via a new `SessionDirResolver` dep when none is supplied. REST and MCP both route through `Create`, so both paths are covered. ## Testing - `go test ./internal/loops/ ./internal/server/ ./internal/mcp/` - New: `TestCreate_BackfillsDirectoryFromRootSession`, `TestCreate_KeepsExplicitDirectory`
fix(loops): backfill directory from root session on create
All checks were successful
CI / Frontend (pull_request) Successful in 3m33s
CI / Backend (pull_request) Successful in 4m38s
CI / Playwright E2E (pull_request) Successful in 7m23s
CI / Build (pull_request) Successful in 5m48s
CI / Coverage Ratchet (pull_request) Successful in 7m11s
CI / Build Desktop (macOS arm64) (pull_request) Successful in 49s
CI / Semantic Tag (pull_request) Has been skipped
fab44c152e
A loop created without an explicit directory (the MCP create_loop tool
makes it optional) was invisible in the project-scoped Loops sidebar
(filtered by directory) and failed prompt_root/spawn actions with an
opaque "error" because the action had no directory to launch in.

Create now resolves the directory from the root session via a new
SessionDirResolver dep when none is supplied. REST and MCP both route
through Create, so both paths are covered.

Coverage ratchet: pass

Suite Baseline This PR Δ
go 69.50% 69.50% +0.00
frontend 58.30% 58.30% +0.00

Tolerance: -0.1%. Baseline stored on gh-pages.

<!-- coverage-ratchet --> ### Coverage ratchet: ✅ pass | Suite | Baseline | This PR | Δ | | |---|---|---|---|---| | go | 69.50% | 69.50% | +0.00 | ✅ | | frontend | 58.30% | 58.30% | +0.00 | ✅ | _Tolerance: -0.1%. Baseline stored on `gh-pages`._
dries merged commit 8bd543c40b into main 2026-06-30 20:54:48 +02:00
Sign in to join this conversation.
No description provided.