Repository navigation
Conversation
…e operation Recognise tools.wait_agent (dot or bracket) at a real dispatch site as a wait, and require exactly one dispatch site before the shape notice claims a single operation. Plan and bypass checks and latch behaviour are unchanged. Fixes T-Auto#893.
|
Thanks — the batching half of this PR is sound, and I verified it independently: both The profile-repair half blocks merge: it is a small YAML editor rather than one narrowly-scoped deletion, and several shapes are handled wrongly or silently. I extracted 1. A row is deleted, and it takes the following comment with it. - id: other
config:
a: 1
- id: agent-preset-registry
config:
selectedDefault: ops-ptc
# keep: third row is legacy
- id: third
config:
b: 2Removes indexes 3,4,5,6: the registry row and 2. One extra level under - id: agent-preset-registry
config:
nested:
selectedDefault: ops-ptcRemoves the 3. A different scalar is treated as the leftover. 4. A BOM is silently clean. 5. Two registry rows: only the first is repaired, where the host's own editor would clean every matching row. Also worth fixing:
A simpler shape that would pass review: delete only the Two asks: could you split this PR, so the batching half (#893) can merge on its own while the profile half (#881) gets the rework above? If you would rather keep it together, the YAML half needs those fixes first. If you would prefer to focus on #881, say so and we can take #893 as a separate PR. |
Closes #881
Closes #893
What was wrong
Dangling
selectedDefault: ops-ptcafter disabling or uninstallingdsh-ops([BUG] 卸载后会有配置残留导致Dsh歇逼 #881):desktop,web,dsh-tui) where@deepseek-ai/dsh-hmris active, disabling or removingdsh-opsruns insidehmr.runExclusive(executinginAsyncLocalStorageistrue). When thedsh-opsfiber disposal calledsettings.update('agent-preset-registry', { selectedDefault }),ConfigEditor.editinvokedhmr.runExclusiveagain, which immediately rejected withError: HMR transactions cannot be nested.PluginManager.removeBundle('dsh-ops'),<profile.dir>/package.json.lockis held across twohmr.runExclusivephases whileConfigEditor.editacquireshmr.runExclusivebeforepackage.json.lock, causing lock contention/timeout if the restore entershmr.runExclusivebefore the outer lock clears.dsh-ops uninstall --profile <desktop|web|tui>delegates todsh plugin remove dsh-opswhile the host is not running, so runtime teardown never executes andselectedDefault: ops-ptcremains in<profile.dir>/cordis.patch.yml, causing every new session to fail withUnknown agent preset: ops-ptc.False-positive
single operationshape reminder onwait_agentand dependent multi-dispatch programs ([BUG] batching shape 将 wait_agent 等待及有依赖的多次派发误判为 single operation #893):WAITINGinsrc/ptc/batching-guidance.tsdid not recognizetools.wait_agent(...)/tools["wait_agent"](...), andviolationsOf(shape)did not excludeshape.isWaitingfrom theshapeviolation.violationsOf(shape)triggered onshape.dispatchSites >= 1whenever a short program had no loop/Promise.all/branching, misclassifying sequential multi-dispatch scripts (such as agrepwhose result determines the nextread_file) as"The program ran a single operation".The change
src/presets/ops-ptc/register.ts:AsyncLocalStoragetransaction (hmr.executing.exit) and wait for bothhmr.operationsand<profile.dir>/package.json.lockto settle before persisting default preset changes inforceDefaultandrestoreDefault.ops-ptcalready saved still restore the operator's prior default or the registry's officialdefault.src/profile-default-repair.ts&src/profile-install.ts:findDanglingDefaultandrepairDanglingDefaultto remove a leftoverselectedDefault: ops-ptcon theagent-preset-registryentry of<profile.dir>/cordis.patch.yml(preserving sibling keys/entries and leaving[]when the removed item was the only entry), and invokerepairDanglingDefaultafterdsh-ops uninstallsucceeds.src/ptc/batching-guidance.ts:wait_agentonly at realtools.*/tools["..."]dispatch sites (WAITING_TOOL = /^wait_agent$/u), ignoring comments and string literals.shapeviolation condition inviolationsOf(shape)toshape.dispatchSites === 1 && !shape.hasBatchingStructure && !shape.hasBranching && !shape.isWaiting && shape.chars < THIN_CODE_CHARS.test/preset-registration.test.mjs,test/profile-temp.test.mjs, andtest/batching-trigger.test.mjs, plus bilingual entries under## [Unreleased]indocs/CHANGELOG.md.Validation
pull_request-triggeredCI requiredrun, URL belownpm run build,npm run typecheck,npm run check:size, andnpm run validate:manifestpasspreset-registration,profile-temp,batching-trigger)docs/CHANGELOG.md## [Unreleased]entry added (English and Chinese)package.jsonversion, oroptionalDependencieschange; no model-facing schema/prompt changeRevert-red verification:
Environment
Linux x64, Node v22.22.1, based on upstream
maincommite724444, local source checkout.