Skip to content
YukoOshimaPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

omp-patch

oh-my-pi extension that improves transient failure recovery, advisor autoresume, goal-mode magic-keyword stickiness, Responses WebSocket continuity, and Remote Compaction V2 gateway compatibility.

Stream retry

Auto-continues the main session after:

  • Cursor Connect resource_exhausted (stock classifier often fail-fasts via retry.maxDelayMs)
  • Stock fail-fast when the provider asks to wait longer than retry.maxDelayMs (e.g. 30m > 5m) — continue starts on auto_retry_end, waiting at most 5 minutes (never the full provider window)
  • HTTP/2 stream resets: Stream closed with error code NGHTTP2_INTERNAL_ERROR (stock auto-retry skips when the failed turn already has toolCall blocks)
  • Stream idle stall / first-event timeout
  • Thinking-loop errors that include stream stall

How: Retries are scheduled with the host managed timer API (ctx.setTimeout) so the extension handler returns immediately — omp hard-times out handlers at 30s and discards their return value, which would silently drop long backoffs under a sleep-in-handler design. Managed timers are contained (a throwing/rejecting callback is routed to the extension error channel instead of crashing the process) and are cleared automatically on session_shutdown, so a pending retry can never fire into an unloaded runtime (Extension runtime not initialized). Continue is always triggered from agent_end / auto_retry_end via pi.sendMessage(..., { triggerTurn: true, deliverAs: "nextTurn" }).

Dedupe: One terminal failure fans out to multiple events; continues are keyed by error class and the key resets on agent_start, so the same failure fanout continues once while an identical failure on a later turn retries normally. Cap: 5 consecutive continues (truly effective under this dedupe).

Session: session_start / session_switch / session_shutdown cancel any pending retry and reset the consecutive count.

Backoff: ~5s first continue for ordinary blips, then ~45–75s. When the provider requests a longer wait (e.g. 30m), sleep min(requested, 5m). Never wait more than 5 minutes per continue.

Keep stock retry.maxDelayMs at the default (~5m) so omp fail-fasts instead of sleeping multi-hour rate-limit windows; omp-patch then continues with the 5m cap above.

Advisor autoresume

When omp 16.5.2+ preserves a concern/blocker card after the primary already finished with a terminal text answer (stock waits for you to type 继续 / . /c), this extension auto-continues one turn so the agent can weigh and act on the advice.

  • Default: on
  • Toggle: /advisor-autoresume
  • Scope: concern/blocker only (nit stays aside)
  • Skips: live steered turns, plan mode, Esc/cancel preserves (no recent terminal answer), and caps at 3 consecutive autoresumes

This does not replace advisor.immuneTurns tuning. Set immuneTurns: 0 separately if dual advisors are cooldown-downgrading each other to asides.

Goal magic sticky

Stock omp only injects ultrathink / orchestrate / workflowz notices when a user prompt contains the standalone keyword. Goal auto-continuations skip that path, so keywords in /goal set … would only fire once.

This extension re-injects the matching notices on later goal turns when:

  • the active goal objective contains the keyword(s) (paused/dropped → off)
  • magicKeywords.* still allows them (unreadable config → no inject)
  • stock would not already inject on this turn (no double notice on the first auto-submit)
  • for workflowz: the task tool is active
  • main session only (keyed by session id; subagents never sticky-inject)

No extra slash command — writing the keyword into the objective is the enable switch.

Example:

/goal set 研究 auth 存储路径 workflowz orchestrate;交付结构化地图与证据

Gateway Responses WebSocket

gateway-openai-ws/gpt-5.6-{sol,terra,luna} sends Responses response.create frames over a configured Responses WebSocket endpoint. It keeps one socket per OMP provider session and uses previous_response_id with delta input only while the saved full-history prefix remains exact. A session, model, history, or socket change clears that baseline. It never falls back to HTTP.

The provider is dynamically registered as a WebSocket-only custom API. Configuration is resolved in this order:

  1. A complete explicit environment pair:
export OMP_PATCH_GATEWAY_OPENAI_API_KEY='...'
export OMP_PATCH_GATEWAY_OPENAI_BASE_URL='https://gateway.example/v1'
  1. The existing gateway-openai entry in the active OMP models.yml or models.yaml. It must declare api: openai-responses, an API-key credential, baseUrl, and apiKey. Compatible custom headers are preserved for the WebSocket handshake.

The environment pair is all-or-nothing; omp-patch never combines one environment value with a different models.yml value. It does not add a static gateway-openai-ws model or an HTTP fallback.

Non-loopback HTTP endpoints always require explicit consent because the Bearer credential and session stream would be clear text:

export OMP_PATCH_ALLOW_INSECURE_GATEWAY_HTTP=1

Start a new OMP session after changing any of these values. /reload-plugins alone does not reload extension source.

Remote Compaction V2

For the WebSocket provider, omp-patch starts a loopback-only capability-URL proxy for V2 compaction. It forwards only the compaction stream to the configured Responses endpoint and rewrites only completed compaction_summary output items to the compaction item required by Pi's V2 collector. Other stream events, request headers, bodies, and upstream HTTP failures pass through unchanged.

Enable automatic V2 compaction with:

compaction:
  enabled: true
  strategy: context-full
  remoteEnabled: true
  remoteStreamingV2Enabled: true

This provider is deliberately V2-only. Use normal automatic compaction or /compact; the V1-only /compact remote selector does not select this provider.

Upgrades

OMP core upgrades keep this extension directory and its local source changes. omp plugin upgrade omp-patch or reinstalling the GitHub dependency replaces the installed checkout with its upstream revision, so retain or publish the plugin changes before either operation.

Requirements

Requires oh-my-pi >= 17.2.0 < 18 (managed timer API, Responses request helpers, and Remote Compaction V2 collector).

Install

# install from Git main
omp plugin install 'git+https://github.com/YukoOshima/omp-patch.git#main'
# or link a local checkout
omp plugin link /path/to/omp-patch

Then start a new session (or --resume) so the extension module loads. /reload-plugins alone is not enough for extension code changes.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages