Commit graph

3 commits

Author SHA1 Message Date
Pascal André
f747d47f41
fix(opencode): prepare cold Location RPCs before one-shot dispatch (#1448)
Some checks are pending
Download Caches / seed (windows-2025) (push) Waiting to run
Download Caches / seed (ubuntu-24.04) (push) Waiting to run
Download Caches / seed (macos-15-intel) (push) Waiting to run
Download Caches / seed (macos-26) (push) Waiting to run
Publish help / build (push) Waiting to run
Publish help / deploy (push) Blocked by required conditions
## Problem

OpenCode 2.2.7 intentionally removes `Plugin.awaitActivation` from
`rpc.call`. On unchanged CodeNomad, native cold history/pruning returns
`rpc.unavailable`, `/goal` incorrectly reports unsupported, and a
headless integration host can fail its first advertisement. The same
native checks pass on 2.2.6.

## Adaptation

- Adopt the existing bounded, connection-owned pruning readiness
foundation and its eight fixed broker families. Preparation targets the
already-authorized exact native Location and requires a fresh
lease/registration-scope acknowledgement, rather than treating a
backend-wide startup marker as universal readiness.
- Preserve session/workspace/connection, deletion/ABA, cancellation and
extension-grant fences around waits and the single functional dispatch.
No pruning mutation is probed, replayed or retried; generic RPC proxy
access stays closed.
- Share the native catalogue activation wait with `/goal`. Only method
absence after activation proves unsupported; transient registration loss
remains unavailable.
- Preserve current Memory provisioning and ownership options while
adopting the foundation. Abort the startup marker observer on close so
cleanup does not wait on an unreferenced polling timer.
- Correct the reference host discovery client, vendored byte-for-byte
from [opencode-integrations
#17](https://github.com/NeuralNomadsAI/opencode-integrations/pull/17):
payload-free status preparation may repeat while registration is
unavailable; advertise/withdraw are sent once, with no directory
fallback after dispatch. The external PR publishes source only;
installed hosts need the corresponding host update.
- Keep minimum, recommendation and authoring dependency pins unchanged.
Add cold fixed-broker native coverage to minimum/latest and
Windows/Linux/macOS native lanes.

## Validation

- **199** affected broker/lifecycle/readiness/goal tests pass; the final
cancellation cleanup additionally passes **40** focused tests.
- **30** real-browser Images/panel-extension journeys pass.
- Official isolated **2.2.3, 2.2.6 and 2.2.7**, driven by pinned **Node
24.22.2**: full pruning/history/Images/replay fixture, production goal
route, cold fixed preview/prune/history/Images brokers and headless
integration discovery/advertise/attach/withdraw all pass. The cold
broker check asserts one prune dispatch and retained conclusion bytes,
plus a new backend lease.
- **2.2.7 split storage** passes full pruning, native proxy/UI
contracts, assets/gallery, mixed split+inline content after flag
disable/restart, receipts, active-claim refusal and retained model
payload.
- Server/UI typechecks, complete server/UI/native-plugin build, **27**
package/vendor parity tests, **31** help tests, native driver test, YAML
and whitespace checks pass.
- External Python reference tests **9/9** and kit test typechecking
pass; Blender's vendored copy equals the reference.

Only private synthetic daemons, local providers and owned fixture state
were used. No shared service restart, real
credentials/database/configuration change or stable publication. Earlier
fixture attempts exposed an import-ID conflict, Windows path
normalization in the fixture ownership stub, and teardown ordering;
those harness defects were corrected without relaxing assertions. One
final rerun was needed after a simultaneous build cleaned its dist
input; the post-build rerun passes.

The native tests reuse source from the independently prepared readiness
foundation and broker work, adapted onto current dev without taking the
unrelated multi-backend branch. Public labels, controls and documented
steps stay unchanged; the fix restores their documented behavior. Large
existing touched files: `packages/server/src/index.ts` (~758 lines),
`packages/server/src/server/http-server.ts` (~2574),
`packages/server/src/workspaces/manager.ts` (~1230), and
`packages/server/src/server/routes/pending-requests.test.ts` (~1025).
Integrated CI and platform builds remain the final gate.
2026-11-10 16:25:51 +01:00
dependabot[bot]
bf3c488484
build(deps): qualify Vite 7 with merged Zod 4 and stable fixture graphs
Apply the Vite 7.3.8 security migration to UI and Electron while preserving the standalone UI browser target, reviewed native optimizer cleanup, aligned Rollup binaries and the merged Zod 4 migration. The shared fixture daemon scans its real TSX entries, preventing late dependency optimization from invalidating a borrowed fixture's desktop API module URL. Logo tests read the displayed SVG rather than infer its color from a filename that Vite may inline.

Retain the shared native plugin activation and receipt synchronization qualifiers, including the Goal plugin's positive readiness state before its original assertions. No production timeout, failure collector, native mutation retry, runtime requirement or security guard is relaxed. The integration preserves all unrelated dev changes and the complete dependency graph through a strict semantic lockfile merge with protected SDK/Effect/Monaco/native Rollup records unchanged.

The combined Vite 7 and Zod 4 graph passes a frozen optional-workspace Linux install, UI/server/Electron typechecks, the full server/UI/plugin/tunnel build and local packaging without lockfile drift. The formerly failing real browser sequence passes twice each on Linux and Windows; targeted native source, restart, integration and Goal qualifiers pass against isolated minimum/latest runtimes.

The maintainer explicitly requested this merge while the corrected exact-head CI is still running. No CI job has reported failure at merge admission; unfinished jobs are not counted as completed validation. Their immutable-head CI remains under first-failed-job supervision after merge.
2026-11-10 15:47:42 +01:00
Pascal André
248a4b3cd1
feat(status): show the session's /goal on one line above Tokens (#1228)
## Summary

OpenCode's built-in `/goal <objective>` keeps a session working turn
after turn until its reviewer judges the objective met, and pauses the
goal on its own after a stop, a failed run, stalls, its round limit or a
service restart. CodeNomad already listed `/goal` in the composer picker
(it comes from `command.list`) but showed nothing of the goal itself.

While the shown session has a goal, the **Status** tab now shows **one
line above Tokens**:

- a status badge: **Active**, **Paused** or **Complete**;
- the objective on one line with an ellipsis; hovering or focusing it
shows the full objective and the reason for the last change (why it
paused or was met), which is also the row's accessible description;
- the rounds used out of the maximum (`2/50`);
- **Pause goal** / **Resume goal** (one button that keeps focus when the
state flips) and **Clear goal**.

Without a goal, without a session, on a runtime without goal support or
after a failed read, nothing renders (no hint, no gap). The line is not
a Status section: it cannot be hidden or reordered.

## How it works

- **Read path:** the instance proxy refuses plugin RPCs, so `GET
/api/workspaces/:id/sessions/:sessionId/goal`
(`server/routes/session-goal.ts`, contract in
`opencode/goal-contract.ts`) validates the session ID, reads the
session, checks that its Location belongs to the workspace, then calls
the fixed `opencode.goal` `get` in that Location (8 s timeout, abort on
disconnect). It returns only the displayed fields; a missing RPC or
method answers `unsupported`, any other failure or malformed output
`unavailable`.
- **Freshness:** plugin RPC events already reach the UI through the
native event relay (as `rpc.codenomad.missions.changed` does), so the
store follows `rpc.opencode.goal.changed` for tracked sessions, with a
per-session version that drops replies older than a change already
heard. It also reads when the line is shown (Status visible, session
switch), on reconnect (coalesced) and after its own commands. It never
polls; a failed read keeps the last goal shown; deleting the session or
stopping the workspace drops it.
- **Commands:** the buttons reuse the composer's native command path
(`executeCustomCommand(..., "goal", "pause" | "resume" | "clear")`, with
session admission, instruction sync and the profile environment). They
are disabled while a command runs; a refused command (for example
pausing without an active goal) shows OpenCode's message.

## Contract

Upstream `@opencode/schema/goal` (anomalyco/opencode #59437, #59850;
shipped in 2.2.1, identical goal files in 2.2.3 and 2.2.5): RPC
`opencode.goal` with `get({ sessionID }) -> Goal.State | null` and event
`changed { sessionID, goal }` published in the session's Location on
every write. Documented in `dev-docs/OPENCODE_COMPATIBILITY.md`
("Session goal"); refresh policy row in `CACHE_REFRESH_CONVENTIONS.md`;
line convention in `UI_SHELL.md`.

## Help

New `conversations.md#goal` section (start, read, pause/resume/clear,
automatic pauses) and a sentence in `settings.md` about the Status line,
in English and all nine translations.

## Validation

- Root and server typecheck clean.
- Route tests 3/3; store tests 8/8 (with and without
`--conditions=browser`), including rapid session switching through the
shared background read queue and hidden sessions.
- Browser: `session-goal` (no goal, active with Pause, paused with
Resume and reason, Complete, Clear, command arguments, update after
`changed`, keyboard focus kept on the toggle across Pause and Resume,
line above Tokens) and `status-panel` 6/6; `status-tokens` and
`fixture-wiring` also pass.
- Ten-locale help 31/31.
- Native `scripts/test-session-goal-native.mjs` against the exact
OpenCode **2.2.5** CLI (twice): `get` returns null for a new session and
another workspace gets 403; `/goal pause` without a goal fails with
OpenCode's message; a goal set with the fake provider is paused by the
reviewer, then resumed and cleared, with the `changed` events relayed to
the owning workspace. CI runs it on the minimum and latest runtime
lanes; the store test joins the UI unit list.
- Full server suite on the rebased branch: 2,841 passed, 9 skipped; the
`plugin-controls` (same-target serialization) and `panel-extension-api4`
(deadline/abort) timing tests failed and the `index.test.ts` shutdown
test was cancelled under full-suite load. None of them touches this
change, and all three files pass alone (44/44).

Large files touched with 1–4 line changes:
`packages/server/src/server/http-server.ts` (~2,490 lines),
`packages/ui/src/lib/api-client.ts` (~860 lines).
2026-10-31 09:46:04 +01:00