Routes prefixed with /api/opencode-proxy/ and /api/internal/ authenticate
via Bearer/CF-Access headers rather than cookies. These routes are now
allowed to reflect any origin in the CORS response since they don't rely
on cookie-based trust.
Also added CF-Access-Client-Id and CF-Access-Client-Secret to the allowed
headers list.
* fix(mirror): reject empty commit uploads
* refactor(mirror): unify totalParts validation into shared predicate
Consolidate the duplicated positive-integer check and error message into
isValidTotalParts/TOTAL_PARTS_INVALID_MESSAGE, reused by the commit route
and extractPartsToStaging. Validate totalParts before the session lookup to
match the parts route, and update the delete-session test to use a valid
totalParts so it unambiguously covers the 404 path.
---------
Co-authored-by: Chris Scott <99081550+chriswritescode-dev@users.noreply.github.com>
Executes recommendations from a comprehensive test suite audit.
Removes dead, redundant, and trivial tests; rewrites SessionDetail
polling test to exercise real gating; trims duplicated assertions;
adds missing assertion in assistant-loading tests.
13 files changed, 233 insertions(+), 462 deletions(-)
* feat: add schedule permission config and workspace tracking
Adds permission configuration for scheduled jobs (migration 016) and
workspace ID tracking on schedule runs (migration 017). Includes
service logic, UI controls, schema updates, and full test coverage.
* refactor: convert permission ruleset to object format, exclude active schedule worktrees from sibling repos
* refine: reduce destructive bash patterns to host-level commands only
* feat: add schedule worktree isolation for running jobs in isolated worktrees
* feat: schedule worktree isolation for running jobs in isolated worktrees
* feat: show worktree/branch artifact counts in clear history confirmation
* feat: validate and select base branches for schedule worktrees
* feat: add repo rename capability with custom name field
Add a custom name field to repos, allowing users to set a display name
independent of the repo URL or path. Includes a migration, PATCH endpoint,
rename dialog, and display name consolidation.
- DB migration 014 adds name column to repos table
- PATCH /api/repos/:id endpoint with Zod validation
- RenameRepoDialog component with clear/reset support
- RepoRowActions gains Rename action in both dropdown and inline modes
- getRepoDisplayName() consolidated to accept a repo object and prefer name
- All repo name display call sites updated to use the new API
* fix: add DialogTitle to RenameRepoDialog for a11y compliance
* refactor: extract getRepoDisplayName to shared utils, fix schedule cache invalidation on rename
* feat: show variant label on model picker and add folder upload for agents/commands
- Replace three-dot variant menu trigger with selected variant label
- Add POST /api/settings/opencode-directory-files/install endpoint
- Upload agents/commands markdown folders into .config/opencode/{agents,commands}/
- Reload OpenCode server after upload so files are picked up
* fix: revalidate branch/git caches when mobile sheet opens and on vcs.branch.updated SSE
- add shared invalidateRepoGitCaches() helper for consistent invalidation
- revalidate repo list when mobile repo quick-switch sheet opens
- revalidate current repo when mobile More drawer opens
- revalidate repo/git caches when Source Control dialog opens
- handle vcs.branch.updated SSE event with optimistic cache update
- use helper in branch create/switch mutations in useGit and BranchesTab
* style: make variant selector look more like a button with chevron and compact sizing
* refactor: consolidate settings editors, add folder upload support, and clean up unused code
* refactor: consolidate settings editors, add folder upload support, and clean up unused code
* feat: add opencode-directory-files listing service and consolidate settings editors
* fix: distinguish scroll from tap in suggestion popups on touch devices
* refactor: consolidate settings editors and add DirectoryFilesList component
* refactor: target repo status cache updates only to affected batch entries
* refactor: streamline settings, git hooks, and query invalidation logic
* refactor: move assistant workspace install before OpenCode server start
* refactor: skip assistant-mode status fetch on open, use repo fullPath and cached session
* fix(schedules): clean up orphaned schedule records and add schedule URL state management
* refactor(schedules): consolidate schedule tab state into useScheduleUrlState
* fix(schedules): cascade delete schedule runs/jobs and preserve assistant schedules in orphan cleanup
* refactor(schedules): replace deleteJobsByRepo with prepareRepoDelete, add lightweight ID query, remove dead mock
* refactor(schedules): consolidate PromptTemplateDialog form state into single object
* feat(schedules): support scheduling jobs for the Assistant workspace
* refactor(schedules): extract assistant repo constants, rename workspace to schedule-target
* feat(navigation): add schedules link to session drawer menu
* fix(schedules): document Assistant repoId=0 in generated schedule-management skill
* feat(mirror): enable gzip compression for repository mirror transfers
* fix(mirror): remove stale uncompressed progress, centralize gzip flag, dedupe test mocks
* chore(mirror): drop dead progress update() method and unused phase field
* chore(ocm-cli): bump version to 0.1.4
* test(backend): replace better-sqlite3 test mock with node:sqlite
Reimplement the bun:sqlite test mock on top of node:sqlite with an
explicit BEGIN/COMMIT/ROLLBACK transaction wrapper.
* feat(assistant): self-configuring assistant mode
Add a self-editable assistant workspace and the APIs that support it:
- POST /assistant/reload disposes and re-bootstraps the assistant
instance (directory-scoped, rate-limited) so agent.md edits apply.
- Internal settings API accepts non-secret TTS/STT patches via
dedicated partial schemas.
- Strip the generated agent persona from opencode.json on repair so
user-customized agents are preserved across config recovery.
- Cache the last assistant session id to avoid redundant session
listing on launch.
* style(repo): align worktree and workspace tabs with primary/orange theme
* feat(session): paginated session list with infinite scroll and search
Replace per-directory useQueries session listing with a combined
cursor-based useInfiniteQuery (25 per page, loads more on scroll) and
move search into the API query instead of client-side filtering.
Add OpenCodeClient.listSessionsPage backed by the v2 /api/session
endpoint plus a toLegacySession adapter. Add invalidateSessionListCaches
to centralize session-list cache invalidation for infinite queries, and
update EventContext and useSSE to handle the new infinite-query cache
shape.
* fix(session): centralize and debounce session-list cache invalidation
Migrate ResetPermissionsDialog off the stale per-directory cache key
(which no longer matches the infinite-query key shape and hardcoded the
opencode URL) to the shared invalidateSessionListCaches helper, and drop
the now-unused repoDirectory prop and its call sites.
Debounce session-list invalidation on SSE session.updated events in
EventContext and useSSE so a burst of updates coalesces into a single
refetch instead of one per event. Fix the directory fallback in
EventContext getClient so it never returns the joined directory key.
* fix(permissions): scope instance dispose to the repo directory
Drop the session-list cache invalidation from ResetPermissionsDialog:
disposing the OpenCode instance does not change the persisted session
list, so the refetch was unnecessary, and the prior cache key no longer
matched the paginated shape.
Guard the reset-permissions route against an empty repo directory so it
never forwards /instance/dispose without a directory, which would
dispose the entire server instead of only the repo's instance.
* loop: worktree-tabs-2 completed after 4 iterations
* loop: server-env-vars completed after 7 iterations
* feat(worktree): add worktree tabs and server env vars settings
* refactor(worktree): multi-directory SSE support and workspace chip row
* feat(workspace): collapsible workspace manager and sibling filtering
* feat(workspace): workspace creation endpoint, refactored workspace manager, and tests
* refactor(frontend): unify workspace label and remove dead code
- extract shared workspaceLabel helper into api/repos and reuse in
WorkspaceManager and RepoDetail directoryLabels
- remove unused useSessions hook and subscribeToDirectory subscription
- drop redundant frontend workspace dedup now guaranteed by backend
- align WorktreeTabs empty-state test with create-workspace button
* fix: repo directory name collisions and custom directory support
Allow users to specify a custom directory name when adding a remote repo, preventing collisions when cloning a fork of an already-cloned repo.
- Add shared validation and normalization utilities (shared/src/utils/repo.ts)
for directory name sanitization, URL normalization, and path safety
- Replace duplicated sanitizeWorkspaceAliasSegment with shared helper
- Backend validates directoryName before use as filesystem path
- Frontend detects directory collisions with normalized URL comparison
- Move SSH credential setup after DB record creation
* add backend origin validation and base-directory collision detection
* fix potential ReDoS in repo url and directory name normalization
* loop: transfer-progress completed after 5 iterations
* feat(transfer): progress tracking for mirror upload with tests
* chore(ocm-cli): bump version to 0.1.3
* chore: remove dead code and unused exports
* fix: preserve model form during config refresh
Signed-off-by: mehmet turac <mehmetturac@gmail.com>
* loop: model-select-fix completed after 11 iterations
* fix(frontend): show provider prefix for duplicate models in quick select dropdown
When the same model exists under multiple providers, show the provider name
for both entries so users can distinguish them. Detects duplicates by modelID
across all favorites and recents.
* refactor(frontend): replace useTallScrollContent with scroll visibility hook
* fix: harden mirror push rollback
* Remove Load button from skill cards, clicking card loads skill
* feat(backend): add plugin installation support and schema updates
* refactor(frontend): remove unused useHeaderScrollVisibility hook
* refactor(frontend): replace model dropdown with bottom sheet selector
Replace DropdownMenu-based ModelQuickSelect with a bottom sheet
implementation featuring favorites, recents, provider browsing, and
search. Remove onShowModelsDialog prop from PromptInput and
SessionDetail, using data attribute trigger instead. Fix ZodIssueCode
deprecation, input text color, and portal rendering for bottom sheet.
* fix(frontend): simplify session model restore and fix mobile swipe reset
* loop: single-source-models completed after 10 iterations
* refactor(frontend): add desktop sidebar layout to model quick select
* refactor(frontend): improve model selector with connected providers, favorites, and recent management
* fix(frontend): constrain model name width to prevent overflow in prompt input
* fix(frontend): adjust padding and styling in model quick select
* fix(frontend): add optimistic removal with rollback for recent models
---------
* fix: enable swipe-back suspension on more drawer and remove unused variable
* refactor(frontend): improve dialog component and settings navigation
* fix: disable route swipe suspension in MoreDrawer to prevent unintended navigation
* fix(frontend): enable swipe-back suspension on more drawer route
* refactor(frontend): improve mobile navigation drawer and tab bar
* feat: add schedules service and workspace hook with navigation updates
* chore: add workspace hook, schedules library, and tests
* fix: prevent MoreDrawer sentinel from undoing navigation
* feat: per-agent model selection and UI refinements (#217)
* feat: per-agent model selection and UI refinements
- Add agentModels store with setAgentModel/getAgentModel
- PromptInput uses session model priority and stores agent model on change
- useContextUsage derives model from assistant message instead of global
- Migrate sub-agent/subtask badges from purple to blue with refined styling
- Fix MoreDrawer sentinel to skip history-back on navigation
* refactor: improve per-agent model selection and task tool call status indicators
* feat: add repo management skill and internal repos API
* fix: improve assistant session launcher and UI components
* fix: update atomic-json test assertions
* refactor: split Assistant Mode instructions between AGENTS.md and assistant.md
* loop: todo-header-mobile completed after 3 iterations (#218)
* loop: stt-perf-1 completed after 5 iterations
* fix: load audio worklet per recording context
* fix: canonicalize assistant navigation routes
* fix: adjust scroll-up threshold for header visibility
* fix: update settings and skills handling with assistant redirect
* refactor: simplify context usage indicator and extract token sum helper
* feat: add currently selected model row to popover and fix responsive truncate
* feat: add persistent model state storage with database backend
- Create opencode_model_state table for storing user model preferences
- Implement database-backed model state management (recent, favorite, variant)
- Add atomic JSON file utilities with file locking for concurrent safety
- Migrate providers routes from file-based to database storage
- Add backfill migration to preserve existing model.json data
- Include comprehensive tests for model-state and atomic-json modules
- Refactor useSessionAgent hook to simplify agent/model resolution logic
- Update getFileApiUrl to use consistent query parameter approach
* fix: include workspace dependencies in Docker image
* fix: overlay workspace node_modules after source to prevent layer overwrite
* fix: ensure model state table exists for existing databases
* feat: add model state persistence and improve model selection sync
- Add setActiveModel to modelStore and useModelSelection for direct model updates
- Sync session agent model/variant to store when messages load
- Include model, agent, and variant in optimistic user messages
- Fix useSessionAgent to check isFetching during message loading
- Update env.ts to use getter for BASE_PATH for dynamic resolution
- Fix test environment variable from OPENCODE_WORKSPACE_PATH to WORKSPACE_PATH
* refactor(frontend): extract VoiceStatusOverlay component and improve swipe tracking
- Extract voice status overlay to dedicated VoiceStatusOverlay.tsx component
- Move pointer event handlers from button to container for larger swipe surface area
- Users can now initiate swipe gesture from anywhere in the container, not just the button
* refactor(frontend): add SSE delta support and improve status synchronization
- Add SSEMessagePartDeltaEvent type for streaming delta updates
- Add SSESessionCreatedEvent type for session creation events
- Implement directory filtering for SSE events to prevent cross-contamination
- Add version tracking for status snapshots to ignore stale responses
- Replace individual status updates with atomic replaceStatuses operation
- Refactor parts batcher to use unified operation queue with delta support
- Clear stale statuses on initial snapshot and directory changes
- Add tests for status snapshot clearing and stale response handling
* refactor: remove auto-restart from assistant mode and fix mobile sheet close behavior
Stop restarting OpenCode after assistant mode initialization since the
startup error logic is no longer needed. Also fix the repo quick switch
sheet to stay open when launched from the mobile tab bar, preventing
unwanted navigation away from the sheet.
* refactor(frontend): improve speech-to-text UI
* fix(backend): normalize git credential extraheaders
* fix(frontend): remove permission immediately after responding
Call removePermission synchronously after a successful API response,
matching the existing pattern used by replyToQuestion and rejectQuestion.
This ensures the UI updates promptly even if the SSE permission.replied
event is delayed or missed.
---------
Co-authored-by: Chris Scott <>
* fix: sync model selection with OpenCode state
* feat(model): add favorites system for model selection
- Add toggleFavoriteModel API endpoint
- Add favorite toggle UI in ModelQuickSelect and ModelSelectDialog
- Show provider name prefix when model display names are ambiguous
- Fix directory scoping for getProviders API calls
feat(assistant): send welcome message on new session creation
- Send setup guidance message when creating new assistant session
---------
Co-authored-by: Chris Scott <>
Replace direct opencodeServerManager calls with a supervisor that
provides health polling, operation locking, and a 4-step recovery
pipeline (restart, debug capture, rollback, seed default config).
Add archiveBrokenConfig to SettingsService for backup before rollback.
Wire supervisor into all route factories with graceful fallback to
direct manager calls. Add health watch configuration defaults and
env vars.
* feat: add assistant mode integration and fix test environment
- Add assistant-mode service for managing assistant workspace files (AGENTS.md, opencode.json)
- Add backend GET/POST routes for assistant-mode status and initialization
- Add AssistantRedirect page and useAssistantSessionLauncher hook
- Update mobile navigation to include Assistant tab (replaces Alerts)
- Fix React.act compatibility by setting NODE_ENV=test in vitest config
- Add shared Zod schemas for AssistantMode types and requests
* feat: enhance assistant mode with session list view and legacy config migration
- Add session list view for assistant mode with full workspace management
- Migrate legacy opencode.json permission format to granular permissions
- Enable assistant navigation from mobile tab bar and repo switcher
- Preserve assistant context in session routes via query params
- Auto-restart OpenCode server after assistant mode initialization
- Add comprehensive tests for legacy config detection and navigation
- Add baseBranch parameter to cloneRepo and createWorktreeSafely
- Create CreateWorktreeDialog component for dedicated worktree creation
- Add Create Worktree action to RepoRowActions and RepoDetail page
- Update BranchesTab to use CreateWorktreeDialog
- Allow specifying base branch when creating worktrees
- Add plugin detection to determine if server restart is required when config changes
- Extend health check timeout to 120s when plugins are configured (from 30s)
- Implement retry-once logic for plugin installations that may cause initial startup failure
- Check agent, plugin, skills, and provider fields for restart decisions (previously only agents)
- Improve frontend toast messages to distinguish between restart and apply scenarios
- Set XDG_CACHE_HOME in Dockerfile for proper cache directory management
- Extract getFileApiUrl helper with options interface for type-safe URL building
- Handle paths containing '.' and '..' segments via query parameters
- Remove duplicate URL construction logic from FileBrowser, FilePreview, and FileTree components
- Add getSpecialRoutePathFromRequest helper in backend for consistent path extraction