Skip to content

feat(kap-server): broadcast global session work events#2032

Open
wbxl2000 wants to merge 19 commits into
feat/ws-global-target-transportfrom
feat/ws-global-target-events
Open

feat(kap-server): broadcast global session work events#2032
wbxl2000 wants to merge 19 commits into
feat/ws-global-target-transportfrom
feat/ws-global-target-events

Conversation

@wbxl2000

@wbxl2000 wbxl2000 commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • build on feat(kap-server): register global WS targets #2058 by activating event producers for every live session, independent of per-session subscriptions
  • broadcast session work and interaction facts so all clients keep the full session list current
  • seed current work facts in late-producer, late-connection, and reconnect arrival orders without advancing durable cursors
  • keep forked side-channel transcripts isolated from copied parent context on both live and cold paths

Verification

  • pnpm --filter @moonshot-ai/kap-server test -- --run: 53 files, 702 tests passed
  • pnpm --filter @moonshot-ai/kap-server run typecheck
  • pnpm --filter @moonshot-ai/kap-server run build
  • pnpm --filter @moonshot-ai/kimi-web test: 34 files, 646 tests passed
  • pnpm --filter @moonshot-ai/kimi-web typecheck
  • pnpm --filter @moonshot-ai/kimi-web build
  • pnpm --filter @moonshot-ai/protocol test: 28 files, 522 tests passed
  • pnpm --filter @moonshot-ai/protocol typecheck
  • pnpm --filter @moonshot-ai/protocol build
  • node-sdk tsc and CI-native tsgo typecheck
  • changed-file oxlint: 0 errors
  • live desktop validation: hello-only global updates, reconnect reconciliation, AgentDetail streaming, and isolated fast BTW completion

Dependency order

  1. Merge feat(kap-server): register global WS targets #2058, which owns the connection-level global target transport.
  2. Merge this PR, which adds the producers, state catch-up, interaction events, and fork isolation.
  3. MoonshotAI/kimi-code-app#73 consumes the combined server surface and currently points its kimi-code submodule to 32445b1.

wbxl2000 added 3 commits July 22, 2026 00:22
…to hello-only WS connections

The v1 WS global fan-out only reached connections subscribed to some
session, so a desktop client with on-demand subscriptions (LRU eviction)
lost sidebar liveness and todo notifications for every session it was not
watching. Three changes make global coverage a server guarantee:

- Connections register as global targets on client_hello, independent of
  any per-session subscription, and unregister on close; global events
  fan out to the union of global targets and session subscribers while
  per-session frames still reach subscribers only.
- The work_changed producer chain now mounts when the session scope
  materializes in the runtime (onDidCreateSession + a constructor sweep)
  instead of waiting for a subscriber, and a late-mounted producer
  re-emits the current work-fact once to global targets (volatile, never
  journaled) so hello-only connections see accumulated busy/pending
  state.
- New volatile global events event.session.interaction_requested and
  event.session.interaction_resolved (approval/question arrivals and
  resolutions with kind/agent/tool/questionPreview) ride the same
  fan-out; the legacy durable per-session approval/question events are
  unchanged.
A reset replaces the aggregate wholesale, so the pre-reset state was
never read; the parameter trips TS6133 in downstream builds that enable
noUnusedParameters.
@changeset-bot

changeset-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9319008

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@pkg-pr-new

pkg-pr-new Bot commented Jul 21, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@9319008
npx https://pkg.pr.new/@moonshot-ai/kimi-code@9319008

commit: 9319008

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 80435b771a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/kap-server/src/transport/ws/v1/wsConnectionV1.ts Outdated
Comment thread packages/kap-server/src/services/transcript/transcriptService.ts Outdated
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7cd82bdafa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/kap-server/src/transport/ws/v1/sessionEventBroadcaster.ts
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 70b3fccc81

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/kap-server/src/transport/ws/v1/sessionEventBroadcaster.ts Outdated
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ec706ccc6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/kap-server/src/protocol/events-zod.ts
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 913936175d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/protocol/src/events.ts
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2375eb843

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/kap-server/src/transport/ws/v1/sessionEventBroadcaster.ts
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4d2eec2a0c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/kap-server/src/transport/ws/v1/sessionEventBroadcaster.ts Outdated
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5c0ac4e203

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/kap-server/src/transport/ws/v1/sessionEventBroadcaster.ts Outdated
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b8a5ace82

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/kap-server/src/transport/ws/v1/wsConnectionV1.ts
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53333edb74

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/kap-server/src/transport/ws/v1/sessionEventBroadcaster.ts
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4b5d74c4f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread .changeset/global-session-work-events.md Outdated
@wbxl2000

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: feef8a5478

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

# Conflicts:
#	packages/kap-server/src/transport/ws/v1/sessionEventBroadcaster.ts
#	packages/kap-server/src/transport/ws/v1/wsConnectionV1.ts
#	packages/kap-server/test/sessionEventBroadcaster.test.ts
#	packages/kap-server/test/wsConnectionV1.test.ts
@RealKai42
RealKai42 changed the base branch from main to feat/ws-global-target July 22, 2026 10:33
@wbxl2000
wbxl2000 changed the base branch from feat/ws-global-target to feat/ws-global-target-transport July 22, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant