Skip to content

fix(runner): follow omp 18.22 run lifecycle - #518

Closed
andrebrait wants to merge 2 commits into
mainfrom
fix/runner-omp-18.22
Closed

andrebrait wants to merge 2 commits into
mainfrom
fix/runner-omp-18.22

Conversation

@andrebrait

@andrebrait andrebrait commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

omp 18.22 (upstream can1357/oh-my-pi@0730879325) ends a run once and pauses loops with agent_pause; waitForSessionSettlement/hasPendingAsyncWork became isRunActive/wakeSources/waitForRunEnd. The newest fork build no longer compiled against the runner, which is why Binary prerelease fails on main.

  • Pin runner/ to v18.22.0-int.202611171027.gec3956c.
  • events.ts forwards through upstream's toWireEvent (session/loop-end-wire): agent_pause → agent_end {isTerminal:false, yielded, awaitingAsyncWork}, the run's end → agent_end {isTerminal:true, yielded:true}. The runner's own settle watcher is replaced by upstream's RpcSessionSettleWatcher.
  • goal.ts/prompt-results.ts follow the same conditions as upstream's RPC mode; get_state.hasPendingAsyncWork = wakeSources !== undefined; edit_message refuses while isRunActive (also covers a run paused on a child agent).
  • The ompweb wire is unchanged.

Verified: runner tsc -p . clean, bun test 30 pass; linux-x64 binary --smoke-test ok; server tests touching isTerminal/session_settled (11 files) 764 pass.

Summary by CodeRabbit

  • Bug Fixes
    • Improved session handling for background work, so runs can pause and resume without prematurely settling the session.
    • Session events are now reported consistently when a run ends, including while background work is still pending.
    • Message edits are blocked while a run is active or a snapshot is in progress.

omp 18.22 (upstream 0730879325) ends a run once and pauses loops with
agent_pause; the settle API became isRunActive/wakeSources/waitForRunEnd.
Map them onto the unchanged channel wire with upstream's own loop-end
wire codec and RPC settle watcher, and pin the runner to
v18.22.0-int.202611171027.gec3956c.
@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The runner advances to omp 18.22. It converts session events to wire events, uses the RPC settlement watcher, and updates command and prompt handling for yielded events.

Changes: Omp Event Handling

Layer / File(s) Summary
Omp 18.22 build and dependencies
runner/omp-build.json, runner/package.json, CHANGELOG.md
The configured build and dependency tarball references advance to 18.22. The Unreleased changelog describes omp run-ending and loop-pausing behavior.
Wire events and session settlement
runner/src/events.ts, runner/test/events.test.ts
HostEvents converts incoming events to wire events before stamping and filtering, and uses RpcSessionSettleWatcher for settlement. Tests cover yielded agent_end events while background work is pending and after it resolves.
Yielded-event handling
runner/src/commands/model.ts, runner/src/commands/session.ts, runner/src/goal.ts, runner/src/prompt-results.ts
Command state and edit checks use updated pending-work and active-run conditions. GoalController handles all agent_end events, and PromptResults recognizes yielded agent_pause and agent_end events as run boundaries.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant OmpSession
  participant HostEvents
  participant RpcSessionSettleWatcher
  OmpSession->>HostEvents: AgentSessionEvent
  HostEvents->>HostEvents: Convert to wire event, stamp, and filter
  HostEvents->>RpcSessionSettleWatcher: Probe scheduled turn
  RpcSessionSettleWatcher-->>HostEvents: session_settled when settled
Loading
Merge Risk: Minimal · up to 86b1e

The runner adapts to omp 18.22 lifecycle changes while keeping the wire frames unchanged. No concrete merge-blocking defect was established.

Security architecture risk: Minimal · up to 86b1e

The inspected changes do not establish a new security, isolation, or ownership failure. Result reporting remains session-scoped, and history editing retains an active-run guard.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The inspected reporting and forwarding state is scoped to an AgentSession: each Prompting instance owns its results and goal controller, and bridge state is keyed by session. No cross-session routing or additional tool authority was established in the changed paths.

Trust Boundaries and Controls

  • observed — Host-submitted input continues through ordered dispatch and current-sequence/session checks. Lifecycle observation instead consumes events from the owning session subscription. Prompt-result emission does not modify these admission controls; admission resolves through a separate callback.

Resilience and Maintainability Implications

  • observed — Prompt reporting retains an idempotent ticket-deletion gate before deferred emission. Session transitions retain explicit handling for detached prompts, and reports compute sessionSettled separately from their outcome, rather than treating a reported yield as proof that all session work has ended.
Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "fix(runner): follow omp 18.22 run lifecycle" names the main change. The PR updates the runner for omp 18.22, pinned to a new build. It adapts the run-end and loop-pause handling, and the ev…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(runner): follow omp 18.22 run lifecycle" names the main change. The PR updates the runner for omp 18.22, pinned to a new build. It adapts the run-end and loop-pause handling, and the event forwarding and settle watcher changes in events.ts, goal.ts, and prompt-results.ts match that lifecycle focus. The title is specific and concise, and it does not list files.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c3a27270-7341-4868-b0ed-54c066066b54
Commits

Reviewing files that changed from the base of the PR and between 7c13eaa and 86b1e6a.

Files ignored due to path filters: 1

  • runner/bun.lock is excluded by !**/*.lock
Files selected for processing: 9

  • CHANGELOG.md
  • runner/omp-build.json
  • runner/package.json
  • runner/src/commands/model.ts
  • runner/src/commands/session.ts
  • runner/src/events.ts
  • runner/src/goal.ts
  • runner/src/prompt-results.ts
  • runner/test/events.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@andrebrait

Copy link
Copy Markdown
Collaborator Author

Superseded: the runner moved into the oh-my-pi fork (packages/ompweb-runner on oml, a645f02a7e, with this 18.22 port), and #520 removes runner/ and fetches the runner from the fork release.

@andrebrait andrebrait closed this Nov 17, 2026
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