Skip to content

fix(cli): prevent TUI menu from overwriting quota/verify output#562

Open
lawRathod wants to merge 2 commits intoNoeFabris:mainfrom
lawRathod:fix-issue-537
Open

fix(cli): prevent TUI menu from overwriting quota/verify output#562
lawRathod wants to merge 2 commits intoNoeFabris:mainfrom
lawRathod:fix-issue-537

Conversation

@lawRathod
Copy link
Copy Markdown

Summary

Resolves #537.

When executing opencode auth login and selecting Check quotas, Verify one account, or Verify all accounts, the output is printed to the console but immediately overwritten by the TUI menu. This makes the information impossible to read as it flashes briefly before the menu reappears.

This PR adds a promptContinue helper that pauses execution and waits for the user to press Enter before returning to the main TUI menu, allowing the output to be read.

Changes

  • Added promptContinue in src/plugin/cli.ts.
  • Added calls to await promptContinue() in src/plugin.ts and src/plugin/cli.ts after printing informative data (quotas, verification statuses, model configuration).

Resolves NoeFabris#537. The TUI menu clears the screen when it renders, which causes outputs from commands like 'Check quotas', 'Verify account', etc. to flash and disappear immediately. Added a 'Press Enter to return to menu...' prompt to allow the user to read the output.
Copilot AI review requested due to automatic review settings April 30, 2026 13:44
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 519731c7-f6d5-45ab-ac6a-3f5e8fa81e7e

📥 Commits

Reviewing files that changed from the base of the PR and between 550805d and 3d2b693.

📒 Files selected for processing (1)
  • src/plugin/cli.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/plugin/cli.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Greptile Review

Walkthrough

Adds a new exported function promptContinue() that waits for an Enter keypress when running in a TTY. The CLI auth/login flow now calls await promptContinue() at multiple user-interaction points (quota checks, account listing/no-accounts, cancelled verification, missing account index, verification success/blocked/failure, and after model configuration output) so that printed results remain visible until the user confirms to continue. No other logic in those branches was changed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the issue being fixed (TUI overwriting output) and the specific feature areas affected (quota/verify output), directly matching the changeset.
Description check ✅ Passed The description accurately explains the problem, the implemented solution, and lists all code changes made, directly relating to the changeset.
Linked Issues check ✅ Passed The PR fully addresses issue #537 by implementing the proposed fix: adding a promptContinue helper that pauses execution to prevent TUI menu from overwriting quota/verify output.
Out of Scope Changes check ✅ Passed All changes are directly scoped to resolving issue #537: introducing promptContinue and calling it after informative output to prevent menu overwriting.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 6/8 reviews remaining, refill in 10 minutes and 29 seconds.

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

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 30, 2026

Greptile Summary

This PR fixes a UX bug where the TUI menu would immediately redraw and overwrite quota/verification output by introducing a promptContinue() helper that pauses on "Press Enter" before returning to the menu loop. The helper correctly short-circuits with a isTTY() guard so non-interactive (piped) environments are unaffected.

  • package-lock.json bumps the version from 1.3.3-beta.21.6.0 without a visible package.json change in the diff, which leaves the lock file out of sync and likely to be overwritten on the next npm install.

Confidence Score: 3/5

The fix logic is correct, but the unexplained lock-file version bump must be resolved before merging.

The promptContinue implementation and all call-sites are correct; the isTTY() guard properly handles non-interactive environments. However the package-lock.json version jump (1.3.3-beta.21.6.0) without a matching package.json change in the diff is a P1 discrepancy — the lock file will be regenerated by the next npm install, potentially causing CI failures or masking an unintended version change.

package-lock.json — version bump needs reconciliation with package.json

Important Files Changed

Filename Overview
package-lock.json Version bumped from 1.3.3-beta.2 to 1.6.0 with no corresponding package.json change visible in the diff — lock file may be out of sync.
src/plugin.ts Adds await promptContinue() after every informative console output (quotas, verify results, toggle status) before re-entering the TUI loop; all placements are correct and the non-TTY case is handled by the guard in the helper.
src/plugin/cli.ts Adds promptContinue() helper with correct isTTY() guard; also inserts a call after the configure-models result log within the TUI-only path.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[promptLoginMode called] --> B{isTTY?}
    B -- No --> C[promptLoginModeFallback\nreadline on stdin]
    B -- Yes --> D[showAuthMenu TUI]
    C --> E[Returns mode: check/verify/verify-all/etc.]
    D --> F[Returns action]
    F -- configure-models --> G[updateOpencodeConfig]
    G --> H[Print result]
    H --> I[promptContinue NEW]
    I --> D
    E --> J[plugin.ts handles mode]
    F --> J
    J -- check quotas --> K[Print quota output]
    K --> L[promptContinue NEW]
    L --> A
    J -- verify / verify-all --> M[Run verification]
    M --> N[Print result]
    N --> O[promptContinue NEW]
    O --> A
    J -- manage toggle --> P[Toggle account\nPrint status]
    P --> Q[promptContinue NEW]
    Q --> A

    style I fill:#90EE90
    style L fill:#90EE90
    style O fill:#90EE90
    style Q fill:#90EE90
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
package-lock.json:4
**Unexplained version bump in lock file**

`package-lock.json` changes the package version from `1.3.3-beta.2` to `1.6.0`, but `package.json` does not appear in this PR's diff. If `package.json` wasn't also updated, the lock file is out of sync with the source of truth — `npm ci` and `npm install` will regenerate it from `package.json`, which would immediately undo this change and could cause CI confusion. Was an `npm version` bump intended as part of this fix, or did a merge/rebase pick up stale lock file changes?

Reviews (2): Last reviewed commit: "fix(cli): add isTTY guard to promptConti..." | Re-trigger Greptile

Comment thread src/plugin/cli.ts
This fixes an issue where promptContinue could throw an unhandled rejection
in a piped/non-interactive environment when stdin reaches EOF.
@lawRathod
Copy link
Copy Markdown
Author

Thanks for the feedback! I've added the isTTY() guard to promptContinue as suggested to avoid issues in non-interactive environments.

Comment thread package-lock.json
"name": "opencode-antigravity-auth",
"version": "1.3.3-beta.2",
"version": "1.6.0",
"lockfileVersion": 3,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Unexplained version bump in lock file

package-lock.json changes the package version from 1.3.3-beta.2 to 1.6.0, but package.json does not appear in this PR's diff. If package.json wasn't also updated, the lock file is out of sync with the source of truth — npm ci and npm install will regenerate it from package.json, which would immediately undo this change and could cause CI confusion. Was an npm version bump intended as part of this fix, or did a merge/rebase pick up stale lock file changes?

Prompt To Fix With AI
This is a comment left during a code review.
Path: package-lock.json
Line: 4

Comment:
**Unexplained version bump in lock file**

`package-lock.json` changes the package version from `1.3.3-beta.2` to `1.6.0`, but `package.json` does not appear in this PR's diff. If `package.json` wasn't also updated, the lock file is out of sync with the source of truth — `npm ci` and `npm install` will regenerate it from `package.json`, which would immediately undo this change and could cause CI confusion. Was an `npm version` bump intended as part of this fix, or did a merge/rebase pick up stale lock file changes?

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

TUI overwrites output of 'Check quotas' and 'Verify accounts' in 'opencode auth login'

3 participants