Skip to content

feat(missions): add native dynamic session workflows - #673

Open
pascalandr wants to merge 9 commits into
devfrom
feat/session-native-missions-v2
Open

feat(missions): add native dynamic session workflows#673
pascalandr wants to merge 9 commits into
devfrom
feat/session-native-missions-v2

Conversation

@pascalandr

@pascalandr pascalandr commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a durable, project-local Missions control plane on top of native OpenCode V2 root sessions
  • expose live Mission Control navigation, task state, actor state, reports, and evidence in the right panel
  • provide bounded Pocock bug-fixing and Wayfinder exploration playbooks without introducing a generic workflow DSL
  • keep Developer Mode automation separate from mission orchestration

Architecture

Missions uses native OpenCode V2 primitives rather than a parallel runtime:

  • root sessions are mission actors
  • queue and steer are the durable actor inbox
  • session metadata carries mission, task, role, and coordinator correlation
  • plugin hooks inject role context
  • project-local plugin storage persists an append-only mission journal and materialized map
  • topology mutations are coordinator-only and remain scoped to one project

The agent surface is deliberately limited to mission.inspect, mission.delegate, and mission.report. The CodeNomad broker exposes only the typed codenomad.missions.snapshot RPC; change events are invalidations that trigger authoritative reconciliation.

User-visible behavior

Mission Control shows the active mission's status, frontier, tasks, root actors, correlated reports, and expandable evidence. It updates live, survives reconnects, preserves the last durable map through transient failures, and can navigate to an actor session without becoming a second workflow executor.

All new UI strings are available in the existing 10 locales. The panel uses the shared token, utility, and square-corner window conventions.

Playbooks and safety bounds

  • Pocock remains evidence-driven and dynamically sequences implementation, independent reviews, resolution, and fresh validation.
  • Wayfinder preserves destination, map, frontier, claims, and fog-of-war while allowing bounded parallel research.
  • Admission and resume paths are idempotent.
  • Limits: 8 actors, 96 tasks, 2,000 events, and 20 missions per project.
  • A green completion requires every task to be completed.

Validation

  • Rebased directly on dev after feat(opencode): migrate CodeNomad to native V2 #647
  • OpenCode plugin contract typecheck
  • Server typecheck
  • UI typecheck
  • Mission server tests: 18 passing
  • Mission UI/i18n tests: 4 passing
  • Full server, UI, Electron, and Tauri suites/builds completed during implementation
  • Private runtime spike verified activation, typed RPC, restart persistence, root-session delegation, queue/resume, correlation, idempotence, invalidations, broker allowlisting, and checkout/worktree storage sharing
  • Pocock and Wayfinder runtime demonstrations completed
  • Windows Tauri Mission Control validated live from active mission through completed status, including actor navigation and expandable evidence

Known runtime note

A daemon that was already running before the project-local plugin existed may fail to hot-add that plugin on Windows. Fresh daemon activation is verified and works correctly; CodeNomad does not restart or take ownership of a foreign/shared daemon.

Tester feedback phase

This PR intentionally remains in draft while the session mesh receives broader real-world use. Please exercise:

  • custom missions with both idle and busy actor sessions
  • Pocock implementation, independent review, resolution, and fresh validation loops
  • Wayfinder exploration with parallel frontier tasks and unresolved fog
  • restart/reconnect recovery before and after delegation and reporting
  • actor navigation and evidence expansion from Mission Control
  • project, checkout, and worktree boundaries, including expected authorization failures

Useful reports include the desktop host, workflow/template, exact point of friction, expected versus observed behavior, and whether the durable map recovered after reopening. Do not include secrets or private prompt contents.

The unrelated automation-registry CI fix is tracked separately in #675 and is not part of this branch. After that fix lands on dev, this branch can be rebased and its validation rerun before any decision to mark it ready.

Introduce the project-local codenomad.missions V2 plugin with a durable append-only mission map, deterministic OpenCode inbox admissions, and the compact mission.inspect, mission.delegate, and mission.report tool interface. Root sessions remain visible native actors, only coordinators may change topology, and blocked tasks are mapped without a hidden workflow interpreter.

Add constrained CodeNomad snapshot brokering instead of exposing generic plugin RPC. Workspace-owned locations, active plugin inventory, project identity, root-session membership, actor limits, and foreign-session fences are checked at their respective seams. Queue/resume delivery supports busy actors and deterministic IDs make interrupted dispatch and report notification retries idempotent across restarts.

Ship dynamic custom, Pocock bug-expedition, and Wayfinder playbooks plus provenance and architecture documentation. Pin the local plugin contract to beta-18999 alongside the reviewed V2 client.

Validated with the server TypeScript check and 12 focused mission, plugin registration, recovery, authorization, idempotence, and broker tests.
Register a first-party Missions tab in the existing right-panel module seam. The new map-oriented view exposes mission objective and state, dependency-aware route nodes, frontier and claim totals, native root-session actors, correlated reports, and direct actor navigation without adding a second execution surface.

Load authoritative snapshots through the constrained CodeNomad broker, debounce typed RPC invalidations, refresh tracked workspaces after both OpenCode and CodeNomad event-stream reconnects, preserve the last durable map on transient errors, and clear stopped workspace state. Missing project plugins remain an explicit optional-capability state.

Add square-corner, token-based, RTL-aware panel styles split by feature concern and complete translations for all ten supported locales. Locale tests enforce key and interpolation parity, while store tests cover availability, stale-response fencing, reconnect ordering, and durable fallback behavior.

Validated with the UI TypeScript check, focused Node tests, locale parity checks, and a production Vite/PWA build.
Require structured Pocock evidence for completed diagnosis, implementation, independent standards/spec reviews, resolution, and final validation. Fence fresh reviewer and validator roots while requiring review resolution to reuse the implementer, and cover a full dynamic Pocock cycle plus a breadth-first Wayfinder map.

Align the project-local plugin with beta-18999 runtime behavior by emitting native typed system parts, JSON-normalizing optional RPC output, using the typed RPC call as the capability probe, and keeping the runtime entry free of an SDK import. Add a dedicated compile-time plugin contract check to CI.

Record the private-runtime spike proving busy-root queue delivery, resume, correlated synthetic reporting, restart restoration, idempotent admissions, typed invalidations, owned broker access, and shared project storage across worktrees. Targeted mission, plugin, and broker tests pass alongside server and plugin typechecks.
Omit workspaceID when a durable mission location has no workspace instead of reconstructing an explicit undefined property. OpenCode V2 validates managed session creation inputs strictly, so the previous shape could leave a newly admitted task at the durable dispatching boundary.

Add a regression assertion for workspace-less actor locations and record the successful idempotent resume of the same dispatch after a private server restart. Document full live Pocock and Wayfinder demonstrations, including independent roots, structured evidence gates, derived frontier transitions, read-only validation, and publication fences.
@pascalandr
pascalandr requested a review from shantur September 4, 2026 11:58
@pascalandr

Copy link
Copy Markdown
Contributor Author

Post-rebase validation against the merged dev V2 baseline is complete:

  • .opencode, server, UI, and Electron TypeScript checks: passed
  • full server suite: 394 passed, 2 platform skips, 0 failed
  • runnable UI suite: 302 passed, 0 failed
  • browser-conditioned UI integration suite: 145 passed, 0 failed
  • Electron native suite: 189 passed, 0 failed
  • Tauri Rust suite on Windows: 139 passed, 0 failed
  • desktop packaging invariants: 3 passed, 0 failed
  • server/UI production build: passed
  • working tree and index: clean

The expected Vite large-chunk warning remains informational; no build or test failures were produced.

@pascalandr

pascalandr commented Sep 4, 2026

Copy link
Copy Markdown
Contributor Author

Historical CI follow-up: the automation-registry isolation validated in 34e05ef8 has been removed from this Missions branch and moved to the dedicated PR #675. Its complete Linux/Windows native test and cross-platform packaging matrix is green. No production Missions behavior depended on that test-only change.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

PR builds are available as GitHub Actions artifacts:

https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/33872094505

Artifacts expire in 7 days.
Artifacts:

  • pr-673-34e05ef82e0c61584bfa2d6805f39d87b19bea68-tauri-macos
  • pr-673-34e05ef82e0c61584bfa2d6805f39d87b19bea68-electron-macos
  • pr-673-34e05ef82e0c61584bfa2d6805f39d87b19bea68-tauri-windows
  • pr-673-34e05ef82e0c61584bfa2d6805f39d87b19bea68-tauri-macos-arm64
  • pr-673-34e05ef82e0c61584bfa2d6805f39d87b19bea68-tauri-linux
  • pr-673-34e05ef82e0c61584bfa2d6805f39d87b19bea68-electron-linux
  • pr-673-34e05ef82e0c61584bfa2d6805f39d87b19bea68-electron-windows

@pascalandr
pascalandr force-pushed the feat/session-native-missions-v2 branch from 34e05ef to 511339e Compare September 4, 2026 12:58
@pascalandr
pascalandr marked this pull request as draft September 4, 2026 12:58
@pascalandr
pascalandr removed the request for review from shantur September 4, 2026 12:58
@pascalandr

Copy link
Copy Markdown
Contributor Author

Scope correction: the unrelated automation-registry CI fix has been removed from this branch and now lives in #675. This PR is intentionally back in draft while Missions gets broader tester use, soak time, and iterative feedback; there is no urgency to merge it.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

PR builds are available as GitHub Actions artifacts:

https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/33875664495

Artifacts expire in 7 days.
Artifacts: (none found on this run)

@pascalandr
pascalandr marked this pull request as ready for review September 4, 2026 13:23
Prevent concurrent mission tool calls from racing the same project snapshot and overwriting deterministic event identities. Project-scoped mutation and append queues now preserve first-writer contracts across multiple MissionControl instances, while journal admission rejects new records before the 2,000-event bound is exceeded.

Enforce Pocock's evidence transitions independently of model-supplied blockedBy keys and require every role-specific completed report before a green mission finish. This keeps dynamic task naming while making the documented diagnosis, implementation, independent reviews, resolution, and validation gates authoritative.

Add regressions for conflicting concurrent task contracts, concurrent mission starts, journal capacity, skipped Pocock prerequisites, and empty green completion. Validated the 400-test server suite (398 passed, 2 platform skips), mission/plugin/route/UI-store focused tests, server and project-plugin typechecks, and git diff checks.

@pascalandr pascalandr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gatekeeper review — head 32a27855

The two blocking findings from the prior pass are corrected on the PR branch:

  • Project-scoped mutation admission now serializes concurrent inspect/delegate/report calls across MissionControl instances. Conflicting task contracts can no longer overwrite the same deterministic event identity, concurrent starts admit only one active mission for a coordinator, and native prompt/report side effects remain behind the winning durable intent.
  • Pocock progression is now enforced from completed durable role reports rather than trusting model-supplied blockedBy keys. A green finish requires diagnosis, implementation, both independent review axes, implementer-session resolution, and fresh validation evidence.
  • Journal admission now rejects a new record before crossing the documented 2,000-event storage bound, while exact retries remain idempotent.

Validation on this head:

  • mission/control/contracts/plugin/route/UI-store focused tests: 25/25
  • full server suite: 400 tests, 398 passed, 2 platform-skipped, 0 failed
  • server typecheck and project-local @opencode-ai/plugin@0.0.0-beta-18999 contract typecheck: passed
  • git diff --check: clean

Verdict: no remaining blocking code finding in the PR's stated project-local, opt-in scope. Code-approved pending terminal CI and the final post-#671 rebase/revalidation.

This verdict does not establish functional succession for #618. #618 provides a general saved-workflow runtime, while #673 is intentionally available only to projects carrying the reviewed local Missions definition and deliberately omits a generic workflow DSL/runtime. Keep #618 open until that narrower product replacement is explicitly accepted.

@pascalandr pascalandr left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gatekeeper review of 32a2785: two confirmed P1 findings (both reproduced with failing regression tests).

  1. P1 — Enforce the project mission cap before persisting mission.created (packages/server/src/missions/control.ts:61-84). Starting a twenty-first mission succeeds; the reducer silently slices the snapshot to 20, hiding the oldest active mission. Its actors lose context and membership visibility although its native sessions can still run. Reject new starts at capacity while retaining idempotent replay.

  2. P1 — Apply the actor cap to explicit targets (packages/server/src/missions/control.ts:315-327). Seven explicit specialists plus the coordinator fill the cap. Delegating to another root session persists task.dispatching before the reducer drops the ninth actor. finishDispatch then fails with "Task actor is missing", and retries cannot recover the poisoned dispatch intent. Reject a new target before recording that intent; existing actor reuse must remain allowed.

Gatekeeper verdict: changes needed, not merge-ready. Fixes and regression coverage will follow in this PR; no merge requested.

Reject new mission creation at the project snapshot capacity rather than persisting a twenty-first mission that hides active membership. Keep deterministic start replay available at capacity.

Reject new explicit actor targets at the actor cap before writing dispatch intent. Existing actors remain reusable, and rejected tasks remain ready so the coordinator can retry with an admitted actor instead of leaving a missing-actor dispatch permanently stuck.

Add regressions reproduced red before the fix covering both limits, snapshot reconstruction, idempotent start replay, and actor reuse after rejection. Validate 24 focused mission tests, 400 passing server tests with two platform skips, server typecheck, and diff checks.
@pascalandr

Copy link
Copy Markdown
Contributor Author

Gatekeeper follow-up: both P1 findings from the review of 32a2785 are fixed in 6164633.

  • New mission starts now reject at 20, before persistence; replay of an existing start still succeeds.
  • Explicit targets now obey the 8-actor cap before dispatch intent is persisted; existing actors can still be reused and a rejected task can be retried safely.
  • Both regression tests failed before the patch and pass after it.

Validation: 24 focused Missions/plugin/broker tests passed; full server suite 400 passed, 2 platform skips, zero failures; server typecheck and git diff checks passed. This resolves the two reported findings, not a merge approval. Tester feedback and fresh CI remain part of the readiness decision.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

PR builds are available as GitHub Actions artifacts:

https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/34161002143

Artifacts expire in 7 days.
Artifacts:

  • pr-673-b26cfc98673253e3290ebffbed45ce2ee4dcc366-tauri-macos
  • pr-673-b26cfc98673253e3290ebffbed45ce2ee4dcc366-electron-macos
  • pr-673-b26cfc98673253e3290ebffbed45ce2ee4dcc366-tauri-macos-arm64
  • pr-673-b26cfc98673253e3290ebffbed45ce2ee4dcc366-tauri-windows
  • pr-673-b26cfc98673253e3290ebffbed45ce2ee4dcc366-electron-linux
  • pr-673-b26cfc98673253e3290ebffbed45ce2ee4dcc366-tauri-linux
  • pr-673-b26cfc98673253e3290ebffbed45ce2ee4dcc366-electron-windows

Integrate current dev into the Missions branch without rewriting feature history. Resolve the PR workflow conflict by retaining both the mission translation test and the upstream clipboard test, alongside the existing mission-store and plugin contract checks. Preserve the upstream HTTP server changes and mission route registration.

Validated the parsed workflow and all 52 referenced UI test paths; 334 runnable UI tests and 24 focused Missions/plugin/broker tests passed. UI, Electron, server, and project-local plugin typechecks and diff checks passed.
@pascalandr

Copy link
Copy Markdown
Contributor Author

Resolved the conflict with current dev in merge commit 512f85c. Both additions to the runnable UI test list are retained: Missions locale coverage and upstream clipboard coverage. No feature changes or PR merge performed.

Validation: workflow YAML parsed and all 52 referenced UI test files checked; 334 runnable UI tests and 24 Missions/plugin/broker tests passed; UI, Electron, server, and project-local plugin typechecks passed. Fresh GitHub CI will validate the merged branch.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

PR builds are available as GitHub Actions artifacts:

https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/34412714370

Artifacts expire in 7 days.
Artifacts:

  • pr-673-512f85c88bcc2305ccde3599bc687433be0d5a36-electron-macos
  • pr-673-512f85c88bcc2305ccde3599bc687433be0d5a36-tauri-macos
  • pr-673-512f85c88bcc2305ccde3599bc687433be0d5a36-tauri-windows
  • pr-673-512f85c88bcc2305ccde3599bc687433be0d5a36-tauri-macos-arm64
  • pr-673-512f85c88bcc2305ccde3599bc687433be0d5a36-electron-linux
  • pr-673-512f85c88bcc2305ccde3599bc687433be0d5a36-tauri-linux
  • pr-673-512f85c88bcc2305ccde3599bc687433be0d5a36-electron-windows

Integrate dev@ea37f97b after the global-session, nested-scroll, and selective-pruning fixes while preserving the native Missions control plane. The merge is conflict-free and keeps the PR history intact for exact-head CI validation.
@github-actions

Copy link
Copy Markdown

PR builds are available as GitHub Actions artifacts:

https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/34486378977

Artifacts expire in 7 days.
Artifacts:

  • pr-673-a235f8948a56c1f1aee5e180194738f708a45a06-electron-macos
  • pr-673-a235f8948a56c1f1aee5e180194738f708a45a06-electron-linux
  • pr-673-a235f8948a56c1f1aee5e180194738f708a45a06-tauri-macos
  • pr-673-a235f8948a56c1f1aee5e180194738f708a45a06-tauri-macos-arm64
  • pr-673-a235f8948a56c1f1aee5e180194738f708a45a06-tauri-windows
  • pr-673-a235f8948a56c1f1aee5e180194738f708a45a06-electron-windows
  • pr-673-a235f8948a56c1f1aee5e180194738f708a45a06-tauri-linux
  • session-pruning-plugin-macos-latest
  • session-pruning-plugin-windows-latest
  • session-pruning-plugin-ubuntu-latest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant