Skip to content

fix(cli): decode daemon replies as streaming UTF-8 - #3463

Closed
harjothkhara wants to merge 1 commit into
browserbase:mainfrom
harjothkhara:codex/stagehand-3462-2026-11-15
Closed

harjothkhara wants to merge 1 commit into
browserbase:mainfrom
harjothkhara:codex/stagehand-3462-2026-11-15

Conversation

@harjothkhara

@harjothkhara harjothkhara commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

why

Fixes #3462. The browse CLI prints � instead of non-ASCII page text when a large daemon reply arrives in several socket chunks and a chunk boundary falls inside a multi-byte character. The client decoded each chunk on its own with chunk.toString().

what changed

  • packages/cli/src/lib/driver/daemon/client.ts: call socket.setEncoding("utf8") so Node decodes across chunk boundaries, and append the string chunk.
  • New test packages/cli/tests/daemon-client-decoding.test.ts: a real unix-socket fake daemon writes one reply split inside the 3-byte 日.
  • Changeset: browse patch.

test plan

  • New test fails on main ('���本語 ✓' instead of '日本語 ✓') and passes with the fix.
  • packages/cli: format check, oxlint, typecheck, and the full vitest suite after pnpm build (582 tests) pass.
  • Repo-wide just check / just test not run; checks above are scoped to packages/cli.

🤖 Generated with Claude Code


Summary by cubic

Fixes #3462: the browse CLI printed � instead of non-ASCII page text when a large daemon reply arrived across socket chunks and a chunk boundary fell inside a multi-byte character. The daemon client now calls socket.setEncoding("utf8") so Node decodes across chunk boundaries instead of decoding each chunk separately.

  • Adds a test with a real unix-socket fake daemon that splits a reply inside the 3-byte 日.
  • Adds a browse patch changeset.

Written for commit 25129a9. Summary will update on new commits.

View guided diff

The daemon client called chunk.toString() per socket chunk, so a multi-byte
character split across chunks became U+FFFD. Use socket.setEncoding("utf8").

Fixes browserbase#3462

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@changeset-bot

changeset-bot Bot commented Nov 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 25129a9

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

This PR includes changesets to release 1 package
Name Type
browse 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

@harjothkhara
harjothkhara marked this pull request as ready for review November 15, 2026 09:11
@github-actions

Copy link
Copy Markdown
Contributor

This PR is from an external contributor and must be approved by a stagehand team member with write access before CI can run.
Approving the latest commit mirrors it into an internal PR owned by the approver.
If new commits are pushed later, the internal PR stays open but is marked stale until someone approves the latest external commit and refreshes it.

@github-actions github-actions Bot added external-contributor Tracks PRs mirrored from external contributor forks. external-contributor:awaiting-approval Waiting for a stagehand team member to approve the latest external commit. labels Nov 15, 2026

Copy link
Copy Markdown
Collaborator

thanks for the fix! merging this in soon

@github-actions github-actions Bot added external-contributor:mirrored An internal mirrored PR currently exists for this external contributor PR. and removed external-contributor:awaiting-approval Waiting for a stagehand team member to approve the latest external commit. labels Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This PR was approved by @shrey150 and mirrored to #3473. All further discussion should happen on that PR.

@github-actions github-actions Bot closed this Nov 17, 2026
shrey150 pushed a commit that referenced this pull request Nov 17, 2026
…3473)

Mirrored from external contributor PR #3463 after approval by @shrey150.

Original author: @harjothkhara
Original PR: #3463
Approved source head SHA: `25129a98aef616b9faf9b2b5a20abf2ec74b11fb`

@harjothkhara, please continue any follow-up discussion on this mirrored
PR. When the external PR gets new commits, this same internal PR will be
marked stale until the latest external commit is approved and refreshed
here.

## Original description
# why

Fixes #3462. The browse CLI prints `�` instead of non-ASCII page text
when a large daemon reply arrives in several socket chunks and a chunk
boundary falls inside a multi-byte character. The client decoded each
chunk on its own with `chunk.toString()`.

# what changed

- `packages/cli/src/lib/driver/daemon/client.ts`: call
`socket.setEncoding("utf8")` so Node decodes across chunk boundaries,
and append the string chunk.
- New test `packages/cli/tests/daemon-client-decoding.test.ts`: a real
unix-socket fake daemon writes one reply split inside the 3-byte `日`.
- Changeset: `browse` patch.

# test plan

- New test fails on `main` (`'���本語 ✓'` instead of `'日本語 ✓'`) and passes
with the fix.
- `packages/cli`: format check, oxlint, typecheck, and the full vitest
suite after `pnpm build` (582 tests) pass.
- Repo-wide `just check` / `just test` not run; checks above are scoped
to `packages/cli`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes #3462: the browse CLI printed `�` instead of non-ASCII page text
when a large daemon reply arrived across socket chunks and a chunk
boundary fell inside a multi-byte character. The daemon client now calls
`socket.setEncoding("utf8")` so Node decodes across chunk boundaries
instead of decoding each chunk separately.

- Adds a test with a real unix-socket fake daemon that splits a reply
inside the 3-byte `日`.
- Adds a `browse` patch changeset.

<sup>Written for commit 25129a9.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/browserbase/stagehand/pull/3463?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->

<!-- external-contributor-pr:owned source-pr=3463
source-sha=25129a98aef616b9faf9b2b5a20abf2ec74b11fb claimer=shrey150 -->

Co-authored-by: harjoth <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@github-actions github-actions Bot added external-contributor:completed The mirrored PR has been merged and the external contributor flow is complete. and removed external-contributor:mirrored An internal mirrored PR currently exists for this external contributor PR. labels Nov 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

The mirrored PR #3473 has been merged into main. This original external contributor PR will stay closed as completed.

shrey150 added a commit that referenced this pull request Nov 20, 2026
…3496)

Changesets merged through a mirrored external contributor PR currently
show `Thanks @github-actions!` in release notes, because the mirror PR
is authored by the bot.

This wraps `@changesets/changelog-github` in `.changeset/changelog.cjs`.
For each changeset, if its commit came from a merged PR authored by
`github-actions[bot]` that carries the `external-contributor-pr:owned
source-pr=` marker, it adds `pr:`, `commit:` and `author:` overrides
pointing at the original PR and its author (read from the GitHub API,
not from the PR body text). Changesets that already have overrides, and
every non-mirrored PR, are left unchanged.

Checked locally against the three pending mirrored changesets (#3463,
#3422, #3465 now credit their authors) and a regular PR (#3450 is
unchanged).

If a GitHub lookup fails, the wrapper logs a warning and falls back to
the default credit, so it can't block a release PR.

Dry run (Nov 19) against the live repo with
`@changesets/changelog-github` 0.7.0: `empty-response-header-values` now
credits #3422 / @aryansahai22, `host-only-cookie-matching` credits #3465
/ @Kelvin-Waititu, a regular changeset (`eve-1-0-upgrade`, #3409) is
unchanged, and a simulated API failure falls back to the default line.

No tests added: the failure mode is attribution in release notes, not
publishing, and the release PR diff shows the output before anything
ships.

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Fixes release notes so changesets merged through mirrored external
contributor PRs credit the original author instead of
`github-actions[bot]`.

- Wraps `@changesets/changelog-github` in `.changeset/changelog.cjs` to
detect mirrored PRs via the `external-contributor-pr:owned` marker and
add `pr:`, `commit:`, and `author:` overrides from the GitHub API.
- Takes the last marker occurrence, since the mirror body quotes the
original PR description before the trusted marker.
- Leaves changesets that already have overrides and non-mirrored PRs
unchanged, and falls back to the default credit when the GitHub lookup
fails so a release can't be blocked.

<sup>Written for commit 72b02d0.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/browserbase/stagehand/pull/3496?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/browserbase/stagehand/3496?returnTo=https%3A%2F%2Fgithub.com%2Fbrowserbase%2Fstagehand%2Fpull%2F3496&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->

---------

Co-authored-by: Shrey Pandya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external-contributor:completed The mirrored PR has been merged and the external contributor flow is complete. external-contributor Tracks PRs mirrored from external contributor forks.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Browse CLI returns U+FFFD instead of the real text when a daemon reply splits a multibyte character

2 participants