|
5 | 5 |
|
6 | 6 | --- |
7 | 7 |
|
| 8 | +## [2026-05-26] — Fix sidecar startup crash (missing openid-client + otpauth + ALLOW_SHARED_OPENCODE) |
| 9 | + |
| 10 | +**Status:** Done |
| 11 | +**Agent:** Sisyphus (OpenCode) |
| 12 | + |
| 13 | +### What was done |
| 14 | +- Sidecar was crashing at startup with `ERR_MODULE_NOT_FOUND: Cannot find package 'openid-client'`. Root cause: `apps/api/src/services/sso.ts` imports `openid-client` and `apps/api/src/routes/totp.ts` imports `otpauth` — both declared in `apps/api/package.json` but not installed in `node_modules`. |
| 15 | +- Ran `pnpm install` at workspace root to pull the missing packages (`+17` packages installed). |
| 16 | +- Sidecar was also immediately exiting after recovery due to multi-user guard (`OPENLINEAR_ALLOW_SHARED_OPENCODE` not set, 4 users in DB). Added `OPENLINEAR_ALLOW_SHARED_OPENCODE=1` to `.env` for the dev machine. |
| 17 | +- Verified sidecar now starts cleanly: binds port 3001 + 1455, runs recovery, and stays up. |
| 18 | + |
| 19 | +### Files changed |
| 20 | +- `.env` — added `OPENLINEAR_ALLOW_SHARED_OPENCODE=1` |
| 21 | +- `pnpm-lock.yaml` — updated by `pnpm install` (openid-client, otpauth, and transitive deps) |
| 22 | + |
| 23 | +### Issues encountered |
| 24 | +- None after the fix. |
| 25 | + |
| 26 | +### Next steps / blockers |
| 27 | +- None. `pnpm dev-live` / `pnpm start` should now boot the sidecar without crashing. |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## [2026-05-26] — Model provider onboarding step + execution model-not-configured guard |
| 32 | + |
| 33 | +**Status:** Done |
| 34 | +**Agent:** Sisyphus (OpenCode) |
| 35 | + |
| 36 | +### What was done |
| 37 | +- Added a 4th onboarding step "AI Model" with Back / Finish setup / Skip buttons. Team creation now advances to the new step instead of completing directly. Both Finish and Skip complete onboarding; Skip shows a toast directing the user to Settings. |
| 38 | +- Built `ModelProviderStep` component that shows live provider status fetched from the sidecar, lists connected providers, and links to Settings → AI Providers. Handles sidecar-unavailable gracefully (shows retry + lets user skip). |
| 39 | +- Added `pickAutoDetectedModel()` pure helper and `ensureModelConfigured(userId)` service in the sidecar. Auto-detection priority: anthropic → openai → google → openrouter → first connected. When a provider is authenticated but no model is selected, the function picks and persists the provider's default model automatically. |
| 40 | +- Updated `GET /api/opencode/setup-status` to run auto-detection and return `hasProvider` + `hasModel`. `ready` is now `hasProvider && hasModel` (previously only `hasProvider`), so it correctly reports false when a provider is connected but no model is selected. |
| 41 | +- Added pre-flight `ensureModelConfigured` check to `POST /api/tasks/:id/execute` and `POST /api/batches`. Returns `400 { code: 'MODEL_NOT_CONFIGURED', details: { hasProvider } }` with a human-readable message instead of silently starting a doomed agent. |
| 42 | +- Added `isModelNotConfiguredApiError()` helper in `lib/api/model-errors.ts` to detect the new error code on the frontend. |
| 43 | +- Updated single-execute path (`use-kanban-board.ts`) and batch-execute path (`use-batch-execution.ts`) to catch `MODEL_NOT_CONFIGURED` — toast the specific message and reopen the provider setup dialog automatically. |
| 44 | +- Provider setup dialog now distinguishes "no provider" vs "provider connected but no model selected" in toasts. |
| 45 | + |
| 46 | +### Files changed |
| 47 | +- `apps/sidecar/src/services/opencode-model.ts` — new file: `pickAutoDetectedModel`, `ensureModelConfigured` |
| 48 | +- `apps/sidecar/src/routes/opencode.ts` — `setup-status` uses auto-detect, exposes `hasProvider`/`hasModel`, stricter `ready` |
| 49 | +- `apps/sidecar/src/routes/execution.ts` — pre-flight model check on single execute |
| 50 | +- `apps/sidecar/src/routes/batches.ts` — pre-flight model check on batch create |
| 51 | +- `apps/desktop-ui/lib/api/opencode.ts` — `SetupStatus` extended with `hasProvider`/`hasModel` |
| 52 | +- `apps/desktop-ui/lib/api/model-errors.ts` — new file: `isModelNotConfiguredApiError`, `readModelNotConfiguredDetails` |
| 53 | +- `apps/desktop-ui/components/board/use-kanban-board.ts` — MODEL_NOT_CONFIGURED handling in single execute + retry path |
| 54 | +- `apps/desktop-ui/hooks/use-batch-execution.ts` — MODEL_NOT_CONFIGURED handling in batch execute; improved provider/model-specific toasts |
| 55 | +- `apps/desktop-ui/components/onboarding/steps/onboarding-utils.ts` — added "AI Model" to STEP_LABELS |
| 56 | +- `apps/desktop-ui/components/onboarding/steps/model-provider-step.tsx` — new file: onboarding step 3 UI |
| 57 | +- `apps/desktop-ui/components/onboarding/onboarding-wizard.tsx` — wired step 3, `handleFinishOnboarding`, `handleSkipOnboarding`, step clamp bumped to 3 |
| 58 | + |
| 59 | +### Issues encountered |
| 60 | +- Pre-existing unrelated typecheck failures in `apps/api/` (`totp.ts`, `invitations.ts`, `sso.ts`, `tasks.ts`) for half-built features missing Prisma models and npm packages. Left untouched per protocol. |
| 61 | + |
| 62 | +### Next steps / blockers |
| 63 | +- Manually verify: complete onboarding on a fresh workspace → should land on AI Model step → Finish or Skip both enter the app. |
| 64 | +- Manually verify: try executing a task/batch with no model configured → should get clear toast + provider dialog opens. |
| 65 | +- Consider adding a "model configured" status indicator somewhere on the board (e.g., a subtle warning badge on the Execute buttons when `!status.ready`). |
| 66 | + |
| 67 | +--- |
| 68 | + |
8 | 69 | ## [2026-05-24] — Add Electron desktop wrapper for Linux (fixing WebKitGTK scroll/font issues) |
9 | 70 |
|
10 | 71 | **Status:** Done |
|
0 commit comments