Skip to content

fix(byte): drop trailing && from authExport (kills byte when token set)#80

Open
dcetlin wants to merge 1 commit into
mainfrom
fix/byte-authexport-double-amp
Open

fix(byte): drop trailing && from authExport (kills byte when token set)#80
dcetlin wants to merge 1 commit into
mainfrom
fix/byte-authexport-double-amp

Conversation

@dcetlin

@dcetlin dcetlin commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Problem

startByte builds authExport as an element of the inner array that is later .join(' && ')-ed:

const inner = [
  `cd ${shq(byteCwd)}`,
  ...
  authExport || null,          // = `export CLAUDE_CODE_OAUTH_TOKEN="$(cat ...)" &&`
  `caffeinate -i claude ...`,
].filter(Boolean).join(' && ')

Both authExport assignments appended their own trailing &&, so the joined command emitted:

... && export CLAUDE_CODE_OAUTH_TOKEN="$(cat ...)" && && caffeinate ...

The && && is a shell syntax error — the byte tmux session dies almost immediately.

It only fires when CLAUDE_CODE_OAUTH_TOKEN is set (or the slack angellist-token path), which is why token-less deployments never hit it. Surfaced during an external-machine bring-up.

Fix

Remove the trailing && from both assignments; the array join(' && ') already supplies the separator.

Verification

  • bun build cli/hydra.ts compiles.
  • Generated inner command with a token set contains no && &&.
  • Default (token-less) path is byte-for-byte unchanged.

🤖 Generated with Claude Code

@dcetlin dcetlin force-pushed the fix/byte-authexport-double-amp branch from 210dcab to e14144d Compare July 4, 2026 17:41
startByte builds `authExport` as an element of the `inner` array that is
later `.join(' && ')`-ed. Both assignments appended their own trailing
`&&`, so the joined command emitted `... && export ...="$(cat ...)" && &&
caffeinate ...`. The `&& &&` is a shell syntax error and the byte tmux
session dies almost immediately.

It only fires when CLAUDE_CODE_OAUTH_TOKEN is set (or the slack angellist
token path), which is why token-less deployments never hit it.

Fix: remove the trailing `&&` from both assignments; the array join
supplies the separator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dcetlin dcetlin force-pushed the fix/byte-authexport-double-amp branch from e14144d to 6726f60 Compare July 4, 2026 17:43

@sf8193 sf8193 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Reviewed with dual-agent process (sp-reviewer + typescript-reviewer).

No blockers or should-fixes. The fix is correct — the old trailing && produced a double connector (&& &&) when interpolated into the inner array that's already joined with .join(' && ') on line 75. Removing it makes the shell command well-formed.

Verified: empty authExport path ('' || null → filtered by .filter(Boolean)) is unaffected. No regressions.

Comment thread cli/lifecycle.ts
if (oauthToken) {
writeFileSync(tokenFile, oauthToken, { mode: 0o600 })
authExport = `export CLAUDE_CODE_OAUTH_TOKEN="$(cat ${shq(tokenFile)})" &&`
authExport = `export CLAUDE_CODE_OAUTH_TOKEN="$(cat ${shq(tokenFile)})"`

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Nit (flagged by typescript-reviewer): The two authExport branches (lines 59 and 63) are identical except for the file path. Could extract a helper like const makeAuthExport = (p: string) => \export CLAUDE_CODE_OAUTH_TOKEN="$(cat ${shq(p)})"`` to reduce duplication. Purely stylistic — not blocking.

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.

2 participants