fix: register fallbacks/switch session event type at startup (issue #52) - #53
Merged
Merged
Conversation
Sessions containing a fallbacks/switch event refused to load after a dsh restart: the persistence read path (assertEventsSupported) only accepts types in the host's baked KNOWN_SESSION_EVENT_TYPES catalog or events marked ignorable, and Session.append cannot write ignorable. Register the type into the root-exported catalog from apply() (lazy session loads always follow composition start), and guard the commit() append: when registration is unavailable, skip the durable event with a rate-limited warn instead of writing one the read path would refuse. Stopgap until the upstream registration surface lands (UPSTREAM-ISSUE.md).
…#52) Pin 1/2: the root-exported KNOWN_SESSION_EVENT_TYPES is a mutable Set that accepts fallbacks/switch (the exact assertEventsSupported predicate), and an appended switch event carries no ignorable marker, so the mirrored refusal condition is true pre-registration and false post-registration. Pin 3: with the dsh-session catalog export unavailable (vi.mock), commit() skips the durable event, does not throw, keeps the switch bookkeeping, and warns exactly once per apply.
…t (issue #52) The events only load across a restart while the plugin registers their type at startup (rc.6 runtime registration stopgap; upstream registration surface pending) — uninstalling the plugin makes affected sessions refuse to load again until the upstream surface lands. Corrected README.md + README.zh-CN.md (Verify + Features), docs/install.md uninstall claim, docs/consumer-api.md cross-plugin advice, docs/verification.md matrix note (the reload gap that shipped #52), and the two knowledge docs; added the Fixed changelog fragment.
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.
What
Fixes #52 — sessions containing a
fallbacks/switchevent refuse to load after a dsh restart (SessionFormatUnsupportedError: ... unknown to this harness and not marked ignorable).Root cause: the plugin appends a custom session event type (
src/index.tsagent.session.append('fallbacks/switch', …)) that is only TS-augmented (src/events.tsdeclare module), never registered at runtime. dsh's persistence read path (assertEventsSupported) hard-refuses types outside the build-timeKNOWN_SESSION_EVENT_TYPESunless the envelope carriesignorable: true— whichSession.appendcannot write. Out-of-repo plugins have no official registration surface yet (tracked:.mstar/plans/llm-fallbacks-session-event-format/UPSTREAM-ISSUE.md).Change (user-approved B1 stopgap)
src/index.ts: inapply(), registerfallbacks/switchinto the ROOT-exportedKNOWN_SESSION_EVENT_TYPESSet (namespace import from package root — not the./typessubpath copy; idempotent, no module-level side effects; apply-time registration precedes all lazy session loads, so already-persisted logs heal retroactively).commit()gains an append guard: if registration is unavailable, the durable event is skipped (rate-limited warn) — a session log is never written with an unregistered type.tests/session-event-registration.spec.ts(pins the root Set mutability + the exact read-path predicate pre/post registration + idempotency) andtests/session-event-registration-guard.spec.ts(registration-unavailable path: decision intact, no event, no throw, one warn)..changes/unreleased/session-event-registration.mdfragment.@deepseek-ai/dsh-sessiondeclared (now a runtime value import).Verification
pnpm test: 600/600 (incl. peer-deps contract test)pnpm typecheck+pnpm build: cleanNote
Stopgap until the upstream runtime registration surface lands (issue draft kept at
.mstar/plans/llm-fallbacks-session-event-format/UPSTREAM-ISSUE.md); the same event type then switches to the official register call with zero surface changes.