Skip to content

fix: bili omp launcher disables omp's native auto-compaction (#449) - #454

Merged
ranxianglei merged 1 commit into
2026-09-02_pi-disable-native-compactionfrom
2026-09-02_omp-disable-native-compaction
Sep 3, 2026
Merged

ranxianglei merged 1 commit into
2026-09-02_pi-disable-native-compactionfrom
2026-09-02_omp-disable-native-compaction

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What

Mirror of the #447 pi fix for the bili omp launcher. prepareOmpHttpRewrite now always builds the <ompHome>-bili overlay (when the real home exists) and writes a generated config.yml with compaction.enabled=false merged over the real config.yml / config.yaml / settings.json. This stops omp's native auto-compaction (shouldCompact, gated by compaction.enabled, on by default) from firing alongside bili's ACP compression and lossily rewriting the context.

Key correction vs. the issue

The issue suggested writing settings.json. Verified against omp source (@ranxianglei/omp-stable): omp reads config.yml at runtime — MAIN_CONFIG_FILENAMES = ["config.yml", "config.yaml"], #configPath = <agentDir>/config.yml. settings.json is only a one-time migration source (renamed to .bak once migrated). So the fix targets config.yml. There is no env var or CLI flag to disable compaction; omp config set compaction.enabled false (which writes config.yml) is the only mechanism.

Details

  • config.yml joins the overlay generated-file set → neither symlinked nor merged back into the real home (真实 models.yml 可被塞进死端口代理地址且永不解包:"real file never touched" 前提被嵌套 merge-back 递归与遗留插件写破,裸 omp 永久拨死号 #410 rule). models.yml is still generated only when present. Real config files are never touched.
  • Merge is line-based (no YAML dep added; zero-runtime-deps preserved). Handles: existing compaction: block with/without enabled: (override/insert), no compaction: key (append), legacy settings.json fallback (written as JSON — a valid YAML subset omp parses fine), and empty home (minimal file).
  • Behavior change: the overlay is now always built for a real omp install (previously skipped when there were no http rewrites), so PI_CODING_AGENT_DIR always points at the overlay and compaction is always disabled.

Stacked on #448

Reuses the overlay machinery from the pi fix (refreshOverlayHome / mergeOverlayEntry accepting a set of generated files). Base is the pi branch; merge after #448 lands.

Verification

  • npm run typecheck ✅
  • npm test ✅ (904 pass)
  • npm run build ✅
  • End-to-end config check with omp's real parser (Bun.YAML.parse) across 7 scenarios (existing compaction block, no block, only-block, legacy settings.json fallback, empty home, config.yaml base, real-file-untouched): all produce valid YAML with compaction.enabled === false and other keys preserved.

prepareOmpHttpRewrite now always builds the <ompHome>-bili overlay (when the real home exists) and writes a generated config.yml with compaction.enabled=false merged over the real config.yml/config.yaml/settings.json, so omp's native auto-compaction (shouldCompact, gated by compaction.enabled) can no longer fire alongside bili's ACP compression and lossily rewrite the context. config.yml joins the overlay generated-file set (neither symlinked nor merged back into the real home, #410); models.yml is still generated only when present. Real config files are never touched.

omp reads config.yml at runtime (settings.json is only a one-time migration source renamed to .bak), so this targets config.yml rather than settings.json as the issue first suggested. Stacked on the #447 pi fix (shared overlay machinery).
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 ework agent · qwen3.8-27b

[bot] 🏷 On it. Confirmed this is an implementation task — PR #449 doesn't exist yet (404), and the open pi fix is #448 (branch 2026-09-02_pi-disable-native-compaction, base master, unmerged).

Plan:

  1. Base my branch on the pi branch (my code depends on fix: bili pi launcher disables pi's native auto-compaction (#447) #448's new refreshOverlayHome(…, string[]) / mergeOverlayEntry(…, ReadonlySet) signatures — won't typecheck on master alone).
  2. Mirror the pi approach in prepareOmpHttpRewrite: always build the <ompHome>-bili overlay when the real home exists, generate a config.yml carrying compaction.enabled=false merged over the real config.yml / config.yaml / settings.json (line-based, no YAML dep), keep models.yml generated-only-when-present, never touch real files.
  3. Add unit tests mirroring the pi ones (+ the 7 merge scenarios you listed), run typecheck / test / build.
  4. Open a stacked PR against the pi branch; retarget to master once fix: bili pi launcher disables pi's native auto-compaction (#447) #448 lands.

Will report back with the diff + verification results.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 ework agent · qwen3.8-27b

Reviewed and verified this PR end-to-end.

Status: complete and ready to merge once #448 lands.

The fix is on branch 2026-09-02_omp-disable-native-compaction (commit 01212cc) and PR #454 is open, correctly stacked on the pi fix (2026-09-02_pi-disable-native-compaction, #448).

I checked out the PR head and ran the full pre-flight locally:

  • npm run typecheck — clean
  • npm test — 904 / 904 pass
  • npm run build — success

The design matches the stated intent on every point I audited:

As part of review I re-implemented the change from the spec in a scratch branch and diffed it against the PR head — functionally identical (cosmetic differences only: loop structure, existsSync ordering, comment wording), which gives me high confidence in correctness.

One minor, non-blocking note outside the stated scope: the line-based merge assumes block-style YAML. A hand-written flow-style value like compaction: {} would not be recognized and would append a second top-level compaction: key rather than editing in place. omp config set compaction.enabled false emits block style, so this only matters if someone hand-writes flow style — flagging in case you want a guard later.

I have not merged anything (merge is human-only) and left the PR open for you. Nothing further needed from my side.

@ranxianglei
ranxianglei merged commit b36d418 into 2026-09-02_pi-disable-native-compaction Sep 3, 2026
ranxianglei added a commit that referenced this pull request Sep 3, 2026
fix: land #454 (omp native compaction disable) on master — it was merged into its already-merged base branch
@ranxianglei ranxianglei mentioned this pull request Sep 3, 2026
antclt pushed a commit to antclt/billion-context that referenced this pull request Sep 3, 2026
@ranxianglei
ranxianglei deleted the 2026-09-02_omp-disable-native-compaction branch October 15, 2026 05:32
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