Skip to content

FirecREST autoalloc: authenticate with an access token file - #1176

Draft
rjanalik wants to merge 7 commits into
It4innovations:mainfrom
rjanalik:firecrest-token-auth
Draft

rjanalik wants to merge 7 commits into
It4innovations:mainfrom
rjanalik:firecrest-token-auth

Conversation

@rjanalik

@rjanalik rjanalik commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1142, as discussed there: support FirecREST deployments where users cannot get OAuth2 client
credentials. On LUMI, FirecREST accepts only
personal access tokens (JWTs) that the user generates in the LUMI web interface and that are valid for 24 hours.

What changes

  • New option hq alloc add firecrest --access-token-file <path>, an alternative to --token-url/--client-id
    (the two are mutually exclusive, enforced by clap). A relative path is resolved by the client.
  • The server reads the file whenever it needs a token, so an expiring token is replaced by overwriting the file,
    with no server restart and no queue changes. Only the path is stored in the queue parameters and the journal,
    never the token.
  • The expiration is read from the JWT exp claim (without verifying the signature; the API does that). An expired
    token is not sent. The server logs the expiration of every new token and warns once an hour before it expires.
    It also warns if the file is readable by other users.
  • An unavailable token no longer breaks the queue. Before, an expired token made every submission and status
    query fail, so the queue was paused after too many failed submissions, and its allocations were considered
    finished after too many status errors, although they were fine. Handlers can now return a
    CredentialsUnavailable error (missing, empty or expired token file, or a token rejected with 401 that the user
    has not replaced yet). Such errors do not count as submission failures or status errors. The queue logs the
    problem once, skips submissions and status updates, and resumes as soon as a valid token appears. Running workers
    are unaffected, since they never use the token. Client-credentials errors behave as before.
  • When a server is restored from a journal, a missing token file does not drop the queue (unlike a missing client
    secret): the queue is restored and waits for the token.

rjanalik and others added 7 commits December 1, 2026 14:16
The client-credentials fields move into `FirecrestAuth::ClientCredentials`,
and the handler obtains its tokens from a matching token source. This
prepares for other ways of authenticating; the behaviour is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uu67rL7X82t5zU969LibgG
Some sites do not offer client credentials to their users: on LUMI,
FirecREST only accepts personal access tokens that the user obtains in
the web interface and that are valid for 24 hours. The new
`--access-token-file` option is an alternative to `--token-url` and
`--client-id`.

The server reads the file whenever it needs a token, so an expiring
token is replaced by overwriting the file, without touching the queue
or restarting the server. Neither the token nor its file is read when
the queue is restored, so a missing token does not drop the queue. The
expiration is read from the JWT `exp` claim (without verifying the
signature), so an expired token is reported instead of being sent. A
rejected token is not retried until the file changes. The client makes
the path absolute, since the server runs in another directory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uu67rL7X82t5zU969LibgG
A personal access token expires while the server keeps running, e.g.
overnight. Every submission then failed and every status query failed,
so the queue was paused after too many failed submissions, and its
allocations were considered finished after too many status errors,
although nothing was wrong with them.

A handler now reports such errors as `CredentialsUnavailable`: a token
file that is missing, empty or expired, or a token that the API rejects
and that the user has not replaced yet. These errors do not count as
failed submissions or status errors. The queue logs the problem once,
skips submissions and status updates, and resumes as soon as a valid
token appears. Errors of the client credentials grant are unchanged.

The FirecREST handler also authenticates before creating an allocation
directory, so that failed attempts do not leave directories behind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uu67rL7X82t5zU969LibgG
When the server reads a new token from the file, it logs when the token
expires, and it warns once when the token is less than an hour from
its expiration, so that the user can replace it before the queue stops
submitting allocations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uu67rL7X82t5zU969LibgG
The access token file option made the FirecREST variants of the
`alloc add` and `alloc dry-run` subcommands large enough for clippy's
`large_enum_variant` lint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uu67rL7X82t5zU969LibgG
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uu67rL7X82t5zU969LibgG
The authentication options get their own section, with an example for
LUMI, how to replace an expiring token, and what the queue does while
the token is unavailable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Uu67rL7X82t5zU969LibgG

This branch has not been deployed

No deployments
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