Repository navigation
fix: resolve planMode from the agent's preset isolate - #2
Closed
sujalmandal wants to merge 1 commit into
Closed
sujalmandal wants to merge 1 commit into
sujalmandal wants to merge 1 commit into
Conversation
`resolvePlanMode` only looked at `agent.ctx.get('planMode')` and the
profile-root `ctx.get('planMode')`. On `dsh web` both miss: the
model-facing plan-mode service is published per preset inside a group
carrying `isolate: {planMode: true}`, while the host-plane row is
disabled. The intercept therefore never fired and the native
plan-review card always ran.
The `agent.session?.events` fallback that used to carry the check is
also gone: `@deepseek-ai/dsh-session` removed `get events()` in
0.1.2-rc.1 and replaced it with `snapshotEvents()`. Because the read
was optional-chained, it degraded to `[]` and disabled the plugin
silently instead of throwing.
- read the preset-scoped service through
`ctx.get('agentPresets').serviceFor(agent, 'planMode')`, the public
registry accessor, ahead of the two context lookups
- read the session log through `snapshotEvents()` and keep accepting
the old `session.events` shape for pre-0.1.2-rc.1 hosts
- update `tests/plan.test.js`, which still mocked the removed
`session.events` property and so kept CI green over the regression
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.
Summary
dsh-plannotatornever interceptsexit_plan_modeondsh web, so the native plan-review card always runs and the plannotator UI is never reached. Two independent reads inlib/plan.jsare both dead on current DSH; this fixes both.1.
resolvePlanModecannot see the service ondsh webBoth lookups miss. Plan mode is published per preset, inside a group carrying
isolate: {planMode: true}(upstream-standard, present since the earliest DSH releases —@deepseek-ai/dsh-web-app/presets/{standard,ptc,cordis}.patch.yml:42-48), which keys the service under a private realm symbol. The host-planeplan-moderow isdisabled: true(dsh-web-app/cordis.patch.yml), so the profile-root lookup returns nothing either. This is not a custom-setup problem — a stockdsh webprofile behaves the same way.Resolve it through the registry accessor instead, which is a public Service method and is registered at profile root:
2. The
session.eventsfallback no longer existsisPlanModeActivereadagent.session?.events ?? [].@deepseek-ai/dsh-sessionhadat
lib/index.js:1397-1400through0.1.2-alpha.2, and removed it in0.1.2-rc.1(2026-09-03), replacing it withsnapshotEvents(). Because the access is optional-chained, the removal did not throw — it degraded to[],isPlanModeActivereturnedfalse, and the intercept was skipped silently. 0.2.0 shipped 2026-08-18, so this rotted ~2 weeks after release.Read
snapshotEvents()and keep accepting the oldsession.eventsshape so pre-0.1.2-rc.1 hosts still work.3. The test suite hid the regression
tests/plan.test.jsmockedsession: { events: [...] }— the shape that had already been deleted. The suite stayed green while production was broken. Updated tosnapshotEvents().The
resolvePlanModeprecedence test also predates the isolate: it asserts "agent context, thenctx.get", which ondsh webare exactly the two paths that miss. New precedence is preset isolate → agent context → profile root.Testing
node --test— 53 pass, 0 fail (node v24.21.0).Direct probe of the fixed module against the three shapes:
agentPresets.serviceFor(agent, 'planMode')presentsession.snapshotEvents()onlyisPlanModeActive→truesession.eventsonlyisPlanModeActive→truefalse, no throwagentPresetsserviceundefined, no throwNotes
Kept as one commit / one concern. Separately, issue #1 (feedback injection rejected because
source.kindis'plugin') is unrelated to this path and unfixed here — the V4 validator requires a producer-owned kind, sokind: 'plugin:plannotator'is the correct shape perdsh-session-format-v3-to-v4/lib/index.js:87-107.