Skip to content

test(missions): qualify presence loss through the RPC it actually controls - #1224

Merged
pascalandr merged 1 commit into
devfrom
fix/missions-presence-unregister
Oct 31, 2026
Merged

pascalandr merged 1 commit into
devfrom
fix/missions-presence-unregister

Conversation

@pascalandr

Copy link
Copy Markdown
Contributor

Problem

The opt-in presence-native.test.ts waits for the mission_* tools to leave the native tool list after the backend's presence lease ends. That never happens: tools register once at plugin load, independently of presence (desktop-plugin.ts), so scheduled passages keep them (MISSIONS_RECURRING.md).

The test fails identically on OpenCode 2.2.0, 2.2.1, 2.2.2 and 2.2.3, and on every dev commit since registration moved to plugin load; it is unrelated to #1209. MISSIONS.md still said tools register through presence.

Change (test and docs only)

  • The test now observes what presence actually controls:
    • the typed codenomad.missions RPC unregisters (only rpc.unavailable/rpc.method_not_found count as absent) and re-registers exactly once when the lease returns;
    • the tools stay registered;
    • the ordinary route refuses with the tools' own message;
    • the real provider request carries no mission_* tool without presence, and carries mission_inspect with it.
  • MISSIONS.md: the actual registration, and how to run the opt-in test.

User impact

None. Without presence, the context hook strips every mission_* tool from model requests and the executors refuse; the new test proves this natively.

Validation

  • presence-native passes on isolated OpenCode 2.2.3, 2.2.2 and 2.2.0.
  • Red checks: it fails with presence retention always true, with the context hook keeping the tools, and with tools registered inside presence.
  • Server typecheck; 155 opencode/missions tests incl. missions-plugin/missions-reload; build:missions; test-missions-native.mjs on 2.2.3.

…trols

The opt-in native presence test waited for the mission_* tools to leave
the native tool list after the backend's presence lease ended. That never
happens: tools register once at plugin load, independently of presence,
so scheduled passages keep them. The test has failed on every OpenCode
version (2.2.0 to 2.2.3) since registration moved to plugin load; only
the experiment it was written against registered tools inside presence.
MISSIONS.md still said tools register through presence.

The test now observes what presence controls:
- the typed codenomad.missions RPC unregisters (only rpc.unavailable or
  rpc.method_not_found count as absent) and registers again exactly once
  when the lease returns;
- the tools stay registered;
- the ordinary route refuses with the tools' own message;
- the real provider request carries no mission_* tool without presence,
  and carries mission_inspect with it.
MISSIONS.md describes the actual registration and how to run the test.
No product behavior changes.

Validation: presence-native passes on isolated OpenCode 2.2.3, 2.2.2 and
2.2.0. It fails when presence retention always holds, when the context
hook keeps the tools, and when tools register inside presence. Server
typecheck, 155 opencode/missions tests including missions-plugin and
missions-reload, build:missions and test-missions-native.mjs on 2.2.3
pass.
@pascalandr

Copy link
Copy Markdown
Contributor Author

Gatekeeper review

Round 1 (21eb79ac0): approve. P0 0 · P1 0 · P2 0 · P3 0 · P4 0.

  • Root cause confirmed: the original test fails on isolated OpenCode 2.2.0 as on 2.2.3, because mission_* tools register once at plugin load by design and never leave the tool list on presence loss.
  • Safety without presence:
    • the context hook strips every mission_* tool from the provider request;
    • the executors refuse;
    • the presence-gated codenomad.missions RPC unregisters and registers again exactly once.
  • Red checks reproduce: the rewritten test fails with presence retention always true, with the context hook keeping the tools, and with tools registered inside presence.
  • Deterministic and isolated; no leaked processes.
  • Docs: the MISSIONS.md paragraph matches MISSIONS_RECURRING.md and the code.

Checks:

  • server typecheck;
  • opencode/missions tests incl. missions-plugin and missions-reload;
  • presence-native on isolated OpenCode 2.2.3 and 2.2.0, repeated;
  • build:missions;
  • test-missions-native.mjs on 2.2.3, 18 gates.

@pascalandr
pascalandr merged commit acadef7 into dev Oct 31, 2026
17 of 19 checks passed
@pascalandr
pascalandr deleted the fix/missions-presence-unregister branch October 31, 2026 05:21
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