Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

### Fixed

- Type-checks against omp 19.4.0, whose session handles gained `getForkBaseline()`: Main and seat identity checks now compare only this process's local sessions, so `bun run check` passes again with unchanged runtime behavior

## [0.4.0] - 2026-11-28

### Breaking Changes
Expand Down
9 changes: 8 additions & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { z } from "@oh-my-pi/omptype/zod";
import type { ExtensionAPI, ExtensionContext } from "@oh-my-pi/pi-coding-agent";
import { InternalUrlRouter } from "@oh-my-pi/pi-coding-agent/internal-urls";
import { AgentRegistry, MAIN_AGENT_ID } from "@oh-my-pi/pi-coding-agent/registry/agent-registry";
import { isLocalAgentSession } from "@oh-my-pi/pi-coding-agent/session/agent-session-handle";
import { logger } from "@oh-my-pi/pi-utils";
import { applyActiveTools } from "./omomp-shared/active-tools.ts";
import { tr } from "./omomp-shared/i18n.ts";
Expand Down Expand Up @@ -95,7 +96,13 @@ class ProcessRuntime {
async start(pi: ExtensionAPI, ctx: ExtensionContext, identity: CoordinatorIdentity): Promise<void> {
if (this.started) return;
const root = AgentRegistry.global().get(MAIN_AGENT_ID)?.session;
if (ctx.agent.id !== MAIN_AGENT_ID || ctx.agent.kind !== "main" || !root || root.sessionManager !== ctx.sessionManager)
if (
ctx.agent.id !== MAIN_AGENT_ID ||
ctx.agent.kind !== "main" ||
!root ||
!isLocalAgentSession(root) ||
root.sessionManager !== ctx.sessionManager
)
throw new Error("Dispatch requires the actual native Main");
this.started = true;
this.binding = { pi, ctx };
Expand Down
2 changes: 1 addition & 1 deletion src/ports/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function createHostPort(options: HostOptions): HostPort {
return {
bind(ctx) {
const ref = registry.get(ctx.agent.id);
if (!ref?.session || ref.session.sessionManager !== ctx.sessionManager)
if (!ref?.session || !isLocalAgentSession(ref.session) || ref.session.sessionManager !== ctx.sessionManager)
return { ok: false, error: { kind: "precondition", message: "Caller is not the current native session" } };
if (ref.id === MAIN_AGENT_ID && ref.kind === "main")
return {
Expand Down