Skip to content

fix(integration): diagnose old hosts, publish ops_status on built-in presets, and teach batching guidance on tool results (#701, #753, #929, #966, #897) - #1008

Closed
Nicholas023 wants to merge 6 commits into
mainfrom
fix/guidance-integration
Closed

Nicholas023 wants to merge 6 commits into
mainfrom
fix/guidance-integration

Conversation

@Nicholas023

Copy link
Copy Markdown
Collaborator

Closes #701, #753, #929, #966
Refs #897

What was wrong

The change

  • src/adapter/dsh/host-floor.ts: reads the declared floor from the package manifest (engines.dsh) and refuses an older host at activation with one named diagnosis; unreadable/unknown versions load as before.
  • src/integration + src/index.ts: built-in modes mount the read-only diagnostics for exactly their own sessions; the mount settles asynchronously because a synchronously resolved fiber never hears the agent/created dispatch.
  • src/publication/ptc.ts: the one-time batching lesson now rides the first accepted root run_code tool result through additionalContexts (the same-step ephemeral inbox the host never logs as user history) under contributor batching-guidance:lesson; the per-violation notices keep the base id. The durable-history latch is gone.
  • src/niubash: face list aligned with winuxcmd applets; stale generated faces are detected and the version is rebuilt/retired on upgrade.
  • test/prompt-budget.test.mjs: resident budgets re-pinned for the ops_status mount, with the measured before/after/net values recorded in the test comment (minimal 8100→8300, ptc 19200→19300; standard/cordis unchanged at 13700).
  • Docs: troubleshooting single shell tool name; bilingual changelog entries.

Local validation: integration-host-floor 4/4, integration-status-builtin 3/3, integration-diagnostics 4/4, prompt-ephemeral-teaching 2/2, resident-switch 24/24, niubash-faces-consistency 3/3, prompt-budget 1/1, check:size 827 files all ≤1000 lines.

Validation

$ npm run build
build: compiled src/ to lib/ and copied 60 assets

$ node scripts/verify-gate.mjs --skip-install --keep-going
268 suites passed; skipped: linux-attributes, linux-shell, tui-host, tui-native (allowed: file-metadata, linux-attributes, linux-shell, tui-host, tui-native)
manifest: 92/59 checks
win32-x64: gate green

The gate lines above were produced on the local integration head b21274dd (all slices merged) with the pinned local fixtures:
DSH_OPS_TEST_BASH = a verified pinned MSYS bash (sha256 6cc575e9…), DSH_OPS_NIUBASH_ARCHIVE = the shipped frozen archive. Each PR branch was also built and its own suites were run before push; the counts below are from those runs.

CI required run: the pull_request event for this PR triggers ci.yml; paste the aggregate CI required run URL here once it finishes.

Environment

  • OS: Windows x64 25H2; Node.js v24.21.0; DSH 0.2.2-rc.1
  • Based on upstream main commit 58f6e281 (origin/main at submission)
  • Install channel: local source build (npm ci --ignore-scripts --offline, npm run build, npm run stage:niubash -- --offline --archive <frozen archive>)

…iagnosis (#701)

An older host used to load anyway and fail later: TypeError scope errors backstage, EXECUTOR_UNAVAILABLE in front. The floor is read from the package manifest (engines.dsh), never a copy, and an unknown host version loads as before because it cannot be proven below the floor. Red/green evidence: test-results/red/host-floor-revert-red.txt, test-results/green-host-floor/.
The diagnosis tool was registered only behind an external preset row, while the diagnosis itself already understood mode sessions. The built-in mode row now mounts the same read-only diagnosis for exactly its own mode's sessions; the mount settles asynchronously because a synchronously resolved fiber never hears the agent/created dispatch its injection registered. Sessions of other modes stay unadmitted by that row. Red/green evidence: test-results/red/status-builtin-revert-red.txt, test-results/green-status-builtin/.
The package publishes exactly one shell tool, ops_bash, and a misnamed bash call is answered by the host's own unknown-tool handling, which never reaches this package. The section names where the alias could exist (it does not) and where a did-you-mean correction belongs: upstream.
…#753)

Measured on win32, mount on: minimal 3536/8246/4710, standard 3536/12670/9134, cordis 3536/12670/9134, ptc 7553/19200/11647 (before/after/net). With the #753 mount disabled the same run reports 3536/8045/4509, 3536/12469/8933, 3536/12469/8933 and 7553/19026/11473, so the 174-201 byte difference is the ops_status schema and guidance this accepted behaviour adds. minimal and ptc carry the added allowance (8100->8300, 19200->19300); standard and cordis keep their previous, still-unused headroom.
@Thatgfsj

Copy link
Copy Markdown
Collaborator

Coordination note from #998 (P7: distinguish re-taught lessons after resume from missed lessons after compaction).

Scope of #998 on my side, on the card/d3-full-publication lineage (the step-tail lesson channel this PR removes on main):

  • A restored session replays its seed without republishing session/event, so the in-memory taught latch starts false while the lesson is still visible in derived history, and the current channel re-appends the full lesson after resume. A compaction replace shadows the lesson node while the latch stays true, so the lesson is never re-delivered when needed. [OPS-PTC P7] 区分恢复后的重复教学与压缩后的漏教 #998 fixes both by judging from session.deriveMessages() (what the model actually sees), with a one-line recap after compaction instead of a full re-teach.

Overlap with this PR: src/publication/ptc.ts only, and textually limited to the lesson provider/latch block this PR already rewrites. Your move of the lesson onto the first accepted root run_code tool result via additionalContexts (never logged as user history) structurally resolves the resume-duplicate case on main — the ephemeral channel re-delivers per agent lifetime by design, and compaction cannot remove what never entered the surface. I will not touch your channel; the decision logic (visible / taught-then-compacted / never-taught) and its tests stay reusable if the card lineage ever adopts the same channel. No merge-order dependency either way; whichever lands second rebases that one block.

@Thatgfsj

Copy link
Copy Markdown
Collaborator

协调说明(#998 / P7):本单在 d3 工作线(基线 card/d3-full-publication@d0fcd6f)上实现教学去重——该线上 batching lesson 仍经 step-tail 进入 logged history,正是你 PR 里 #929 改为 additionalContexts 之前的形态。我们以 session.deriveMessages()(模型实际可见历史)为准区分:恢复后同版可见则新增 0 条、压缩 replace 遮蔽后补一条短提示、撤回批次不消耗教学机会,改动在 src/prompt-injection/index.ts(去重)与 src/publication/ptc.ts(注入点)。两个分支会同时改 ptc.ts 的教学 wiring,合并时需要以此为准做一次对账:若你的 ephemeral additionalContexts 方案落地,durable step-tail 的去重在那条线上自然失效,但框架层的可见性去重对任何 durable step-tail 贡献仍然适用。

IsaacHuo added a commit to IsaacHuo/dsh-ops-pro that referenced this pull request Nov 20, 2026
The lesson rode the accepted user batch, entered logged history and was
answered as fresh user input (T-Auto#929). Deliver it once through the first
accepted root run_code result instead, keep the surface-aware rendering,
and narrow the file-work rule and examples to the APIs the scope publishes
so a read-only lesson never teaches an edit.

Direction from upstream T-Auto#1008.
@Thatgfsj

Copy link
Copy Markdown
Collaborator

Superseded by #1033:按仓库约定把 #1023 与 #1002–#1008 合并为一个统一 PR(冲突已在 #1033 内解决,CI 在 #1033 上跑)。

@Thatgfsj Thatgfsj closed this Nov 20, 2026
Nicholas023 added a commit that referenced this pull request Nov 20, 2026
chore(release): consolidate the OPS-PTC 18-card release with #1002–#1008 (#1000)
@Thatgfsj
Thatgfsj deleted the fix/guidance-integration branch November 20, 2026 15:46
WeiLinCool pushed a commit to WeiLinCool/dsh-ops that referenced this pull request Nov 20, 2026
-T-Auto#1008

Merge release/ops-ptc-18-cards on top of the seven fix branches and reconcile
the surfaces both sides rewrote:

- docs/CHANGELOG.md: union of both sides' Unreleased entries (no duplicates).
- src/publication/ptc.ts: keep the release's surface-aware teaching renderer and
  four-verdict refusal, port T-Auto#1008's T-Auto#929 ephemeral lesson channel and T-Auto#968's
  deferred loader pointer into it, and drop the P7 step-tail provider plus the
  compaction re-anchor that depended on logged history (superseded by the
  ephemeral channel; see T-Auto#929/T-Auto#998).
- src/publication/replacements.ts: keep both the T-Auto#962 per-agent fail-open latch
  and the release's hidden-name system-prompt retirement.
- src/publication/registrar.ts, src/consumer/mount.ts: union of the deferred
  advisor loop, the revoked verdict and the PTC keepOfficial handoff.
- tests: adapt the tier enumerations, the cost ledger and the teaching
  assertions to the merged surface (the T-Auto#753 ops_status diagnostics row and the
  ephemeral lesson channel), keeping one assertion per unchanged behaviour.
- docs: point the batching-guidance descriptions at the ephemeral inbox.

Refs T-Auto#1000, T-Auto#1032.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment