Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4875a7f
fix(missions): inherit user profiles in agent preparations
pascalandr Nov 5, 2026
3cb4920
docs(missions): explain inherited profiles for agent preparations
pascalandr Nov 5, 2026
236609f
fix(missions): align Compare judge inheritance with editor
pascalandr Nov 5, 2026
b9e1637
fix(missions): settle preparation choices and clarify defaults
pascalandr Nov 6, 2026
338fcd6
fix(missions): preserve standalone creation without backend preferences
pascalandr Nov 6, 2026
3061caa
fix(missions): distinguish missing preferences from failed ownership …
pascalandr Nov 6, 2026
9d1b7f3
fix(missions): isolate strict ownership from inventory fallback
pascalandr Nov 6, 2026
7e10a08
fix(missions): preserve ordinary reads and qualify native preference …
pascalandr Nov 6, 2026
cbfce62
fix(missions): close creation preference recovery and ownership gaps
pascalandr Nov 6, 2026
4f586f8
merge: integrate origin/dev with mission profile recovery fixes
pascalandr Nov 6, 2026
17d6f49
fix(worktrees): tolerate proven non-directory sibling projections
pascalandr Nov 6, 2026
bb7c6a5
test(missions): compare stable snapshot content after preference refusal
pascalandr Nov 6, 2026
ac8a921
fix(missions): resolve round-six recovery and contract review findings
pascalandr Nov 6, 2026
b78f3ac
fix(missions): preserve fresh ownership reads and accurate recovery g…
pascalandr Nov 7, 2026
6501370
merge: integrate current development runtime and memory support
pascalandr Nov 7, 2026
e2d41ba
test(missions): retain executor failures across the private fixture RPC
pascalandr Nov 7, 2026
6df208b
merge: integrate deterministic deadline tests and dependency updates
pascalandr Nov 7, 2026
8b1b673
fix(missions): reconcile profile defaults with current dev
pascalandr Nov 8, 2026
7e473cb
fix(ci): synchronize Tauri resolution and WebKit fixture contracts
pascalandr Nov 9, 2026
bdc0b08
fix(ci): reconcile WebKit fixture fixes with current dev
pascalandr Nov 9, 2026
46fc7d6
test(ci): repair fixture imports and wait for owned UI state
pascalandr Nov 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/scripts/binary-build-order.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test("PR builds and both release channels share the ordering without bypassing P
assert.equal(workflow("release.yml").jobs.release.uses, "./.github/workflows/reusable-release.yml")
assert.deepEqual(pr.needs, [
"authorize", "tests", "tests-browser", "tests-tauri-windows", "tests-opencode-compatibility",
"tests-session-pruning-native", "tests-runtime-contracts", "tests-tauri-macos",
"tests-session-pruning-native", "tests-runtime-contracts", "tests-tauri-macos", "tests-tauri-webkit",
])
assert.equal(pr.with.upload, false)
assert.equal(pr.with.set_versions, false)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ jobs:
packages/ui/src/stores/mission-task-pages.test.ts
packages/ui/src/stores/mission-task-seen.test.ts
packages/ui/tests/contracts/mission-task-page-read.test.ts
packages/ui/tests/contracts/mission-defaults.test.ts
packages/ui/src/lib/native/preferences-window.test.ts
packages/ui/src/components/mission-briefing-locales.test.ts
packages/ui/src/components/mission-briefing-model.test.ts
Expand Down
4 changes: 3 additions & 1 deletion .opencode/skills/codenomad-missions/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ Prefer ordinary native delegation for bounded work. Use a mission only when the
7. Finish through `mission.report({ final: true, ... })` only when the objective is actually met. Retired work never counts as success; retiring does not interrupt admitted native execution, which can finish on its own or be stopped with `mission.interrupt` when eligible; playbook proof requirements still apply. A retired native task takes no coordinator readout; record what it returned under its replacement or in the final report. Admitted retired work settles through its actor's terminal report or an observed native end.

Use `mission.inspect({ catalog: true })` before selecting a native execution profile.
Follow the [creation and retry discipline](../../../dev-docs/MISSIONS.md#mission-profile-selection-and-creation-recovery).

The mission `role` is independent of `execution.agent`. To pin execution, pass
`execution: { agent: "catalog-agent-id", model: { providerID: "catalog-provider", id: "catalog-model", variant: "optional-catalog-variant" } }`.
Repeat the same selection when retrying a task. Omitted fields use native defaults.
Repeat the same selection when retrying a task. Omitted task execution fields use native defaults.
Native tasks accept subagent/all agents; independent roots and tasks stored
without an execution mode accept primary/all agents. Each child owns its bounded assignment and
may recursively decompose independent subtasks when useful, integrating actual returned
Expand Down
14 changes: 13 additions & 1 deletion dev-docs/BROWSER_AUTOMATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ Browser previews are an ordinary desktop feature and must work in user projects

The bridge is loopback-only, token-authenticated, bounded, and session-location gated.

An active backend publishes an ephemeral registration with a per-process 256-bit
token and removes it on graceful shutdown. All bridge discovery checks the
filename's publishing PID before reading the file: PIDs outside 1–2³¹−1 and
`ESRCH` establish absence; other process-probe errors retain liveness
conservatively. Best-effort pruning removes recognized local registrations whose
filename or parsed PID establishes absence. A file removed between enumeration
and open is absent. Windows PIDs belong to their host namespace, so WSL discovery
uses endpoint evidence for Windows registrations and leaves their files in place.
Windows path lookup is asynchronous, shares an in-flight lookup for the effective
distro/PATH, and ordinary discovery retains its cached result. Missions' strict
ownership and retry rules are in the [creation recovery contract](MISSIONS.md#mission-profile-selection-and-creation-recovery).

## Desktop instrumentation

At normal startup, native instrumentation prepares the current CodeNomad desktop process for agent feedback. It never launches or owns another CodeNomad process and never starts, stops or replaces the shared OpenCode daemon.
Expand All @@ -36,7 +48,7 @@ Windows Tauri (`packages/tauri-app/src-tauri/src/developer_mode.rs`):

Packaged Electron main/preload/renderer, UI and server builds emit source maps. Local hosts sanitize inherited debugging flags; isolated remote-window profiles run without local instrumentation. Windows WebView2 is the supported Tauri CDP host. `packages/server/src/developer-cdp.ts` (`DeveloperCdp`) is the shared CDP controller and `opencode/automation-plugin.ts` the OpenCode adapter. `.opencode/skills/codenomad-automation/SKILL.md` holds the inspect, edit, build, relaunch, reconnect and evidence workflow.

An active backend publishes an ephemeral registration with a per-process 256-bit token and removes it on graceful shutdown. Tool definitions captured earlier still go through execution-time checks, which refuse calls after backend shutdown or when the inspected native window, run or document changed; selecting another project or conversation keeps them valid. A WSL OpenCode plugin also discovers Windows registrations and reaches the Windows-only loopback listener through Windows interop under default WSL2 NAT. Provisioning migrates only recognizable generated entries and never overwrites a user-authored plugin.
Tool definitions captured earlier still go through execution-time checks, which refuse calls after backend shutdown or when the inspected native window, run or document changed; selecting another project or conversation keeps them valid. A WSL OpenCode plugin also discovers the Windows registration directory and reaches the Windows-only loopback listener through Windows interop under default WSL2 NAT. Its `curl.exe` requests use `--noproxy "*"` to bypass inherited proxies for that authenticated loopback endpoint. Provisioning migrates only recognizable generated entries and never overwrites a user-authored plugin.

Windows registry-path discovery in WSL uses asynchronous interop with bounded commands.
Memory admission cancellation reaches both discovery commands and registry scans;
Expand Down
124 changes: 118 additions & 6 deletions dev-docs/MISSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,12 @@ refuse otherwise. Only one-time coordinators are offered and told about
honestly, and an empty result notes that only canonical assignments are visible.
- `mission.prepare` creates a paused one-time hand-off through the same
`prepareMissionCreation` pipeline, holds and fences as the editor, at the
coordinator's Location. It never starts. The trusted `preparedBy`
coordinator's Location. The user starts it with Play. The trusted `preparedBy`
(`{ missionId, coordinatorSessionId }`) gives that coordinator read-only
visibility (`inspect({ missionID })`, `inspect({ list: true })`), never control.
The requestID is scoped to the coordinator and mission. A retry first reads the
journal's creation event and returns the saved mission (or a conflict) without
another backend call; a held uncertain attempt is reported uncertain, never as
nothing created.
visibility (`inspect({ missionID })`, `inspect({ list: true })`). An active
one-time coordinator can prepare hand-offs; a caller outside an active mission
receives `mission-not-found` with guidance to use the Missions editor. Follow
the [creation and retry discipline](#mission-profile-selection-and-creation-recovery).

The human-answer gate's `discover` finds fresh children of the expected parent
whose `subagent` call carried the exact assignment prompt, and the coordinator's
Expand All @@ -158,6 +157,119 @@ candidates from free text, titles or timing.
different summary when the latest automatic briefing is still the last event. One replacement task may merge several retired tasks; it names one
of them in `replacesTaskKey`.

## Mission profile selection and creation recovery

Both `mission.prepare` and `mission.inspect({ start })` resolve omitted
coordinator/role profiles and `taskMode` from the owning CodeNomad backend's
`ui.settings.missionProfileDefaults`. The editor and server share
`missions/profile-defaults.ts` and `freezeCompareProfiles`: a playbook's slot
overrides the global `all` slot; the global `specialist` supplies task roles,
with the Compare judge using the coordinator's model by default. Each supplied
profile slot wins whole, including `{}` (OpenCode defaults) or an agent-only
profile; `profiles: {}` leaves every slot eligible for preferences. After slot
selection, Compare fills any missing judge model from the known coordinator
model through `freezeCompareProfiles`, including explicit/preference `{}` or
agent-only slots; a judge's own model stays unchanged. An explicit `taskMode`
wins over the playbook preference, then the global preference; the final fallback
is `native`. Missing profile preferences fall back to OpenCode defaults.
Supplying the coordinator, every exact role of the selected template and
`taskMode` skips backend preferences entirely; `{}` counts as an explicit profile
slot. All origins are `explicit`, and preference availability stays unobserved.
Partial or omitted selections read the owning backend's preferences.

Preparation tool replies and inspections with creation metadata expose
`selection: { profiles, taskMode, origins }`: the saved coordinator and every
role of the selected playbook, plus origins `explicit`, `preference` or
`opencode-default` for the coordinator, each role and task mode. The journal,
document and authoritative backend snapshot retain `creationDefaults`, including
the original request, for replay; tool replies project that metadata only as
`selection`. A chosen Compare judge slot retains its explicit/preference origin
even when its model is inherited; an absent judge slot inherits the coordinator's
origin. These are saved requested selectors; catalog validation and native
execution checks establish availability and actual execution separately.
`inspect({ start })` uses the caller as coordinator and requires its existing
native profile to match the resolved coordinator selection. A mismatch whose
coordinator origin is `preference` advises passing `profiles.coordinator`
(for example `{}`) to override that preference; the existing native-profile
check still applies. An explicit-profile mismatch keeps the generic
native-profile error.

`inspect({ start })` reads preferences before entering the project mutation
lane. Admission rereads creation events and document defaults under that lane;
already recorded choices win over concurrent preference results. Document-mode
replay rechecks the coordinator Location and original creation digest.

When preferences are needed, with no bridge presence or zero proven owning
backends, `inspect({ start })` uses explicit inputs and OpenCode defaults for
omitted choices (`native` task-mode fallback), with origins `explicit` or
`opencode-default` and `selection.preferences: "unavailable"`. The saved metadata
retains that warning on retries, including after a backend appears. Multiple
owning backends, failed or incomplete backend discovery, or an unreadable
preference document return `mission-preferences-unavailable`; invalid preferences
return `mission-preferences-invalid`. Restore backend discovery and session
ownership, then reload preferences, or supply fully explicit choices.

Strict discovery follows the shared [registration liveness and pruning rules](BROWSER_AUTOMATION.md#integration-and-shared-bridge).
Unreadable registrations with a live or indeterminate local publisher retain
indeterminate ownership and refuse resolution. WSL skips unparseable Windows
registrations (unsupported schemas, oversized files and invalid URLs): they offer
no usable authenticated endpoint or supported contract. Valid Windows
registrations require endpoint evidence. A refused
connection establishes absence; timeouts and HTTP/authentication failures leave
ownership indeterminate. A typed missing-session reply, an empty backend workspace
inventory or a successful ownership read proving an unrelated project establishes
non-ownership, including with other workspaces open. Actual Git/WSL ownership-read
failures remain indeterminate and refuse resolution.

Missing Windows interop executables (`ENOENT`/`ENOEXEC` from `cmd.exe` or
`wslpath`) establish absence of reachable Windows backends for that WSL process;
local discovery continues. Timeouts, failed commands and uncertain path results
refuse strict discovery. Strict requests retry failed path lookups after two
seconds. Legacy backends without
negative ownership proof or preference-command support return
`mission-preferences-update-required`: update CodeNomad before inheriting defaults.
A live backend's preferences stay protected by this refusal.

`mission.prepare` requires an owning backend for fenced creation even when profile
resolution can use the no-owner fallback. Fully explicit choices make no preference
request; preparation still requires its owning backend. Before sending creation
provenance, preparation requires the backend's positive `missionCreationDefaults`
capability. Missing support returns the update-required refusal before dispatch
and releases only newly reserved choices; previous uncertain outcomes remain retained.

The requestID is scoped to the coordinator and mission. Preparations with the
same requestID are serialized. Reuse that requestID and the original inputs:
a retry first reads the saved creation event/document and returns the saved
mission or a conflict. `mission.prepare` alone reserves a standalone durable
pre-dispatch intent for the chosen profiles, task mode and origins across
uncertain attempts, preference changes and restarts. `inspect({ start })`
retains its choices through its journal/document receipt under the native
invocation identity.

A positive preparation result or a definitive refusal proving that the attempt
had no effect releases its retained choices. An unknown outcome keeps them; a
retry refused during prevalidation leaves the preceding attempt's uncertainty
intact. At most 128 unknown preparation choices are retained per project, each
for 24 hours from its first reservation; retries preserve that deadline. At
capacity, retry the original requestIDs to recover completed preparations and
release their slots, or wait for their 24-hour retention to expire.

Capacity scans skip unreadable intent entries while preserving their bytes.
Retrying that exact requestID still refuses unreadable evidence, preventing
replay of a possibly dispatched preparation; unrelated requests remain usable.

A clock rollback keeps future-dated intents fresh until their stored creation
time has aged through the retention window; retries reuse their saved choices.

After expiry, preferences may be read anew only when the creation event and
document are both absent. A positive receipt or saved document keeps its
choices frozen. Expiry affects retained choices alone; native holds and
authorization keep their own settlement rules. Check the mission and original
conversation before choosing a new requestID for an uncertain outcome. Never
duplicate uncertain work or resume automatically after expiry. Never create an
intermediate mission solely to access `mission.prepare`. A held uncertain attempt
is reported uncertain.

## Human questions and decisions

Only the coordinator talks to the human. Every assignment prompt and helper policy
Expand Down
2 changes: 2 additions & 0 deletions dev-docs/WORKTREE_SESSION_PLACEMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ authorized workspace spelling before changing UI state.

## Agent conventions

- Preference authority probes use `ownsLocation(id, location, client, { signal, purpose, strict: true })`: a successful read can establish a negative; physical-path, Git identity and WSL translation failures reject. Ordinary inventory preserves root-only fallback when Git reports a non-repository. Only strict ownership qualifies a cached fallback's checkout absence through filesystem discovery; its qualification state stays inside the ownership cache. Git-unavailable inventory retains its exact-folder `directoryOnly` authority. Strict reads validate each registered checkout root before omitting a missing projected project subfolder; registered-root and opened-root failures reject. Concurrent Git identity preflights retain all admitted reads through settlement.
- Event ownership uses registered-only native worktree snapshots, isolated from display/request discovery scans (`ownsDirectory` / `ownsLocation` with the `event` purpose). Never run native strategy refresh from routing or join its pending inventory. Keep physical Git identity, nested-folder/WSL projection, native registration, invalidation and disposal checks shared with ordinary ownership; ordinary requests and explicit worktree discovery retain refresh semantics. Regression: `instance-event-ownership.test.ts` and the isolated native worktree fixture.
- Worktree discovery/create/remove use `workspaces/native-worktrees.ts` and the native OpenCode worktree API. CodeNomad supplies the `.codenomad/worktrees` default, named-branch policy and verified family transactions. Git common-directory identity scopes the native inventory to the opened local repository; opaque worktree identifiers are separate from mutable branch labels. Validate through `scripts/test-opencode-location-native.mjs` with an isolated CLI and `tests/browser/worktrees.test.ts` for selector gestures.
- Worktree inventory snapshots live in `workspaces/worktree-inventory.ts`: display reads serve cached data and lazily revalidate, directory authorization uses validated reads, and family transactions force fresh reads. Invalidation retains display data and fences pending scans; `workspace.worktreesChanged` refreshes UI consumers after a changed snapshot is published. Keep selector opening independent of refresh completion and suppress duplicate selection events during inventory reconciliation.
Strict directory-cache and native-inventory reads permit two automatic restarts, then one fresh read; another invalidation rejects that demand and permits a later retry. Ordinary readers keep trailing reloads until a current scan settles. Pending strict demands have their own retry budget while sharing native single-scan work and validated snapshots with ordinary readers.
- Worktree branch/HEAD annotations use one NUL-delimited Git worktree snapshot, intersected with native inventory and verified Git identities; effective checkout roots must respect Git configuration as well as administrative backlinks. Pending move targets belong to the store's instance/family request identity and survive selector navigation/remounts until native reconciliation settles.
Loading
Loading