fix(runtime): cordis 4.0.1 service reads + session-safe injected messages - #1
Open
dracpet wants to merge 1 commit into
Open
fix(runtime): cordis 4.0.1 service reads + session-safe injected messages#1dracpet wants to merge 1 commit into
dracpet wants to merge 1 commit into
Conversation
…ages
Two host-contract repairs, both live-diagnosed on DSH desktop 4.0.1
(2026-08-21):
1. Session persistence corruption: messages pushed into decision.messages
in the bare wire shape { type: 'user', text } are persisted verbatim,
and rc.8's session loader rejects id-less user/message events on resume
(SessionPersistenceCorruptionError: "session event at seq N lacks an
identified message"). Add util.pkUserMessage() emitting the hybrid
wire+canonical shape (type/text + id/role/content/source) and use it at
all injection points (slash-command replies, custom-command expansion,
context pack, agent.steer).
2. cordis 4.0.1 context proxy: raw ctx / this.host property reads throw
"cannot get property without inject". Route the remaining reads through
the existing hostService() helper (ctx.reflect.get): /pk doctor
hostCapabilities, the native agentPresets bridge (now actually binds
instead of silently degrading), steerAgent, cancelAgent.
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.
Problem
Two host-contract breaks on DSH desktop 4.0.1 / rc.8, both live-diagnosed on 2026-08-21:
1. Session persistence corruption from injected messages
Messages that powerkit pushes into
decision.messagesuse the bare wire shape{ type: 'user', text }. They are persisted verbatim, and the session loader rejects id-less user/message events on resume:Any session where powerkit injected a slash-command reply, a custom-command expansion, or a context pack became unresumable.
Fix: new
util.pkUserMessage(text)emits the hybrid wire+canonical shape —type/textfor existing wire consumers, plusid/role/content/sourceso the loader's canonical-message validation passes. All injection points now use it (slash-command replies, custom-command expansion, context pack,agent.steer).2. cordis 4.0.1 context proxy rejects raw service reads
ctx.agentPresets,ctx.agents,this.host?.agents,caps.toolsthrowcannot get property without injecton cordis 4.0.1's context proxy. Consequences:/pk doctorshowed tools/agents as missing (they exist);agentPresetsbridge silently degraded to the catch-and-continue path even though the host provides the service;steerAgent/cancelAgentcould never reach a real agent.Fix: route those reads through the existing
hostService()helper (ctx.reflect.get), the same patterntryRegisterToolsalready uses and documents.Verification
tsc -p tsconfig.json --noEmitclean;tsdownbuild clean./pk doctorresolves tools/agents again, previously corrupted sessions resume, and injected messages validate on save.npm testcurrently requires Node ≤ 24 (--experimental-transform-typeswas removed in newer Node); tests were not runnable under Node 26 in this environment — typecheck + build + production soak used instead.Scope note
This PR is intentionally limited to the two functional repairs. (A local English-UI translation of the panel exists in the same deployment but is a preference, not a bug fix — happy to upstream it separately as opt-in i18n if you want it.)