Skip to content

feat(agent): let a service renew its own registration token - #5674

Merged
kojiwakayama merged 6 commits into
mainfrom
feat/agent-service-token-renewal
Dec 4, 2026
Merged

kojiwakayama merged 6 commits into
mainfrom
feat/agent-service-token-renewal

Conversation

@kojiwakayama

@kojiwakayama kojiwakayama commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An Agent service that registers itself with the API needs a bearer token. Until now that token was fixed (VERYFRONT_API_TOKEN), so registration stopped working once the token expired.

This adds an optional client login for the service:

  • New settings VERYFRONT_AGENT_SERVICE_CLIENT_ID and VERYFRONT_AGENT_SERVICE_CLIENT_SECRET. They must be set together; one without the other is a configuration error.
  • When they are set, the service gets its own registration token and takes precedence over VERYFRONT_API_TOKEN. It:
    • reuses the token until shortly before it expires, using expires_in from the response or the token's own expiry;
    • gets a new one once if the API answers 401;
    • reads the token response with the same size limits as the OAuth client (128 KiB response, 64 KiB token);
    • lets a caller whose request is aborted stop waiting for a token, while the shared token request continues.
  • When they are not set, nothing changes.
  • docs/guides/configuration.md lists the two settings. docs/guides/agent-service-runtime.md explains registration with them and shows an example.

Verification

  • registration-credentials tests (14), registration tests and config tests pass on Deno. The registration-credentials tests also pass on Bun.
  • Format, lint, type check, module and dependency boundaries, the cross-runtime import audit, doc links and guide snippets pass.
  • Not tested against a running API.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

📦 Client bundle boundary

Entrypoint Modules Source size Server leaks
src/index.client.ts 66 371 KiB ✅ 0
src/react/components/Head.tsx 5 74 KiB ✅ 0
src/react/router/index.tsx 5 74 KiB ✅ 0
src/react/context/index.tsx 5 74 KiB ✅ 0
src/react/fonts/index.ts 6 81 KiB ✅ 0
src/react/components/ui/index.ts 111 720 KiB ✅ 0
src/react/components/ui/adapter/contract.ts 1 18 KiB ✅ 0
src/react/components/ui/icons/index.ts 3 17 KiB ✅ 0
src/chat/index.ts 305 2055 KiB ✅ 0
src/chat/ag-ui.ts 61 464 KiB ✅ 0
src/chat/protocol.ts 1 11 KiB ✅ 0
src/chat/types.ts 46 248 KiB ✅ 0
src/chat/message-prep.ts 68 519 KiB ✅ 0
src/markdown/index.ts 6 30 KiB ✅ 0
src/mdx/index.ts 2 2 KiB ✅ 0
src/agent/identity-contracts.ts 1 3 KiB ✅ 0
src/schemas/index.ts 43 222 KiB ✅ 0
src/platform/env.ts 5 55 KiB ✅ 0
src/workflow/claude-code/react/index.ts 9 91 KiB ✅ 0
src/events/index.ts 37 631 KiB ✅ 0
src/events/ag-ui/public.ts 36 624 KiB ✅ 0
src/run-events/index.ts 54 323 KiB ✅ 0

A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in scripts/lint/client-bundle-baseline.json to burn down.

@codecov

codecov Bot commented Dec 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.71523% with 11 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/agent/service/registration-credentials.ts 91.42% 2 Missing and 7 partials ⚠️
src/agent/service/registration.ts 95.23% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@kojiwakayama
kojiwakayama marked this pull request as ready for review December 4, 2026 21:11
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-04T22:24:06.707850Z 7ddc563 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 25e81eb913

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b545899487

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread docs/guides/configuration.md Resolved
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 32b3758e96

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: cec94ccf32

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 7ddc5636c3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@kojiwakayama
kojiwakayama added this pull request to the merge queue Dec 4, 2026
@sonarqubecloud

sonarqubecloud Bot commented Dec 4, 2026

Copy link
Copy Markdown

Merged via the queue into main with commit 036bf0a Dec 4, 2026
444 checks passed
@kojiwakayama
kojiwakayama deleted the feat/agent-service-token-renewal branch December 4, 2026 23:05
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