Repository navigation
fix(ptc): file batching guidance under its producer source - #1041
Merged
Merged
Conversation
The pre-step batch delivered the lesson and every corrective notice with
`source: { kind: 'user' }`, so Chat drew them as user bubbles and a session
looked like the user had typed dozens of English instructions nobody wrote
(T-Auto#1040).
Deliver them under the plugin's own source kind instead. Each message keeps
`role: 'user'` and carries no plugin envelope, so the model still reads it as
the instruction that governs the task; the client files an unknown kind under
its producer and draws no user bubble.
Pinned by the prompt-user-teaching, resident-switch and ptc-cost-accounts
suites; the bilingual docs and CHANGELOG describe the new source.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1040
What was wrong
agent/pre-stepdelivered the batching lesson and everybypass/plan/shapenotice withsource: { kind: 'user' }. Chat draws a bubble exactly when that kind isuser, so a session showeddozens of English "user" messages the human never typed — indistinguishable from real input, and from
the user's authorization.
That source was deliberate (the text must read as the instruction that governs the task, not a tool
result the model can skip), so the fix has to keep the model-facing weight and change only how the
client files the message.
The change
src/publication/ptc.ts: deliver the batch assource: { kind: 'dsh-ops:batching-guidance', contributor, revision, turn, step }instead of{ kind: 'user' }.rolestaysuserand no plugin envelope is added, so the model still readsit as the governing instruction; the client files an unknown kind under its producer.
src/ptc/batching-guidance.ts: exportBATCHING_GUIDANCE_SOURCE_KINDand declare the producer kindon the host's merge-extensible
MessageSourceMap(the host documents unknown user-message kinds asfalling through to their producer).
prompt-user-teaching,resident-switchandptc-cost-accountsassert the new kind and theunchanged
role: 'user'and envelope-free body.source kind user.Deliberately not done: adding back the
[Plugin context … not a user instruction]envelopesuggested in #1040. That prefix is exactly what the current design removes on purpose; adding it back
would lower the model's weight on the text the lesson exists to deliver. The delivery also still enters
logged history —
agent-loopappends every non-runtime-contextpre-step message asuser/message—so this change fixes the presentation and the source attribution, not the fact that the injection is
logged.
Validation
Host: win32-x64, Node v24.21.0.
Target suites inside that run:
Real-host check (isolated
DSH_HOME, web UI,OPS (PTC)preset, one real task): the only user bubbleis the task the human typed; the guidance renders as a collapsed
上下文注入 · dsh-ops:batching-guidancerow beside
runtime-contextandskill-catalog, and the session log carries twosource.kind: 'dsh-ops:batching-guidance'messages withrole: 'user'and no envelope. The model stillacted on them (it earned a
shapenotice).pull_request事件触发的CI requiredrun,且已把该 run 的 URL 贴到下方代码块node scripts/verify-gate.mjs --skip-install的实际输出(见上)Revert check: setting
kindback to'user'and rebuilding failsprompt-user-teachingwith2 of 3 check(s) failed(the guidance filter and the source assertion), then passes again oncerestored — the assertions are behavioural, not structural.