Skip to content

Buffer TS SDK logger output until the log socket connects#70085

Merged
jason810496 merged 2 commits into
apache:mainfrom
guan404ming:ts-log-preconnect-buffer
Jul 23, 2026
Merged

Buffer TS SDK logger output until the log socket connects#70085
jason810496 merged 2 commits into
apache:mainfrom
guan404ming:ts-log-preconnect-buffer

Conversation

@guan404ming

Copy link
Copy Markdown
Member

Related

closes: #70077
related: #69302 (stacked on its branch; only the last commit is new)

Why

Log records emitted between subprocess start and the log socket connecting were silently dropped; the Go and Java SDKs already keep these early records.

How

  • Let LogChannel start unconnected and buffer records until connect() flushes them to the socket in order
  • Dump buffered records to stderr on close() if the socket never connected
  • Create the runtime's logger before connecting so pre-connect records are kept

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Fable 5)

@guan404ming
guan404ming force-pushed the ts-log-preconnect-buffer branch from 76a0b65 to ded4dd3 Compare July 19, 2026 07:33
@guan404ming
guan404ming marked this pull request as ready for review July 19, 2026 07:41
@jason810496 jason810496 moved this to In review in TS-SDK Jul 20, 2026
@jason810496 jason810496 added this to the TS SDK 1.0 Beta milestone Jul 20, 2026

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Here're some nits caught by CC. LGTM overall, thanks!

Comment thread ts-sdk/src/coordinator/log-channel.ts
Comment thread ts-sdk/src/coordinator/log-channel.ts Outdated
guan404ming and others added 2 commits July 23, 2026 20:14
Records emitted between subprocess start and the --logs socket
connecting were silently dropped; the Go and Java SDKs already buffer
this window and flush once connected.
Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
@guan404ming
guan404ming force-pushed the ts-log-preconnect-buffer branch from 6a28a82 to 5ed85dd Compare July 23, 2026 12:21
@guan404ming
guan404ming requested a review from jason810496 July 23, 2026 12:25

@jason810496 jason810496 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice! Thank you for addressing all the comments.

@jason810496
jason810496 merged commit b6cc81c into apache:main Jul 23, 2026
89 checks passed
@github-project-automation github-project-automation Bot moved this from In review to Done in TS-SDK Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

TS SDK: buffer pre-connect logger output and flush to log socket once connected

2 participants