ui-sdk: the turnId doc comment tells client authors echoing is optional, which a rev 3 host refuses

Open Beginner friendly
#4,824 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
86/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
api, documentation

Research direction

Read the SessionScoped.turnId comment in packages/ui-sdk/src/protocol.ts alongside the rev 3 rule in docs/integration-contract/wire.md. Update the comment to name PROTOCOL_REV_CLIENT_ECHO and state the same echo requirements, then move the resolver comment in packages/ui-sdk/src/server/worker-launcher.ts directly above the /etc/resolv.conf bind. Done when both edits change comments only and the acceptance criteria are met.

Written by the indexing model from the issue text.

Description

agent-ready area: ui-sdk priority: p3 type: docs

Context

Two comments in packages/ui-sdk/src describe behaviour the code no longer has.

SessionScoped.turnId (packages/ui-sdk/src/protocol.ts:48-55). The doc comment says clients "MAY echo it on interactive replies" and that the field is "RESERVED for now: servers stamp it, but no shipped client echoes it back yet — hosts must not require it." Twenty lines further down, the same file states the opposite for protocol revision 3: "A client declaring 3 is REQUIRED to echo" (protocol.ts:62-70). The shipped client echoes it (withTurnId, packages/ui-sdk/src/client/ws-client.ts:385), and the host requires it from a rev 3 client (requireEcho, packages/ui-server/src/ws/dispatch.ts:42). docs/integration-contract/wire.md:290-291 records the rev 3 rule. The comment is on a published contract type, so it is what a third-party client author reads in their editor.

Resolver comment in maintenanceMounts (packages/ui-sdk/src/server/worker-launcher.ts:499-502). A four-line comment about keeping resolv.conf readable sits above the provider-relay block (:503-507). The code it describes is five lines further down (:508-512).

Scope

  • Rewrite the turnId doc comment to state the current rule: hosts stamp it on every scoped frame; a client that declares protocol revision 3 or later echoes it on every interactive reply and a host may refuse a reply without it; a client that declares nothing is treated as revision 2 and is not required to echo.
  • Move the resolver comment down so it immediately precedes the if (envelope.network) block it describes. Do not reword it.

Out of scope

  • Any change to PROTOCOL_REV, the echo rule, withTurnId or requireEcho.
  • Other comments in either file.
  • Restructuring worker-launcher.ts (STRUCT-12 and the later slices in the epic).
  • docs/integration-contract/wire.md: it already states the rule. If the rewritten comment and the doc disagree on a detail, the doc is right.

Acceptance criteria

  • git grep -n "RESERVED for now" -- packages/ui-sdk/src returns nothing.
  • The turnId comment and docs/integration-contract/wire.md ("rev 3") state the same echo rule, and the comment names PROTOCOL_REV_CLIENT_ECHO.
  • In worker-launcher.ts, the resolver comment is the comment directly above the /etc/resolv.conf bind, and no comment sits between the envelope.readPaths loop and the provider-relay block that does not describe that block.
  • git diff shows comment lines only: no code token changes in either file.
  • api-report/ui-sdk.txt is byte-identical (it does not record doc comments).

Verification

git grep -n "RESERVED for now" -- packages/ui-sdk/src
git diff --stat
bun run lint
NODE_OPTIONS=--max-old-space-size=6144 bun run typecheck
bun run api-report
bun run check:pr --base origin/main

Contract impact

  • This touches the integration contract, so it needs the contract label, a CONTRACT: commit prefix, and the doc updated in the same commit.
  • This changes a published package's behaviour, so it needs a changeset.

Comments only. The comment documents a contract type but changes neither the type nor the rule, which docs/integration-contract/wire.md already records.

Found by a repository audit on 2026-11-26 (main 87b96b10c); independently reviewed before filing.

Dominant language
TypeScript
Stars
5
Forks
0
Avg merge
8h 3m
Merged PRs (30d)
606

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from schlessera/brain-kit

All issues in schlessera/brain-kit

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.