Skip to content

fix(#451): restore plugin-mode nudge injection + honest diagNudge log - #456

Merged
ranxianglei merged 1 commit into
masterfrom
2026-09-02_restore-plugin-nudge
Sep 2, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-09-02_restore-plugin-nudge

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What

Restores proactive nudge injection in plugin mode (regression introduced in 0.1.69 / commit 225ceb4) and makes the diagNudge log honest about delivery.

Root cause

225ceb4 gated all three nudge injection sites (prepareAnthropic / prepareOpenai / prepareResponses) with !pluginMode, on the premise that "in plugin mode the agent owns compression". That premise is wrong: the agent plugins (src/agent/pi.ts, src/agent/omp.ts) are pure protocol clients with no nudge channel — they register the 4 ACP tools and forward executions, nothing more. So the gate silently disabled the only proactive trigger in plugin mode, leaving compression to fire solely via preflight at the hard limit (the whole 198k→262k band went naked). Meanwhile diagNudge kept logging INJECT, so the log lied about delivery (same class as #413).

Fix

  • Drop !pluginMode from the three nudge gates. The nudge is an ephemeral trailing user message — not persisted, never enters the agent's re-sent history, prefix-cache-anchor safe — so it belongs in both modes. Tool injection stays gated by !pluginMode (the agent provides the tools).
  • diagNudge now takes the actual willInject decision and prints INJECT only when the nudge truly reaches the upstream payload; otherwise ARMED-SUPPRESSED. The log no longer lies.
  • README two-modes table: split the combined tools/nudge row (tools = none in plugin mode, nudge = yes in both modes).
  • New regression test tests/plugin-nudge-injection.test.ts asserts the nudge is a trailing user message in both proxy and plugin mode when armed. Verified it fails 30 !== 31 against the old gate.

Out of scope (reported separately)

Issue #451 also noted assistant messages leaking <acp…> tags into the client TUI (pre-existing since 0.1.68). There is an outbound tag-echo filter (src/loop/tag-echo-filter.ts), so "outbound doesn't strip" needs its own investigation — filed separately to keep this PR focused on the regression.

Pre-flight

  • npm run typecheck ✅
  • npm test → 901 pass / 0 fail ✅ (was 899; +2 new)
  • npm run build ✅

Fixes #451.

0.1.69 (225ceb4) gated all three nudge injection sites by !pluginMode on
the premise that "in plugin mode the agent owns compression". The agent
plugins (pi/omp) are pure protocol clients with NO nudge channel of their
own, so the gate silently disabled proactive compression in plugin mode —
leaving only preflight at the hard limit — while diagNudge kept logging
"INJECT" (the log lied about delivery, same class as #413).

- Drop !pluginMode from the anthropic/openai/responses nudge gates. The nudge
  is an ephemeral trailing user message (not persisted, never enters the
  agent's re-sent history, prefix-cache-anchor safe), so it belongs in BOTH
  modes. Tool injection stays gated by !pluginMode (the agent provides tools).
- diagNudge now takes the actual willInject decision and prints INJECT only
  when the nudge truly reaches the upstream payload, else ARMED-SUPPRESSED.
- README two-modes table: split the tools/nudge row (tools = none in plugin
  mode, nudge = yes in both modes).
- tests/plugin-nudge-injection.test.ts: regression guard asserting the nudge
  is a trailing user message in BOTH proxy and plugin mode when armed
  (verified to fail 30!==31 against the old gate).

typecheck / test(901) / build green.
@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-09-02_restore-plugin-nudge (1f7dc7f)

Option A — Install from npm PR tag (recommended)

npm install -g billion-context@pr-456

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

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr456.tgz
npm install -g package

This comment is automatically updated on each push.

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.69 回归: plugin 模式 nudge 注入被 !pluginMode 静默禁用 — INJECT 日志照打但从不投递, 自动压缩只剩 preflight 应急

1 participant