-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(hermes): document API bearer token lifecycle and retrieval #7212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ericksoa
merged 6 commits into
NVIDIA:main
from
harjothkhara:codex/oss-7175-hermes-api-key-lifecycle-019f7d76
Jul 22, 2026
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c42c3a6
fix(hermes): document API bearer token lifecycle and retrieval
harjothkhara 7acbeac
docs(hermes): qualify the ordinary-restart token bug condition
harjothkhara 37d4041
fix(hermes): prove API token rotation after rebuild
harjothkhara a628e0a
test(e2e): use the configured CLI path for Hermes token retrieval
harjothkhara 856e6ad
merge: update PR 7212 with current main
ericksoa 35ff336
test(hermes): cover incomplete prepared rebuild recovery
ericksoa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import { readFileSync } from "node:fs"; | ||
| import path from "node:path"; | ||
|
|
||
| import { describe, expect, it } from "vitest"; | ||
|
|
||
| const COMMANDS_PATH = "docs/reference/commands.mdx"; | ||
| const REBUILD_GUIDE_PATH = "docs/manage-sandboxes/recover-rebuild-sandboxes.mdx"; | ||
| const QUICKSTART_PATH = "docs/get-started/quickstart-hermes.mdx"; | ||
|
|
||
| function readDoc(relativePath: string): string { | ||
| return readFileSync(path.join(process.cwd(), relativePath), "utf8"); | ||
| } | ||
|
|
||
| function readHermesGatewayTokenSection(): string { | ||
| const commands = readDoc(COMMANDS_PATH); | ||
| const heading = "### `$$nemoclaw <name> gateway-token`"; | ||
| const sectionStart = commands.indexOf(heading); | ||
| const sectionEnd = commands.indexOf("\n### `", sectionStart + heading.length); | ||
|
|
||
| expect(sectionStart).toBeGreaterThanOrEqual(0); | ||
| expect(sectionEnd).toBeGreaterThan(sectionStart); | ||
|
|
||
| const section = commands.slice(sectionStart, sectionEnd); | ||
| const hermesStart = section.indexOf('<AgentOnly variant="hermes">'); | ||
| const hermesEnd = section.indexOf("</AgentOnly>", hermesStart); | ||
|
|
||
| expect(hermesStart).toBeGreaterThanOrEqual(0); | ||
| expect(hermesEnd).toBeGreaterThan(hermesStart); | ||
| return section.slice(hermesStart, hermesEnd); | ||
| } | ||
|
|
||
| describe("Hermes API bearer token lifecycle documentation (#7175)", () => { | ||
| it("distinguishes stable restarts from key-generating replacement operations", () => { | ||
| const commands = readHermesGatewayTokenSection(); | ||
|
|
||
| expect(commands).toContain("generated once for each sandbox home"); | ||
| expect(commands).toContain("Different sandbox homes receive different tokens"); | ||
| expect(commands).toContain( | ||
| "gateway restart, sandbox stop and start, and host OpenShell gateway restart", | ||
| ); | ||
| expect(commands).toContain("rebuild or replace the sandbox"); | ||
| expect(commands).toContain("missing or is not exactly 64 lowercase hexadecimal characters"); | ||
| expect(commands).toContain("while the existing `API_SERVER_KEY` was present and valid"); | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| }); | ||
|
|
||
| it("points rebuild operators to supported token retrieval", () => { | ||
| const commands = readHermesGatewayTokenSection(); | ||
| const rebuildGuide = readDoc(REBUILD_GUIDE_PATH); | ||
| const quickstart = readDoc(QUICKSTART_PATH); | ||
|
|
||
| expect(commands).toContain("nemohermes my-assistant gateway-token --quiet"); | ||
| expect(rebuildGuide).toContain("$$nemoclaw <sandbox-name> gateway-token --quiet"); | ||
| expect(commands).toContain("replacement home receives a new token"); | ||
| expect(rebuildGuide).toContain("new Hermes API bearer token"); | ||
| expect(commands).toContain("Treat the token like a password"); | ||
| expect(commands).toContain("The sandbox must be running"); | ||
| expect(commands).toContain("instead of reading or editing `.hermes/.env` directly"); | ||
| expect(quickstart).toContain("nemohermes my-hermes gateway-token --quiet"); | ||
| expect(quickstart).not.toContain("bearer token from the generated Hermes environment"); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.