Use device-flow host enrollment#35
Draft
adit-chandra wants to merge 4 commits into
Draft
Conversation
- Target device-session creation and credential registration at the hosted runtime API (new PROMPTLESS_API_BASE_URL, default api.gopromptless.ai); the worker base URL only serves healthz, policy, and check-ins, and its ALB does not route enrollment paths. - Replace the legacy poll loop with a register-driven wait: the credential endpoint doubles as the approval poll, so the legacy mint-on-poll exchange can never consume a device-flow session out from under the client. - Classify HTTP failures (new BootstrapHttpError with parsed detail.code): conflict/revoked/unknown-session responses drop the pending session so the next run enrolls fresh; 5xx and network errors retry until the deadline. - Run the whole enrollment flow, resume included, under the leader lock so concurrent session starts can never open duplicate approval tabs. - Discard malformed persisted pending sessions instead of erroring every session start; derive the credential URL at rehydrate instead of persisting. - Distinguish deliberate browser opt-out (browser_open_disabled) from launch failure; mention promptless-host-runtime enroll in pending guidance; shrink the hook timeout to 150s to fit the callback-free flow. - Rework tests around a two-server fake control plane (worker 404s enrollment paths like the prod ALB); add resume, conflict, transient-error, leak-guard, and 0.2.0 credential-reuse coverage.
…-enrollment # Conflicts: # src/promptless_instruction_hub/managed_runtime_assets/host-enrollment/promptless-host-runtime # tests/test_managed_bootstrap.py
…-enrollment # Conflicts: # src/promptless_instruction_hub/managed_runtime.py # src/promptless_instruction_hub/managed_runtime_assets/host-enrollment/promptless-host-runtime # tests/test_managed_bootstrap.py
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
PROMPTLESS_API_BASE_URL, defaulthttps://api.gopromptless.ai) — the worker base only serves healthz/policy/check-ins and its ALB does not route enrollment pathsdetail.code: conflict/revoked/unknown-session drop the pending session for a fresh enrollment next run; 5xx/network errors retry until the deadline0.3.0Dependency
/device-sessions+/credentialendpoints and theclient_registeredpoll gate). Deploy the runtime first — merging this PR auto-releases the plugin.Validation
uv run pytest(151 passed; bootstrap tests run the real script against a two-server fake control plane whose worker base 404s enrollment paths like the prod ALB)uv run ruff check .python3.9 -m py_compileof the host-runtime script