Skip to content

feat(session): plugin-origin session turns with operator-only approval (RIG-8011) - #35

Merged
mattwilkinsonn merged 9 commits into
rigel-releasefrom
nemo-intake/rig-8011-plugin-origin
Nov 7, 2026
Merged

mattwilkinsonn merged 9 commits into
rigel-releasefrom
nemo-intake/rig-8011-plugin-origin

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Plugin-origin session turns (rows admitted by plugin_origin_v1, such as Cotal peer DMs) now run as first-class gateway sessions with the same safety posture as operator turns, or stricter. Design record: RigelBuild/docs docs/designs/hermes/ (RIG-8011, merged in RigelBuild/docs#67).

  • Marker (RIG-8011): plugin_origin_turn ContextVar marks a turn as plugin-origin.
  • T1 (RIG-8136): cotal sessions are scoped to operator guilds in the Discord adapter.
  • T2 (RIG-8137): plugin_origin_v1 admission. Rows are authorized only by _plugin_origin_authorized, never by a human principal. Each claimed row runs in a fresh context.
  • T3 (RIG-8138): every plugin-origin turn reaches the operator as a once/deny card. YOLO, approvals.mode: off, permanent allowlist, grants, smart approve and codex auto-approve cannot bypass it. A guardian denial blocks. Operator turns are unchanged. Peer-mesh deny still runs first.
  • Review fixes: cached Codex runtime reuse, toolset widening, managed-worker propagation (turn_v1.plugin_origin plus the child marker), revocation of claimed rows, and context leakage.

Preserved unchanged: committed_route_envelope, snapshot_automation, _event_clause, check_native_route. No plugin check passes allow_adapter_delegation=True.

Decisions

  • Plugin-origin approvals always require once/deny cards, with no bypass. This is stricter than operator turns, by design. It was flagged to Matt through Nemo.
  • One PR for marker, T1, T2 and T3, plus the review fixes as additive commits.

Open Questions

None.

Implementation note

The review-fix slice first went to implement-hard. It stopped on a 429 rate limit after it had partly fixed two findings. A Luna implement agent finished the rest (bd100a82). Not a Luna failure.

Tests

  • scripts/run_tests.sh on 8 files (plugin-origin session/approval, managed turn contract, codex handoff, yolo, discord tool, tools config, approval): 403 passed, 0 failed, 6 skipped.
  • Revert check: reverting each of the three runtime fixes (fresh row context, managed child marker, local-session toolset guard) turns its new test red.
  • ruff check on touched files: clean.
  • Fixtures only; no live Discord.

Spec-impact: none in this repo. orion repin plus platform_toolsets.cotal wiring follows in RIG-8003.

Refs RIG-8011, RIG-8136, RIG-8137, RIG-8138

rigel-mintaka and others added 9 commits November 5, 2026 10:43
Adds plugin_origin_turn and is_plugin_origin_turn, shared by the three
tasks in docs/designs/hermes-agent/plugin-origin-sessions.md.

Refs RIG-8011

Co-authored-by: Matt Wilkinson <matt@rigel.build>
Allow explicitly configured core Discord tools on cotal and enforce the frozen peer-mesh/plugin-origin scope for reads, searches, and writes. Add tests and update toolset/tool references.

Refs RIG-8136

Co-authored-by: Matt Wilkinson <matt@rigel.build>
Refs RIG-8137

Co-authored-by: Matt Wilkinson <matt@rigel.build>
Admits an allowed plugin's turn to a bot-owned Discord thread with no
human envelope, authorized by _plugin_origin_authorized; revalidates at
claim and recovery; refused rows settle cancelled.

Refs RIG-8137

Co-authored-by: Matt Wilkinson <matt@rigel.build>
Route keyed notes into a plugin-only session through plugin_origin_v1, and
authorize later notes against the committed human source. Keep the
no-authority origin path. Recovery binds the restarting source once check
pins each queued descriptor. Fix test isolation and coordination, and cover
the remaining Task 2 cases.

Refs RIG-8137

Co-authored-by: Matt Wilkinson <matt@rigel.build>
…/deny cards (RIG-8138)

Route plugin-origin approvals through the operator while preserving operator and peer-mesh behavior. Add gateway coverage and document Discord approval cards.

Spec-impact: none

Refs RIG-8138

Co-authored-by: Matt Wilkinson <matt@rigel.build>
Refs RIG-8011

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@linear-code

linear-code Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

@rigel-mintaka rigel-mintaka changed the title feat(session): plugin-origin turn marker (RIG-8011) feat(session): plugin-origin session turns with operator-only approval (RIG-8011) Nov 6, 2026
@rigel-mintaka

Copy link
Copy Markdown
Collaborator Author

Review rounds

Round 1 (review-lead, head 9cc0f735): 4 high, 1 medium, 2 low. Fixed in bd100a82:

  • High: cached Codex runtime bypassed plugin-origin approval. Fixed: cache keyed on origin; fresh runtime for plugin turns.
  • High: plugin-origin turns could widen toolsets. Fixed: cotal toolsets pinned.
  • High: managed worker dropped the origin marker. Fixed: turn_v1.plugin_origin plus child worker_turn_scope.
  • High: claimed rows were not re-checked on revocation. Fixed: revoked rows settle, not wedge.
  • Medium: context leaked across drained rows. Fixed: fresh context per row.
  • Low: stale docstring, duplicate import. Fixed.

Head check 1 (bd100a82): 0 runtime findings; 3 high test-adequacy gaps. Fixed in 996ed8ad + dacf6efc; each new test goes red when its fix is reverted.

Head check 2 (069ac2e0, same tree as dacf6efc minus a commit message reword): 0 findings.

All clear

Reviewed head dacf6efc: no open medium-or-higher findings. 403 passed / 0 failed / 6 skipped; ruff clean.

@rigel-mintaka
rigel-mintaka marked this pull request as ready for review November 6, 2026 04:50
@mattwilkinsonn
mattwilkinsonn merged commit 04affdb into rigel-release Nov 7, 2026
1 check passed
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.

2 participants