Skip to content

fix: register provider and scope subagent sessions - #10

Open
LaurensBosscher wants to merge 5 commits into
DevVig:mainfrom
LaurensBosscher:upstream/05-subagent-sessions
Open

LaurensBosscher wants to merge 5 commits into
DevVig:mainfrom
LaurensBosscher:upstream/05-subagent-sessions

Conversation

@LaurensBosscher

Copy link
Copy Markdown

Changes

  • Register the Claude provider for subagents and scope Claude Code session state by OMP session.

Stacked after #9: this branch includes earlier commits until their PRs merge.

Verification and limitation

  • Unit tests passed in the local fork.
  • A successful concurrent bridge-backed smoke test of this isolation change remains unverified: Claude Code was session-limited during the attempt, and OMP fell back to another provider.

omp-install and others added 5 commits September 18, 2026 09:47
Deep @oh-my-pi/* imports fail under OMP 18.2.5 extension loading because
host onLoad only rewrites legacy scopes onto in-process shims. Switch to
@earendil-works root imports (proven on this host) and register
claude-opus-5 so existing modelRoles/fallbackChains keep resolving.
…, Fable 5.1, Mythos) + max effort

Derive the picker from the host's anthropic catalog instead of a hardcoded id
list, keeping the 1M/200K variant entries. Measured [1m] entitlements stay in
tables; unmeasured 1M-capable models default to 200K with a -1m alternate.
Map thinking levels onto each model's catalog effort ladder (adds max).
Fix unsuffixed entries throwing when their preferred window has no runtime.
OMP 18 ends some turns with developer messages (subagent reminders, synthetic
continues). The bridge only read user messages, so it replaced them with
"[continue]" and dropped them from rebuilt history. Treat them as user turns,
matching OMP's anthropic provider; empty ones are skipped.
…session per OMP session

OMP 18 clears each extension source's providers when it creates a session on
the shared ModelRegistry and replays only that instance's registrations. The
re-registration guard made parallel subagents lose the provider entirely
("No API key found for claude-bridge"). Always register; streamSimple still
routes to the first active instance.

Subagents share this module instance, so the single global sharedSession let
parallel sessions resume each other's Claude Code session (cross-talk) and let
a subagent's session_start/shutdown reset the parent's. Key session state by
OMP session id.
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 654de812-1d5c-401f-b9d6-d4e9cb7fd688
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T09:47:45.465502Z 30b017e PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 30b017e0d8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/index.ts
Comment on lines +1750 to +1751
const routeStreamSimple = (model: Model<any>, context: Context, options?: SimpleStreamOptions) =>
((g[ACTIVE_STREAM_SIMPLE_KEY] as typeof streamClaudeAgentSdk | undefined) ?? streamClaudeAgentSdk)(model, context, options);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the first stream owner past session start

When a subagent evaluates a separate module instance while the parent query is active, the parent has already run clearSession from its session_start handler, which clears ACTIVE_STREAM_SIMPLE_KEY; the subagent therefore claims the key and then clears it again on its own session_start. This router consequently falls back to the subagent's local streamClaudeAgentSdk after its registration overwrites the shared registry, so the parent's next tool-result callback cannot see the parent's activeQueryContexts and the query breaks. Keep the routing owner independent of per-session clearing, or clear it only when the owning instance actually shuts down.

Useful? React with 👍 / 👎.

Comment thread src/index.ts
}

if (sharedSession) sharedSession.cursor = context.messages.length;
advanceSharedCursor(sessionKey, context.messages.length);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Defer developer prompts delivered with tool results

When OMP appends a developer reminder or synthetic continue in the same callback as a tool result (for example assistant, toolResult, developer), extractAllToolResults still finds the result, but the result-delivery path defers only lastMsgRole === "user". This cursor advance then marks the developer message consumed, so it is neither replayed nor imported on a later rebuild and the instruction is permanently lost. Apply isPromptRole to the deferral path before advancing the cursor.

Useful? React with 👍 / 👎.

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