feat(sessions): set model, agent, reasoning and permissions at creation (#270) #275

Merged
dries merged 2 commits from feat/270-session-creation-settings into main 2026-07-09 20:35:56 +02:00
Owner

Summary

  • Programmatic session creation can now set agent and reasoning (not just model) plus an optional permission ruleset applied at create time.
  • MCP new_session: new agent, reasoning, permission params.
  • Agent loops: create_loop gains agent/reasoning/permission; threaded through spawn/prompt actions; persisted via migration v20 (agent, reasoning, permission_rules).
  • Messenger.SendPrompt extended to carry agent+reasoning; sessionsvc.Client.SetPermissionRules passthrough.
  • REST /api/loops needs no change (decodes straight into LoopSpec/LoopUpdate).

Design notes

  • Permission input is a raw rule list and replaces the child's ruleset outright.
  • No child≤parent subset check: the MCP server is localhost-only and the caller already controls the parent; correct glob/order-aware subset logic lives in OpenCode, not ocman.

Testing

  • make lint (0 errors) and make test (Go + 1444 frontend tests) pass.
  • New tests: launcher/tool threading of agent/reasoning/permission, loop spawn threading, v20 column round-trip; updated SendPrompt test doubles.

Closes #270

## Summary - Programmatic session creation can now set **agent** and **reasoning** (not just model) plus an optional **permission ruleset** applied at create time. - MCP `new_session`: new `agent`, `reasoning`, `permission` params. - Agent loops: `create_loop` gains `agent`/`reasoning`/`permission`; threaded through spawn/prompt actions; persisted via **migration v20** (`agent`, `reasoning`, `permission_rules`). - `Messenger.SendPrompt` extended to carry agent+reasoning; `sessionsvc.Client.SetPermissionRules` passthrough. - REST `/api/loops` needs no change (decodes straight into `LoopSpec`/`LoopUpdate`). ## Design notes - Permission input is a **raw rule list** and **replaces** the child's ruleset outright. - **No child≤parent subset check**: the MCP server is localhost-only and the caller already controls the parent; correct glob/order-aware subset logic lives in OpenCode, not ocman. ## Testing - `make lint` (0 errors) and `make test` (Go + 1444 frontend tests) pass. - New tests: launcher/tool threading of agent/reasoning/permission, loop spawn threading, v20 column round-trip; updated `SendPrompt` test doubles. Closes #270
feat(sessions): set model, agent, reasoning and permissions at creation (#270)
Some checks failed
CI / Build Desktop (macOS arm64) (pull_request) Successful in 53s
CI / Frontend (pull_request) Successful in 5m21s
CI / Backend (pull_request) Successful in 6m29s
CI / Coverage Ratchet (pull_request) Failing after 7m44s
CI / Build (pull_request) Successful in 3m34s
CI / Playwright E2E (pull_request) Successful in 5m39s
CI / Semantic Tag (pull_request) Has been skipped
279fda806d
Programmatic session creation (MCP new_session and agent-loop
spawn/prompt actions) could only set the model. Thread agent and
reasoning through to the first message and apply an optional permission
ruleset immediately after create.

- mcp launcher/new_session: Agent, Reasoning, PermissionRules
- loops: extend Messenger.SendPrompt, SpawnRequest/LoopSpec/LoopUpdate,
  create_loop tool; persist agent/reasoning/permission_rules (migration v20)
- sessionsvc.Client: SetPermissionRules passthrough

Permission rules replace the child's ruleset outright; no child<=parent
subset check (localhost caller already controls the parent).

Coverage ratchet: pass

Suite Baseline This PR Δ
go 71.90% 71.90% +0.00
frontend 61.64% 61.64% +0.00

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

<!-- coverage-ratchet --> ### Coverage ratchet: ✅ pass | Suite | Baseline | This PR | Δ | | |---|---|---|---|---| | go | 71.90% | 71.90% | +0.00 | ✅ | | frontend | 61.64% | 61.64% | +0.00 | ✅ | _Tolerance: -0.1%. Baseline stored on `gh-pages`._
test: cover new permission/agent create-time paths (#270)
Some checks failed
CI / Build Desktop (macOS arm64) (pull_request) Successful in 1m1s
CI / Frontend (pull_request) Successful in 5m13s
CI / Backend (pull_request) Successful in 6m47s
CI / Coverage Ratchet (pull_request) Successful in 7m56s
CI / Build (pull_request) Successful in 3m3s
CI / Playwright E2E (pull_request) Successful in 5m33s
CI / Semantic Tag (pull_request) Has been skipped
CI / Backend (push) Has been cancelled
CI / Coverage Ratchet (push) Has been cancelled
CI / Frontend (push) Has been cancelled
CI / Build Desktop (macOS arm64) (push) Has been cancelled
CI / Playwright E2E (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Semantic Tag (push) Has been cancelled
206fb7ceb2
Add tests for Client.SetPermissionRules passthrough, the launcher
permission-error branch, and loopPermissionRules decoding so the new
create-time settings don't lower Go coverage.
dries merged commit 206fb7ceb2 into main 2026-07-09 20:35:56 +02:00
dries deleted branch feat/270-session-creation-settings 2026-07-09 20:35:56 +02:00
Sign in to join this conversation.
No description provided.