Repository navigation
feat: renew the job user access token over the handler IPC pipe - #1995
Open
eduard-dumitru wants to merge 11 commits into
Open
eduard-dumitru wants to merge 11 commits into
eduard-dumitru wants to merge 11 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Outstanding issues include cross-job token leakage on teardown or cancellation, along with refresh scheduling and request retry defects.
8 open issues
Prevent in-flight token fetches from publishing after stop · New Keep provider locks until cancelled worker threads finish · New Copy headers before adding authorization in sync requests · New Handle non-replayable request bodies on 401 retries · New Copy headers before adding authorization in async requests · New Back off when refreshed tokens are already due for renewal · New Reschedule token expiry when the stored token changes · New Recheck retry backoff and unsupported status before fetching · New
What changed in this PR
Adds opt-in access-token renewal for long-running UiPath Python jobs, connecting the platform HTTP client to the executor’s existing IPC token API.
Changes:
- Adds token providers and one-time renewal retries after HTTP 401 responses.
- Implements cached, proactive IPC renewal with per-job CLI and pooled-server opt-ins.
- Adds tests and documentation, and bumps package versions and the platform dependency minimum.
| File | Description |
|---|---|
packages/uipath/uv.lock |
Updates SDK and platform package versions. |
packages/uipath/tests/cli/test_server_ipc.py |
Tests pooled-job renewal opt-in and lifecycle hooks. |
packages/uipath/tests/cli/test_run.py |
Tests the hidden renewal flag and connection wiring. |
packages/uipath/tests/cli/test_job_token.py |
Tests caching, renewal, failures, teardown, and IPC transport. |
packages/uipath/src/uipath/_cli/cli_server_ipc.py |
Installs and removes providers for opted-in pooled jobs. |
packages/uipath/src/uipath/_cli/cli_run.py |
Adds and validates the executor’s renewal flag. |
packages/uipath/src/uipath/_cli/_job_token.py |
Implements IPC token caching and renewal scheduling. |
packages/uipath/src/uipath/_cli/_job_api.py |
Connects provider lifecycle to handler IPC connections. |
packages/uipath/pyproject.toml |
Bumps the SDK version and platform dependency minimum. |
packages/uipath/docs/core/environment_variables.md |
Documents renewal behavior and environment updates. |
packages/uipath-platform/uv.lock |
Updates the platform package version. |
packages/uipath-platform/tests/services/test_access_token_refresh.py |
Tests provider selection, authorization, and 401 retries. |
packages/uipath-platform/src/uipath/platform/common/_config.py |
Defines provider interfaces and process-default configuration. |
packages/uipath-platform/src/uipath/platform/common/_base_service.py |
Uses provider tokens and retries after renewal. |
packages/uipath-platform/src/uipath/platform/common/_api_client.py |
Avoids copying stale authorization with folder headers. |
packages/uipath-platform/src/uipath/platform/common/__init__.py |
Exports token-provider APIs. |
packages/uipath-platform/src/uipath/platform/_uipath.py |
Enables default providers for environment-configured clients. |
packages/uipath-platform/pyproject.toml |
Bumps the platform package version. |
packages/uipath-platform/CLAUDE.md |
Documents the token-renewal architecture. |
Review effort: Balanced
eduard-dumitru
marked this pull request as draft
November 16, 2026 14:36
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
eduard-dumitru
force-pushed
the
feat/job-token-refresh
branch
from
November 16, 2026 22:24
41b5149 to
ecddebd
Compare
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The same wait covers a failed call and a host that hands back a token already due. Halving it picks up the serverless handler's renewed token sooner and gives a short-lived token more tries before it expires. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The host opts in on the command line, so the refresher no longer reads the error's type to decide the host is "unsupported" and stop asking. Any failure keeps the current token and is retried after the backoff. Only the first failure is logged. Its warning now says so: later failures to renew the job's token are not logged. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Comments and docstrings only; no code change. The environment variables page now describes what a job sees instead of how renewal is wired. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
- A client follows the environment's token only while UIPATH_JOB_KEY there still matches the job it was created in; after that it keeps its last token. - The chat and voice bridges give the socket library a callable for the headers, so a reconnect sends the current token. - One warning per failure episode: the flag resets when a renewal succeeds, and the recovery is logged. - An opt-in that cannot be honored warns and the job runs without renewal. - The loop warns when it stops for lack of a token with an expiry, and waits in slices of at most a minute. - Only the variables holding the job's token are rewritten. - Remove properties and a wrapper that only tests used, and annotate the tests this change adds. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
eduard-dumitru
marked this pull request as ready for review
November 20, 2026 12:35
main took uipath-platform 0.3.9 to 0.3.12 and uipath 2.15.4, so this change ships as uipath-platform 0.3.13 and uipath 2.15.5. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
This branch has not been deployed
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.





What
A long-running job can outlive the user access token it starts with, and its calls then fail with 401. This change renews the token while the job runs and makes the SDK send the renewed token.
Changes
uipath-platform
UiPath()whose secret came from the environment re-readsUNATTENDED_USER_ACCESS_TOKEN/UIPATH_ACCESS_TOKENon every request. An explicitsecret=or a client-credentials token is sent as before.UIPATH_JOB_KEYthere no longer matches the job the client was created in, and keeps its last token.uipath
JobTokenRefresher(_cli/_job_token.py) renews the job's user access token at 80 % of its lifetime, at least two minutes before expiry, and writes it to the token environment variables that hold that token.uipath run --handler-ipc-token-refreshflag (needs--handler-ipc-pipe), orrefreshAccessTokenOverIpcon a pooled run request. An opt-in that cannot be honored is ignored with a warning and the job still runs.Authorizationheader on every connect and reconnect, the debug bridge when it connects.Behavior
Versions
uipath-platform0.3.13, anduipath2.15.5 requiringuipath-platform>=0.3.13.Tests
New tests cover the per-request re-read, the refresher's timing, failure and stop behavior, a round trip over a real named pipe, the CLI flag, the pooled opt-in, the trace exporter and the three bridges.
The full test suite,
ruff check,ruff format --checkandmypypass locally on both packages.🤖 Generated with Claude Code