Skip to content

fix(cli): flush the login authorization URL synchronously under non-TTY stdout (#1007) - #1029

Merged
lidge-jun merged 1 commit into
devfrom
codex/lane-07-login-url-flush
Aug 5, 2026
Merged

lidge-jun merged 1 commit into
devfrom
codex/lane-07-login-url-flush

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Aug 4, 2026 •

Copy link
Copy Markdown
Owner

Bug-stack campaign lane (devlog/_plan/260805_bug_stack_campaign/080). Fixes #1007.

console.log can buffer behind a pipe, hiding the authorization URL for the entire polling window. The pre-poll block (URL + instructions + flow id) now goes out as one atomic synchronous fd-1 write with partial-write looping and zero-progress failure.

  • Pipe-based regression: a spawned child running the real handler against a never-resolving status mock proves the URL is readable while the child is still authenticating. --json mode untouched; TTY ordering preserved.
  • bun run typecheck 0 errors; bun run privacy:scan pass; tests/cli-account 64/64; full suite on ssh lidge 8314/0 (campaign tree).

Summary by CodeRabbit

  • Bug Fixes

    • Improved account login output when running in piped or redirected terminals.
    • Login URLs, instructions, and flow identifiers now appear together before authentication polling begins.
    • Prevented incomplete or missing login information caused by partial output writes.
  • Tests

    • Added coverage verifying login details are emitted correctly while authentication remains in progress.

…TY stdout (#1007)

console.log can buffer behind a pipe, hiding the URL for the entire
polling window. The pre-poll block (URL + instructions + flow id) now
goes out as one atomic synchronous fd-1 write with partial-write
looping, and a pipe-based regression proves the URL is readable while
the child is still authenticating.
@github-actions github-actions Bot added the bug Something isn't working label Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c9b14efb-a44e-4cf2-abf7-84e6f32c5fe6

📥 Commits

Reviewing files that changed from the base of the PR and between 2a72aa4 and b0d49b7.

📒 Files selected for processing (3)
  • src/cli/account-auth.ts
  • tests/cli-account.test.ts
  • tests/helpers/account-login-pipe-child.ts

📝 Walkthrough

Walkthrough

Account login now writes Codex and OAuth instructions as complete synchronous stdout blocks before polling. The regression test runs a pending login through a local mock API and verifies that piped output contains the authorization URL and flow identifier.

Changes

Account login output

Layer / File(s) Summary
Synchronous login output
src/cli/account-auth.ts
Adds writeStdoutFully to handle partial and zero-byte writes. Codex and OAuth flows combine their login details into one block and write it before polling.
Pipe output regression coverage
tests/helpers/account-login-pipe-child.ts, tests/cli-account.test.ts
Runs login against a local mock that remains pending. The integration test verifies the authorization URL and flow identifier appear on piped stdout while the process remains active.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: ingwannu, wibias

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the synchronous login URL flush that fixes non-TTY stdout buffering in issue #1007.
Linked Issues check ✅ Passed The changes satisfy [#1007] by writing the login URL before polling and adding a piped-stdout regression test.
Out of Scope Changes check ✅ Passed All code and test changes directly support the non-TTY login output fix described in [#1007].
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/lane-07-login-url-flush

Comment @coderabbitai help to get the list of available commands.

@lidge-jun
lidge-jun merged commit cc10b3f into dev Aug 5, 2026
22 checks passed
@lidge-jun
lidge-jun deleted the codex/lane-07-login-url-flush branch August 5, 2026 09:27
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
…url-flush

fix(cli): flush the login authorization URL synchronously under non-TTY stdout (lidge-jun#1007)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ocx account login withholds the authorization URL under non-TTY stdout, blocking the manual redirect-URL flow

1 participant