fix(cli): treat tab-close after successful create as completion#617
Merged
fix(cli): treat tab-close after successful create as completion#617
Conversation
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.
Summary
The Mode A wizard's heartbeat watchdog detects a closed browser tab ~3.6s after it disappears and emits
WizardOutcome::Cancelled. But if the user clicked Create service right before closing — backend already committed an active service — the resulting "✗ Wizard cancelled. No service was created." message is misleading and prompts users to re-run, creating duplicates.This PR captures successful AiKey create responses inside the existing proxy sniff and treats them as the implicit completion ack when the soft-failure outcomes (heartbeat watchdog, max-duration timeout) fire.
closes #601
What changed
KeysResponseSignalenum + pureclassify_keys_responsehelper extracted from the inline sniff athandle_proxy. Same lifecycle behavior forpending_authplaceholders; newActiveCreatedsignal captures successful creates.ServerState.completed_ai_key: Mutex<Option<Value>>snapshots the response body when the active-create signal fires AND the flow isFlowKind::AiKey. Display-once flows (api-key-create, rotate, node-register) still require the explicit/api/proxy/completeack so secrets don't get accidentally surfaced.selectprefer the captured success and emitWizardOutcome::AiKeyCompleted(value); the printed message is updated to reflect what happened.Ctrl+Cand explicit cancel button preserved as hard cancel — those are unambiguous user gestures.Test plan
cargo test -p nyxid-cli classify_keys_response(7 new classifier tests)cargo test -p nyxid-cli(288 unit + freshness)NYXID_WIZARD_NO_OPEN=1 nyxid service add llm-openai --label "QA tab close test", open wizard URL, paste API key, click Create service, immediately close the tab. Confirm CLI prints "Browser stopped responding (tab closed?) — using last successful create as completion." and shows the wizard summary instead of "No service was created".WizardOutcome::Cancelled.WizardOutcome::Cancelled(the user's gesture is honored).