Skip to content

refuse ACP service on OMP hosts (oh-my-pi) - #237

Merged
ranxianglei merged 2 commits into
masterfrom
fix/omp-host-refuse-service
Sep 1, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
fix/omp-host-refuse-service

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Summary

Refuses ACP service on OMP (can1357/oh-my-pi) hosts. Fixes #234.

Why

OMP's in-process session API diverges from Pi's. The compression refs billion-context-pi injects can drift out of sync with the session's real refs, so compress calls fail with does not exist in this session and one-shot runs never succeed. OMP is no longer actively supported on this plugin (maintainer note on #234) — the in-process integration is too complex to keep reliable.

What changed

  • Host detection — new src/omp.ts: isOmpHost(sm) = !isPiHost(sm), reusing the existing feature-detect (Pi exposes buildContextEntries; OMP only getBranch).
  • Refuse at session_start — on OMP the extension sets a refused flag and, once per process, warns (UI notify in TUI/RPC; console.error to stderr in headless one-shot; plus a log line) pointing users at the supported alternative.
  • Stand down — when refused: the 4 ACP tools return the guidance message, the ACP system-prompt injection is skipped, the context transform is a no-op (messages pass through untouched), and host auto-compaction is left alone (no cancel).
  • Pi hosts are unaffected.
  • Docs — README gains a "Host support" section recommending billion-context for OMP.

Alternative for OMP users

npm install -g billion-context
bili omp -- -p "your task"   # OMP through the proxy — refs never diverge

Tests

  • New tests/omp-refuse.test.ts (5 cases): single warning, tool refusal, headless stderr path, and Pi-host no-regression.
  • npm test → 433 pass, 0 fail. The existing OMP integration tests still pass (they exercise the context handler directly without firing session_start).
  • npm run typecheck clean; npm run build succeeds.

No version bump here — that belongs to the release commit.

@github-actions

github-actions Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Extension Artifact

Branch: fix/omp-host-refuse-service (d0dd0e4)

Option A — Install from npm PR tag (recommended)

pi install npm:billion-context-pi@pr-237

Each push to this PR publishes a new version under the pr-237 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pi-pr237.tgz
pi install ./package

This comment is automatically updated on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

[bot] Reviewed fix/omp-host-refuse-service (273769a) against master. LGTM — checks all pass and the stand-down semantics are correct. A few minor notes below.

Verified

  • npm run typecheck — clean
  • npm test — 433 pass, 0 fail (matches the PR claim)
  • npm run build — tsup OK, dist/index.js 522 KB with acp-kernel inlined
  • Runner semantics confirmed against @earendil-works/pi-coding-agent dist/core/extensions/runner.js:
    • emitContext (line 744): if (handlerResult && handlerResult.messages) → returning undefined passes messages through untouched ✓
    • emitBeforeAgentStart (line 834): if (handlerResult) → undefined skips injection ✓
    • emit for session_before_compact (line 576): if (isSessionBeforeEvent(event) && handlerResult) → undefined means no cancel, host compaction untouched ✓
  • runtime.refused is set synchronously at the top of the session_start handler before any await, so it reliably gates the tools, system prompt, context transform, and compaction handlers. ompWarned is a closure in wireSessionLifecycle, which runs once per process — matches the "once per process" claim.
  • No version bump, per AGENTS.md (release commit handles that).

Minor notes (non-blocking)

  1. src/search-tool.ts indentation is broken — the execute method (line 29) got re-indented to 4 spaces while the rest of the object literal uses 8, and the try/catch block is misaligned (line 34 } catch at 8sp where the body expects 12). Cosmetic, but worth a fixup so the diff stays clean.
  2. The OMP early-return skips checkForUpdate (it sits after the early return in session_start). So a refused OMP session will never auto-update again. Practical impact is minimal (pre-refusal versions still self-update, and OMP is unsupported anyway), but it's a side effect not mentioned in the PR description — worth a one-liner in the commit message or docs if intentional. Also skipped: reloadConfig and delegate tool/widget registration (the latter is arguably good — acp_delegate isn't registered on OMP).
  3. /acp commands are not gated. makeCommands(runtime) registers at factory time, so on a refused host /acp still runs statusReport → runtime.stateFor, which falls into the dormant best-effort OMP path (getBranch fallback). It's user-initiated and harmless (shows an empty/stale panel), but it's slightly inconsistent with the "stand down" posture — the command could return the same guidance message when runtime.refused. Not in scope for this PR; flagging for a follow-up.
  4. isOmpHost = !isPiHost classifies any host lacking buildContextEntries as OMP, including hypothetical future hosts. This matches the existing readContextEntries fallback semantic and is documented in src/omp.ts, so I'm fine with it — just noting the blast radius.

Test coverage

The 5 new cases in tests/omp-refuse.test.ts cover the right surface: single warning across repeated session_start, all 4 tool refusals, headless console.error path, and Pi-host no-regression (cancel + system prompt still active). Good.

None of the notes block merge — the core behavior (refuse + stand down on OMP, zero impact on Pi) is implemented correctly.

@ranxianglei

Copy link
Copy Markdown
Owner Author

readme只更新了英文.
需要在开头明确说,omp不适用,并且选择bili版本.然后附上一个url.这个单独写一个文档吧,

bili omp -- -p "your task"",

这个例子有问题 ,实际命令就是 bili omp

本机实际测试 pi是否还能用,omp是否一定拒绝

@ranxianglei

Copy link
Copy Markdown
Owner Author

[bot] 已按反馈修改并推送(分支 fix/omp-host-refuse-service,commit 8a4f867)。

1. bili omp 示例修正
实际命令就是 bili omp,已去掉 -- -p "your task":

  • src/omp.ts 的拒绝提示
  • README.md 的 Host support 小节

2. 新增独立文档(中英)

3. README 开头明确说明(中英都加)

  • README.md 与 README.zh-CN.md 顶部都加了醒目提示:本插件面向 Pi、不支持 OMP,OMP 用户改用 bili omp,并链接到独立文档。
  • 之前中文版 README 完全没有 Host support 小节,现已补上,与英文版对齐。

4. 本机实测

  • Pi 仍可用:扩展正常加载,session_start 正常、context 转换生效(日志有 [turn] 事件),无 omp-unsupported,模型正常响应。
  • OMP 一定拒绝:多次运行(显式 -e 加载、目录发现、重复 3 次、最终构建后)均稳定拒绝,每次恰好一条 event=omp-unsupported action=refused 日志 + 一条 stderr 提示(headless 路径),且模型仍能响应(ACP 已禁用,宿主自身上下文处理不受影响)。
  • 已确认修正后的拒绝提示输出为 bili omp(不再有 -- -p "your task")。

npm run typecheck 通过、npm test 433 pass / 0 fail、npm run build 成功。未做版本 bump(留给 release commit)。

ework-agent added 2 commits September 1, 2026 08:59
OMP's in-process session API diverges from Pi's, so the compression refs
the extension injects drift out of sync with the session's real refs and
compress calls fail with 'does not exist in this session' (#234).

Detect the host at session_start (isOmpHost = !isPiHost). On OMP the
extension now refuses service: it warns once (UI notify, or stderr when
headless, plus a log line), disables the four ACP tools, skips the ACP
system-prompt injection and the context transform, and lets the host
compact normally. Pi hosts are unaffected.

Points OMP users at the billion-context proxy (bili omp) as the supported
alternative. Adds tests/omp-refuse.test.ts (5 cases) and a README
'Host support' section.
Address review feedback on the OMP refusal:
- src/omp.ts: the real command is just 'bili omp' (drop ' -- -p "your task"')
- docs/omp.md + docs/omp.zh-CN.md: dedicated OMP support doc (not supported,
  use the billion-context proxy)
- README.md / README.zh-CN.md: prominent top note (OMP unsupported, use bili)
  and a host-support section in the zh-CN README (was EN-only)
@ranxianglei
ranxianglei force-pushed the fix/omp-host-refuse-service branch from 8a4f867 to d0dd0e4 Compare September 1, 2026 01:04
@ranxianglei
ranxianglei merged commit 86fbaff into master Sep 1, 2026
8 of 9 checks passed
@ranxianglei ranxianglei mentioned this pull request Sep 1, 2026
HangxiangMa pushed a commit to HangxiangMa/billion-context-pi that referenced this pull request Sep 21, 2026
Picks up kernel ranxianglei#175 (stale-ref gate messages report true causes with
diagnostics) and ranxianglei#176 (reclaim dead message refs, reuse exhausted
capacity, classify boundary failures).

Skip the three OMP identity-binding tests: kernel 0.0.48 prunes refs
absent from the sync view, which conflicts with OMP live-ref stability.
OMP hosts are being refused separately (ranxianglei#237).
HangxiangMa pushed a commit to HangxiangMa/billion-context-pi that referenced this pull request Sep 21, 2026
…se-service

refuse ACP service on OMP hosts (oh-my-pi)
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.

0.1.52 on OMP host: nudge example emits refs that do not exist in session (compress never succeeds in one-shot runs)

1 participant