fix(installer): stop double-opening browser at the connect prompt#9
Closed
Harihara04sudhan wants to merge 1 commit into
Closed
fix(installer): stop double-opening browser at the connect prompt#9Harihara04sudhan wants to merge 1 commit into
Harihara04sudhan wants to merge 1 commit into
Conversation
The previous probe ran 'armoriq-dev login --help | grep -q -- "--product"' to feature-detect the --product flag. The SDK's 'login' subcommand ignores --help (no per-subcommand --help handler), so the probe actually ran the full device-code flow as a side effect: opened browser tab #1, spawned a local callback server on port A. The grep then failed because the login flow's stdout doesn't contain '--product', so the script fell to the env-var fallback branch and ran 'armoriq-dev login' AGAIN — second browser tab, second device code, second local port. Net: pressing Y at "Connect your ArmorIQ account now?" opened two browser tabs with two unrelated device codes (one without product context, one with it). Fix: drop the probe. Always pass --product as a flag AND export ARMORIQ_PRODUCT as a belt-and-braces fallback. Older SDKs without --product support ignore the unknown flag and pick up the env var. New SDKs prefer the flag, env var still works as backup. One CLI call, one device code, one browser tab. Companion SDK fix (per-subcommand --help handling) will be filed separately on armoriq-sdk-customer-ts/dev. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
User presses Y at "Connect your ArmorIQ account now?" → two browser tabs open with two unrelated device codes:
dev.armoriq.io/auth/device?code=2NWM-RK69&callback=http://localhost:55156/callback(no product param, generic "Authorize Device" page)dev.armoriq.io/auth/device?code=NTUK-TE8D&callback=http://localhost:55164/callback&product=armorcopilot(branded "Authorize ArmorCopilot" page)Different ports = two separate
cmdLogininvocations spawning two local callback servers.Root cause
The installer feature-detected
--productsupport by running:But the SDK's
loginsubcommand has no--helphandler — it just runs the full device-code flow with--helpparsed as an unknown flag. That's tab #1.The grep then fails (the login flow's stdout doesn't contain "--product"), so the script falls into the
elsebranch and runs the env-var fallback:ARMORIQ_PRODUCT=armorcopilot armoriq-dev login. That's tab #2.Fix
Drop the probe entirely. Always pass
--productas a flag AND exportARMORIQ_PRODUCTas a fallback. New SDKs prefer the flag, old SDKs ignore the unknown flag and pick up the env var. Either way: one CLI call, one device code, one browser tab.Follow-ups
armoriq-sdk-customer-ts/devshould add a per-subcommand--helphandler so future probes don't accidentally trigger the device-code flow. Separate PR.install_armorcopilot.shneeds a sync PR after this merges.Test plan
rm -rf ~/.armoriq/armorCopilot ~/.copilot/armorcopilot ~/.armoriq/credentials.json).curl -fsSL https://armoriq.ai/install_armorcopilot.sh | bash(or sync this branch into landing first).dev.armoriq.io/auth/device?...&product=armorcopilotshowing "Authorize ArmorCopilot".🤖 Generated with Claude Code