Skip to content

fix(t3): defer browser setup when the CLI lacks the command - #3071

Merged
shunkakinoki merged 3 commits into
mainfrom
fix/t3-browser-setup-capability
Oct 14, 2026
Merged

shunkakinoki merged 3 commits into
mainfrom
fix/t3-browser-setup-capability

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • setup-browser.sh checks t3 --help for a browser subcommand. If it is missing, the script defers to the connect timer, the same way it does when the CLI is not installed yet.
  • A new spec case covers a CLI without the browser command.

Why

Since #3055, E2E (Ubuntu) and both Docker builds have failed on main at the setupT3Browser activation:

ERROR
  Unexpected positional argument: "setup"
make: *** [Makefile:780: nix-switch] Error 1

package.json pins t3: ^0.0.44, which resolves to npm latest (0.0.45). That release has no browser subcommand, so it reads browser as the cwd argument and rejects setup. Hosts on the nightly runtime (matic: 0.0.46-nightly) list browser and keep running setup.

Since e2e-check and docker-check are required, every open PR is blocked, including #3067-#3070.

decided: probe the help output rather than pin a nightly in package.json - the npm channel is a separate choice, and the connect timer already re-runs setup after t3 update

Test plan

  • shellspec spec/t3_browser_setup_spec.sh (11 examples, 0 failures)
  • shellcheck on the changed script and spec
  • matic's real t3 --help matches the probe ( browser Manage T3's headless browser on this host.)

🤖 Generated with Claude Code


Summary by cubic

Defers t3 browser setup when the installed CLI lacks the browser subcommand, so fresh installs no longer fail on npm's latest release (0.0.45).

  • Probes t3 --help and exits early if the browser command is missing; the connect timer retries setup once t3 update moves to a runtime that has it.
  • Adds a spec case for a CLI without the browser command.

Bug Fixes

  • Adds the missing coverage entry for home-manager/services/cliproxyapi/scripts/backup-check.sh so the shell-test coverage check passes.

Written for commit a3c1df4. Summary will update on new commits.

View guided diff Turn on auto-fix

shunkakinoki and others added 2 commits October 14, 2026 13:44
backup-check.sh landed with its spec in cliproxyapi_backup_spec.sh but
without a coverage entry, so the shell-test coverage check fails on main
and on every open PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The setupT3Browser activation runs `t3 browser setup`. The npm latest
release (0.0.45) has no browser subcommand and rejects the call
("Unexpected positional argument: \"setup\""), so `make switch` fails on
every fresh install. This has kept the E2E and Docker checks red on main.
Probe the CLI help and defer to the connect timer, as for a missing CLI.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@indent

indent Bot commented Oct 14, 2026

Copy link
Copy Markdown

Warning

This organization's free trial has ended, so Indent couldn't start this review. Manage billing to resume reviews on this repository.

Review agents

Select any unchecked box below to run or rerun that agent.

Pending (1)
  • Indent Review Agent · This agent has not run.
Full results

Indent Review Agent

  • Summary: This agent has not run.
  • Latest resultNo result — this agent has not run.

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2a0af8d6-d0a4-40cf-8a42-b1c8a63211b6
📥 Commits

Reviewing files that changed from the base of the PR and between 0f9b380 and a3c1df4.

📒 Files selected for processing: 3
  • home-manager/services/t3-connect/setup-browser.sh
  • spec/coverage_spec.sh
  • spec/t3_browser_setup_spec.sh

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Browser setup now completes successfully when the selected CLI does not support the browser command, instead of attempting an unavailable setup.
  • Tests

    • Added coverage for CLI compatibility checks and the backup-check script.

The browser setup script checks whether the selected CLI lists a browser command before running setup. The specs cover the missing-command case and add backup-check.sh to shell-script coverage checks.

Changes: Browser setup

Layer / File(s) Summary
Check browser command availability
home-manager/services/t3-connect/setup-browser.sh, spec/t3_browser_setup_spec.sh
The script checks the selected CLI’s help output before setup. If the help command fails or does not list browser, the script reports that setup is deferred and exits successfully. The spec checks this case using a mock CLI.

Shell script coverage

Layer / File(s) Summary
Include backup-check in coverage assertions
spec/coverage_spec.sh
The coverage spec requires a spec for backup-check.sh and includes the script in its expected shell-script list.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to a3c1d

Browser setup is deferred until the CLI supports the command, and the supported help format is recognized by the probe. No actionable merge risk remains.

Pre-merge checks: Passed 4 · Failed 1

Failed 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: deferring browser setup when the T3 CLI lacks the browser command.
Description check Passed The description directly explains the browser-command probe, the activation failure it prevents, the retry behavior, and the added test coverage.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the browser command,
Then lets setup wait when it is not at hand.
The shell script list grows by one,
And coverage checks its work is done.
I nibble a carrot and hop away.

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

@pullfrog pullfrog Bot left a comment

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.

The fix correctly defers t3 browser setup when the installed CLI lacks the browser subcommand. The approach of probing t3 --help output is sound since the npm latest (0.0.45) doesn't have the command while nightly (0.0.46-nightly) does. The connect timer will retry after t3 update moves to a runtime that includes it.

Changes look good:

  • setup-browser.sh: Added capability check that exits 0 cleanly when browser subcommand is missing, with a clear log message.
  • t3_browser_setup_spec.sh: New test case covers the missing-command scenario via MOCK_NO_BROWSER=1.
  • coverage_spec.sh: Added missing coverage entry for cliproxyapi/scripts/backup-check.sh (unrelated but needed for test suite to pass).

No issues found. Tests pass (11 examples, 0 failures) and shellcheck is clean.

Pullfrog  | View workflow run | Using free | 𝕏

@cubic-dev-ai cubic-dev-ai Bot left a comment

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.

1 issue found and verified against the latest diff

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="home-manager/services/t3-connect/setup-browser.sh">

<violation number="1" location="home-manager/services/t3-connect/setup-browser.sh:15">
P2: `|| true` hides every failure from the CLI help probe, so a missing or broken active runtime is misreported as “no browser command” and setup is skipped silently. Preserve a nonzero help status; only defer after successful help output lacks `browser`.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

# The npm `latest` release predates the `browser` subcommand that nightly
# runtimes ship; it rejects `browser setup` and would fail activation. The
# connect timer repeats setup once `t3 update` moves to a runtime that has it.
help="$(env "T3CODE_HOME=$base" "${T3_BROWSER_CLI:?}" --help 2>&1 || true)"

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.

P2: || true hides every failure from the CLI help probe, so a missing or broken active runtime is misreported as “no browser command” and setup is skipped silently. Preserve a nonzero help status; only defer after successful help output lacks browser.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At home-manager/services/t3-connect/setup-browser.sh, line 15:

<comment>`|| true` hides every failure from the CLI help probe, so a missing or broken active runtime is misreported as “no browser command” and setup is skipped silently. Preserve a nonzero help status; only defer after successful help output lacks `browser`.</comment>

<file context>
@@ -9,6 +9,15 @@ if [ ! -f "$base/runtime/service-state.json" ] && [ ! -x "${T3_REAL_CLI:-$HOME/.
+# The npm `latest` release predates the `browser` subcommand that nightly
+# runtimes ship; it rejects `browser setup` and would fail activation. The
+# connect timer repeats setup once `t3 update` moves to a runtime that has it.
+help="$(env "T3CODE_HOME=$base" "${T3_BROWSER_CLI:?}" --help 2>&1 || true)"
+if ! grep -qE '^ +browser ' <<<"$help"; then
+  echo "T3 CLI has no browser command; deferring browser setup to the connect timer."
</file context>
Suggested change
help="$(env "T3CODE_HOME=$base" "${T3_BROWSER_CLI:?}" --help 2>&1 || true)"
if ! help="$(env "T3CODE_HOME=$base" "${T3_BROWSER_CLI:?}" --help 2>&1)"; then
printf '%s\n' "$help" >&2
exit 1
fi

@shunkakinoki
shunkakinoki merged commit 3d09c92 into main Oct 14, 2026
35 checks passed
@shunkakinoki
shunkakinoki deleted the fix/t3-browser-setup-capability branch October 14, 2026 07:57
@linear-code

linear-code Bot commented Oct 14, 2026

Copy link
Copy Markdown

SHUN-16538

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.

1 participant