Commit Graph
426 Commits
Author SHA1 Message Date
Chris Scott 23d9d1c945 Move the OpenCode pin and supported floor to 2.3.0 2026-11-17 14:02:14 -05:00
Chris Scott 71bde0378a Remove duplicated and constant-only tests 2026-11-13 15:30:56 -05:00
Chris Scott 80e013ec81 Scope goal reads to the session directory and stabilize the background activity tests 2026-11-13 19:47:13 +00:00
Chris Scott fc00273645 Fix remote session delete, unknown commit responses, restart errors and lost autosave clears 2026-11-13 19:47:12 +00:00
Chris Scott 76ca65ec5e Isolate test state and inject the restart-pending check into config routes 2026-11-13 03:26:58 -05:00
Chris Scott 19ee1d9173 refactor: satisfy no-array-filter-map and no-accumulating-spread 2026-11-13 01:45:13 -05:00
lil-worker-cstech[bot] b9ab85d44c fix: apply 2 pr-agent suggestions
- frontend/src/contexts/EventContext.test.tsx:501 Make the deferred-bootstrap test assert real behavior
- backend/test/services/opencode-single-server.test.ts:352 Restore process env instead of deleting HOME/SHELL

Applied-by: pr-agent-autoapply
2026-11-13 06:19:42 +00:00
Chris Scott b625acfc0c chore(lint): replace ESLint with Oxlint and clear anti-slop findings 2026-11-13 01:13:34 -05:00
Chris Scott bf7c6cdbac fix(opencode): address review feedback on the 2.2.5 pin
Document ocm 0.6.x as requiring OpenCode 2.2.5, matching its
@opencode/theme peer, and make the package compatibility test check
bounded peer ranges instead of treating them as one version.

Linked servers on another 2.x release keep the neutral version notice,
while a different major version is shown as unsupported again through
a shared version badge.

The Docker build now fails when the bundled OpenCode is below the
supported minimum, and the entrypoint falls back to the bundled version
as the floor when OPENCODE_MIN_VERSION is unset instead of discarding
every persisted binary.
2026-11-06 09:43:35 -05:00
Chris Scott 807c7cb896 chore(opencode): move the OpenCode pin to 2.2.5 from a workspace catalog
Manager builds against and requires OpenCode 2.2.5. Every @opencode
package, plus effect and the OpenTUI/solid dependencies they share,
resolves from one pnpm workspace catalog instead of separate pins.

The built-against version and the supported floor are now separate
settings, so a future OpenCode release can move the pin before raising
the floor. Docker and the dev setup script read the floor from its own
argument.

ocm-cli moves to 0.6.0 on the same 2.2.5 and OpenTUI 0.8 baseline. A
linked server on a different version is still connectable and now shows
a neutral version notice instead of an unsupported badge.
2026-11-06 09:26:56 -05:00
Chris Scott 8b6ed7a861 fix: check the Assistant config inside its lock and pass bare stream events through (OM-179)
ensureAssistantMode now checks whether opencode.json exists after taking the file lock, so a conversion that ran in between cannot leave it acting on a stale result.

The browser event stream again delivers a message frame that carries a typed event without the directory envelope, as it did before the client migration, instead of dropping it silently.
2026-11-05 16:43:56 -05:00
Chris Scott 052b501963 fix(backend): exclude dist from the type check (OM-179)
With allowJs enabled and no exclude list, tsc --noEmit included backend/dist/index.js after a build, which crashed the checker with a stack overflow. CI type-checks before building, so the exclusion keeps local runs consistent with CI.
2026-11-05 16:32:43 -05:00
Chris Scott 6297403a41 docs: document the OpenCode client migration surfaces (OM-179)
Adds JSDoc comments to the functions this branch adds or changes, so the touched-code docstring coverage clears the review threshold. Comments only; no code, formatting or import changes.
2026-11-05 16:32:43 -05:00
Chris Scott 64e87ba1ea fix: guard the Assistant config conversion and place agent permission fallbacks after catch-all rules (OM-179)
The Assistant v1-to-v2 conversion now skips the write when OpenCode returns no converted assistant agent for a customized v1 one, or when the converted config fails validation, and it shares a file lock with ensureAssistantMode so the two never overwrite each other.

A new agent wildcard permission rule is inserted after the last catch-all * * rule instead of before it, so the catch-all cannot override it. The event subscription also counts each received event as stream activity.
2026-11-05 16:16:49 -05:00
Chris Scott 670c66f85b fix: add a Default agent permission choice and stop forwarding cookies to OpenCode (OM-179)
Each agent permission select now offers Default, shown when the agent has no wildcard rule for the action. Choosing Allow, Ask or Deny writes an agent rule even when it matches the inherited effect; choosing Default removes the agent's wildcard rules so the global permission applies.

The local OpenCode proxy drops the browser's Cookie header, as the linked-server proxy already does.
2026-11-05 15:58:53 -05:00
Chris Scott 38d618be9b fix: limit the restart-pending 409 to entity patches and keep inherited agent permissions (OM-179)
PATCH /opencode-config refuses only patches that name an agent, command, provider or MCP server while a restart is pending; other keys still apply. The assistant API reference documents the new 409.

The agent dialog adds a wildcard permission rule only for an action whose effect the user changed, so saving an agent no longer overrides an inherited global ask or deny.
2026-11-05 12:43:42 -05:00
Chris Scott 8d92f86142 fix: apply CodeRabbit auto-fixes 2026-11-03 08:29:59 -05:00
Chris Scott 3e6ebbd1dc fix: hold the upstream resync until the OpenCode proxy accepts requests (OM-179) 2026-11-03 00:06:39 -05:00
Chris Scott 9fca96ecea fix: refuse entity saves while a restart is pending and share replay payloads (OM-179) 2026-11-02 23:47:42 -05:00
Chris Scott 8a6fd56e9a fix: keep config references on save and apply review batch 2 fixes (OM-179) 2026-11-02 23:21:33 -05:00
Chris Scott 49bb4ebd36 loop: om-179-finish-adopting-op completed after 19 iterations 2026-11-02 13:13:31 -05:00
Chris Scott fbc3e02208 section 14: Phase 14: Model view models use ModelInfo field names 2026-11-02 12:13:36 -05:00
Chris Scott 0b2303a870 section 11: Phase 11: Assistant Mode writes v2 config; remove the hand-w 2026-11-02 11:20:39 -05:00
Chris Scott 6578e11eeb section 8: Phase 8: Managed effective config read through api.config.ge 2026-11-02 10:36:56 -05:00
Chris Scott 19d4ae25b6 section 7: Phase 7: Entity saves replace the matching v1 entry in the s 2026-11-02 10:32:28 -05:00
Chris Scott 48ca38c4e3 section 6: Phase 6: Config.Info validation owner and v2 config types in 2026-11-02 10:23:14 -05:00
Chris Scott 66b5d1ac06 section 5: Phase 5: Stop buffering in /api/opencode/* 2026-11-02 10:15:37 -05:00
Chris Scott 2b00825b0a section 4: Phase 4: One streaming proxy forwarder used by both proxy ro 2026-11-02 10:11:15 -05:00
Chris Scott 680a336a24 section 3: Phase 3: Remote server events use the registry client; remov 2026-11-02 10:08:00 -05:00
Chris Scott d749084163 section 2: Phase 2: Local SSE aggregator streams through the local Open 2026-11-02 09:57:21 -05:00
Chris Scott 01d8f0825a section 1: Phase 1: Shared reconnecting OpenCode event subscription and 2026-11-02 09:51:53 -05:00
Chris Scott 65066ab0dc feat(schedules): per-schedule switch to keep runs out of the inbox and notifications 2026-10-30 13:11:35 -04:00
Chris Scott 5db74e3fa7 fix(goals): validate the goal RPC output before returning it 2026-10-30 01:03:14 -04:00
Chris Scott cbe92c92ad refactor(goals): replace the Manager session-goal API with OpenCode built-in /goal 2026-10-29 12:38:39 -04:00
Chris Scott 82c46bbdb2 Merge pull request #469 from chriswritescode-dev/feat/schedules-sandbox
feat(schedules): run scheduled jobs in a per-job sandbox microVM
2026-10-25 16:44:02 -04:00
Chris Scott b46dd27e5b fix(schedules): retry run sandbox removal after the session sandbox is turned off mid-run 2026-10-25 16:39:28 -04:00
Chris Scott 060159f10b fix(schedules): validate sandbox only when updated and tear down by the run session's sandbox state 2026-10-25 16:28:40 -04:00
Chris Scott 070cb2f729 feat(schedules): run scheduled jobs in a per-job sandbox microVM 2026-10-25 14:49:38 -04:00
Chris Scott 8747cfece9 fix(notifications): phrase permission labels without losing acronyms
The always-allow summary interpolated the raw action id ("always allow
shell") while every other surface shows the label ("Run Command"), and
the permission dialog lowercased the whole label, turning "Fetch URL"
into "fetch url". getPermissionPhrase lowercases each word of the label
unless it is all caps, and both the scope summary and the dialog
question use it.
2026-10-25 11:20:21 -04:00
Chris Scott a769d3fd34 fix(notifications): reject push registrations from revoked sessions
POST /subscribe re-checks the registering auth session inside the same synchronous transaction as the upsert, so a request accepted before a logout cannot restore a revoked session_id over a newer registration. A stale request gets 401, which the session sync already tolerates.
2026-10-24 19:26:21 -04:00
Chris Scott 6e398c4d40 fix(device-pairing): clean up push subscriptions on admin reset and share URL helpers
The admin password reset finds the admin case-insensitively and deletes the push subscriptions of the sessions it ends. The app re-sends its push subscription once per signed-in session so revoke reaches re-signed-in devices, and the upsert keeps the stored device name. Plain-HTTP and URL parsing checks are shared helpers.
2026-10-24 19:26:21 -04:00
Chris Scott cbe4f7ed9e refactor(auth): reset the admin and count users through the Better Auth adapter
The admin password reset and the first-user check read and wrote the
Better Auth tables with raw SQL, so session delete hooks never ran on the
reset path.

- the admin is found with findUserByEmail and its credential account is
  updated by id with the configured password hasher
- sessions are removed with deleteUserSessions, which runs the session
  delete hooks
- a missing credential account logs a warning instead of updating nothing
- /api/auth-info/config counts users through the adapter
2026-10-24 19:26:21 -04:00
Chris Scott b9d8d18124 fix(device-pairing): refuse to mint pairing codes from an address that cannot pair
A loopback origin in production or plain HTTP on a public address still
minted a code and showed a browser QR no other device could use.

- one availability rule decides untrusted, loopback and public plain-HTTP
  origins; POST /api/device-pairing/links checks it before minting
- GET /api/device-pairing/availability reports the rule for the page origin
  without minting
- Connect a device disables "Show QR code" and explains the fix when the
  address cannot pair
- private-network plain HTTP keeps the browser QR; the app QR still needs
  the toggle
2026-10-24 19:26:21 -04:00
Chris Scott f8e4cfe136 feat(device-pairing): pair phones and browsers with a QR code
Settings -> Account gets "Connect a device", a paired-devices list, and a
remote access headers editor, so the mobile app and other browsers can sign
in without typing a password and pass a reverse proxy such as Cloudflare
Access.

- one-time pairing codes (3 min TTL) minted by a Better Auth plugin and
  redeemed into a new session that records the device name
- POST /api/device-pairing/links builds the ocm://link app link with the
  stored headers as h= parameters and a browser /pair link; plain-HTTP and
  loopback origins are blocked or warned about
- remote access headers are stored encrypted, returned by name only, and
  validated (8 headers, 512-char values, 1800 encoded characters, reserved
  transport names blocked); a Cloudflare Access service token preset fills
  CF-Access-Client-Id and CF-Access-Client-Secret
- login offers "Sign in with QR code" and /pair redeems a scanned code,
  returning to the login redirect target
- revoking a device deletes its session, closes its live connections and
  removes its push subscriptions; the current session cannot be revoked
2026-10-24 19:26:21 -04:00
Chris Scott 5b0e629182 Merge pull request #432 from chriswritescode-dev/feat/repo-secrets
feat(secrets): repository secrets and variables for agent shells and terminals
2026-10-24 19:25:22 -04:00
Chris Scott 92c2d49e5c fix(backend): classify clone auth failures before not-found and isolate server tests from host PIDs
Clone error mapping matched a bare '404' anywhere in git's stderr, so an authentication failure on a URL whose port contained 404 was reported as repository not found. 401 and 404 are now matched as HTTP statuses and authentication is checked first. The single-server tests stub process.kill so they never probe or signal real host processes; PID 1234 existing on a Linux runner made them fail.
2026-10-24 19:15:00 -04:00
Chris Scott 21c60edd09 fix(secrets): collapse legacy scope duplicates on rollback and verify repo worktrees
Rolling back the scope-index migration now keeps the newest of a colliding global and Assistant-repo secret, matching the legacy last-write-wins upsert, so the legacy unique index can be recreated. The repo-env fallback now returns a registered repo only when the directory shares its Git metadata, so a separate clone of the same origin no longer receives the registered repo's secrets; external worktrees still resolve. The migration uses a named export.
2026-10-24 11:06:30 -04:00
Chris Scott e3557f8eec fix(secrets): separate global from assistant-repo scope and require an exact repo root
Global secrets used COALESCE(repo_id, 0), the same key as the Assistant repo (id 0), so same-named values overwrote each other. A new migration rebuilds idx_secrets_scope with a -1 sentinel shared with the upsert target, so databases that already applied the secrets migration upgrade cleanly. Repo env resolution now requires an exact registered git root, so an unregistered nested repository no longer receives its ancestor's secrets.
2026-10-24 10:37:45 -04:00
Chris Scott 4b7652451b fix: order linked-server projects by session activity and stop waking idle projects
OpenCode stamps project time.active whenever a location boots, and directory-scoped requests boot it, so the Manager's reconnect made every idle linked-server project look recently active. Remote projects are now ordered and labelled by their newest session's update time (one global session list per server), falling back to time.updated. Pending permission, form and shell lists, and the backend replay, only run for linked-server directories with running sessions, tracked pending work or the viewed route. The hard-coded status dot on remote project cards is removed.
2026-10-24 00:32:13 -04:00
Chris Scott 3e51280894 fix(secrets): forward only planned variables into the sandbox and cache repo env resolution
The sandbox shim forwards only the plan's pinned names, so turning sandbox Git credentials off withholds tokens. Sandboxed shells resolve repo env once, terminals on linked servers get no local env, mapping keys cannot override git credentials, masks are kept per directory, and directory resolution is cached. A legacy gh-env alias keeps adopted OpenCode processes working for one release.
2026-10-23 23:47:44 -04:00