Skip to content

[Bug] 0.4.0 client reads uiSession.sessionStatus without injecting it, so the bot surface never mounts #2383

Backlog

Description

@leaderlemon

What happened?

After upgrading ds-bot 0.3.10 → 0.4.0 the plugin page shows

ds-bot: Error: cannot get property "uiSession.sessionStatus" without inject

and the bot surface never mounts — the host wraps it as
Bot mode could not be set up here: cannot get property "uiSession.sessionStatus" without inject.

Cause (confirmed in the published 0.4.0 package)

src/client/index.js:91 declares six services:

export const inject = ['sessions', 'uiWorkspace', 'uiConversation', 'slots', 'theme', 'layout']

Two ctx.effect bodies read uiSession.sessionStatus eagerly — i.e. while the surface is being installed, not later on a user action:

  • src/client/index.js:1281 — 'ds-bot: rescue interrupted question drafts'
  • src/client/index.js:1772 — 'ds-bot: sidebar completions'
const sessionStatus = ctx.get('uiSession')?.sessionStatus

uiSession.sessionStatus is its own namespace service (the host documents the
uiSession.sessionStatus service as being read as ctx.uiSession.sessionStatus);
the uiSession object itself carries no such property. Cordis validates a nested
service property read against the plugin's inject list using the dotted name,
so the read throws, both effects fail, and the whole surface aborts.

?. does not guard this: the throw comes from the service getter, not from a null
object — the same mechanics as #2055, on a different service.

Why this is a missed declaration, not a host change

  • 0.3.10's client bundle never mentions uiSession (0 occurrences), so this read
    arrived with 0.4.0.
  • Both services exist in the current host build: four bundled official plugins list
    them in their own inject, and two of those list only the dotted
    uiSession.sessionStatus — so the service is provided and is declarable alone.

Suggested fix

export const inject = ['sessions', 'uiWorkspace', 'uiConversation', 'slots', 'theme', 'layout', 'uiSession', 'uiSession.sessionStatus']

The rebuilt client.js carries the same array and needs the same edit (source and
bundle must agree). Declaring both names matches the host's own approval plugin
(['sessions','remote','uiSession','slots','locale']); two bundled plugins declare
only the dotted name, so either form works here.

Also worth a look (latent, not failing today)

The same client reads other nested services from arrow functions, so they only
throw once a user triggers that path — connection.state (~client.js:65727),
shortcuts.catalog (~65732), sidebarRight.openTab / sidebarRightTabs (~76069).
Declaring those too would avoid a second round of the same class of report.

Steps to reproduce

  1. Install ds-bot 0.4.0 on a host that ships uiSession.
  2. Open the plugin page (or any route that mounts the bot surface).
  3. The error above appears and bot mode does not start.

Diagnostics

  • ds-bot 0.4.0 (npm ds-bot@0.4.0), DSH desktop 0.2.3-alpha.2, macOS arm64.
  • Adding 'uiSession', 'uiSession.sessionStatus' to both artifacts locally makes
    the surface install again; validation in progress.

Activity

  1. leaderlemon commented on Nov 27, 2026

    @leaderlemon
    Author

    Confirmed still present in 0.4.1 (the v0.4.0 hotfix): src/client/index.js:91 still declares the same six services, both ctx.get('uiSession')?.sessionStatus reads are still where they were (:1281, :1772), and the rebuilt client.js carries the identical array. Adding uiSession + uiSession.sessionStatus to both artifacts still makes the bot surface install, so the workaround remains valid on 0.4.1.

    The 0.4.1 notes (activity row, bot private chat tool cards, mailbox toggle) don't touch the client's inject list, so this is expected — just noting it so the fix isn't assumed shipped.

  2. leaderlemon commented on Nov 27, 2026

    @leaderlemon
    Author

    Thanks — #2403 is the right generalisation of what I could only band-aid locally, and the reasoning about 0.2.2-rc.5 is a real trap I had missed.

    What I can add from the reporter side, stated precisely:

    • The host I hit this on is DSH 0.2.3-alpha.2, which does provide uiSession.sessionStatus as its own dotted service. On that host, adding uiSession and uiSession.sessionStatus to the top-level inject array (source + rebuilt client.js) made the bot surface mount again — same restart, no other change, and the sidebar completion path that reads the status source came back too. So the dotted declaration alone is enough where the dotted service exists; your 0.2.2-rc.5 note is exactly why it must not be the only shape.
    • I have not run your unreleased dev build against that host, so I am not claiming fix(client): fix uiSession.sessionStatus inject crash and add DSH plugin-host smoke test #2403 is runtime-verified on 0.2.3-alpha.2 — the static read of host-service.js (child ctx.inject(['uiSession.sessionStatus'], …) fiber + plain-property fallback) looks right for both layouts, and that is as far as my evidence goes.
    • Side observation while checking dev: the other nested service reads in the client (connection.state, shortcuts.catalog, sidebarRight.openTab) already go through readServiceMember / callServiceMethod, so there is no second instance of this class left that I could find.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions