Repository navigation
fix(messaging): fix Hermes messaging after upgrade - #5837
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughHermes now reads runtime-plan aliases during placeholder refresh, threads the plan path through startup, and preserves Slack alias metadata through manifest compilation and runtime-plan generation. ChangesHermes runtime alias plumbing
Sequence Diagram(s)sequenceDiagram
participant StartSh as start.sh
participant RuntimeGuard as runtime-config-guard.py
participant BoundaryValidator as validate-env-secret-boundary.py
StartSh->>RuntimeGuard: provider-placeholders --runtime-plan <path> --boundary-validator <script>
RuntimeGuard->>RuntimeGuard: load runtime plan and rewrite .env
RuntimeGuard->>BoundaryValidator: validate updated env text
BoundaryValidator-->>RuntimeGuard: validation result
RuntimeGuard-->>StartSh: refresh status and normalized messages
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most covered files.
Updated |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
Vitest E2E Scenario RecommendationRequired Vitest E2E scenarios: Dispatch required Vitest E2E scenarios:
Full Vitest E2E advisor summaryVitest E2E Scenario AdvisorBase: Required Vitest E2E scenarios
Optional Vitest E2E scenarios
Relevant changed files
|
PR Review Advisor — Changes requestedMerge posture: Do not merge yet Action checklist
Findings index
Review findings by urgency: 0 required fixes, 6 items to resolve/justify, 0 in-scope improvements
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
agents/hermes/start.sh (1)
1184-1201: 🩺 Stability & Availability | 🔵 TrivialRe-run the Hermes Slack/runtime lanes for this startup handoff.
This function is now the point where the baked runtime artifact feeds placeholder refresh, so it is worth validating the Slack alias and rebuild paths that exercise startup and credential re-attachment.
As per path instructions,agents/hermes/**changes should be validated with the Hermes E2E jobs, and the referenced workflow docs call outhermes-slack-e2e,messaging-providers-e2e, andchannels-stop-start-hermes-e2efor Slack alias regressions.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@agents/hermes/start.sh` around lines 1184 - 1201, Re-run the Hermes E2E validation for this startup handoff because the change sits in the placeholder-refresh path used by startup and credential re-attachment. Verify the `provider-placeholders` flow in `start.sh` together with the Slack alias and rebuild behavior by exercising `hermes-slack-e2e`, `messaging-providers-e2e`, and `channels-stop-start-hermes-e2e`, since those lanes cover the impacted startup/runtime paths.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@agents/hermes/runtime-config-guard.py`:
- Around line 361-368: The _runtime_plan_alias_replacements helper currently
opens the runtime-plan path directly after an os.path.isfile check, which
bypasses the same safe-file protections used elsewhere in Hermes. Update this
flow to use the existing guarded open logic from the config-reading path (for
example the _open_regular-based approach) or otherwise restrict it to the baked
runtime-plan location, and keep the UnsafePathError handling in
_runtime_plan_alias_replacements for invalid reads.
---
Nitpick comments:
In `@agents/hermes/start.sh`:
- Around line 1184-1201: Re-run the Hermes E2E validation for this startup
handoff because the change sits in the placeholder-refresh path used by startup
and credential re-attachment. Verify the `provider-placeholders` flow in
`start.sh` together with the Slack alias and rebuild behavior by exercising
`hermes-slack-e2e`, `messaging-providers-e2e`, and
`channels-stop-start-hermes-e2e`, since those lanes cover the impacted
startup/runtime paths.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: e42aa6b2-99a6-42c8-81ef-666d75a7ce01
📒 Files selected for processing (7)
agents/hermes/Dockerfileagents/hermes/runtime-config-guard.pyagents/hermes/start.shsrc/lib/messaging/channels/slack/manifest.tssrc/lib/messaging/compiler/manifest-compiler.test.tstest/hermes-runtime-api-key.test.tstest/messaging-build-applier.test.ts
Selective E2E Results — ✅ All requested jobs passedRun: 28217519835
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
agents/hermes/start.sh (1)
1184-1201: 🩺 Stability & Availability | 🔵 TrivialRun the Hermes startup-path E2Es for this change.
This touches the Hermes startup placeholder refresh path, so I’d queue the Hermes nightly jobs that cover onboard + Slack placeholder behavior before merge, especially
hermes-e2e,hermes-slack-e2e, andhermes-inference-switch-e2e.As per path instructions, "Changes affect multi-agent onboarding, health probes, and inference routing" and the listed Hermes E2Es are the recommended validation set.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@agents/hermes/start.sh` around lines 1184 - 1201, Run the Hermes startup-path end-to-end validation for this placeholder refresh change: the update in start.sh affects the startup placeholder refresh flow around the provider-placeholders guard and runtime-plan handling, so queue the Hermes nightly coverage before merge, especially hermes-e2e, hermes-slack-e2e, and hermes-inference-switch-e2e, to confirm onboarding and Slack placeholder behavior still work as expected.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@agents/hermes/start.sh`:
- Around line 1184-1201: Run the Hermes startup-path end-to-end validation for
this placeholder refresh change: the update in start.sh affects the startup
placeholder refresh flow around the provider-placeholders guard and runtime-plan
handling, so queue the Hermes nightly coverage before merge, especially
hermes-e2e, hermes-slack-e2e, and hermes-inference-switch-e2e, to confirm
onboarding and Slack placeholder behavior still work as expected.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: be082b28-41cc-498b-81cd-4d878be8006b
📒 Files selected for processing (1)
agents/hermes/start.sh
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@agents/hermes/runtime-config-guard.py`:
- Around line 365-368: The boundary validator subprocess in the placeholder
refresh path can hang and block Hermes startup, so add a timeout to the
subprocess.run call in the boundary validation flow and handle
subprocess.TimeoutExpired by raising UnsafePathError. Update the logic around
the runtime-config guard’s boundary validator invocation so it uses the same
safe failure path as other validation errors, and keep the change localized to
the code that launches the validator subprocess.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: ed6f0231-6db1-437f-a672-b66afe1021ea
📒 Files selected for processing (5)
agents/hermes/runtime-config-guard.pyagents/hermes/start.shsrc/lib/messaging/channels/slack/manifest.tstest/hermes-runtime-api-key.test.tstest/messaging-build-applier.test.ts
💤 Files with no reviewable changes (2)
- src/lib/messaging/channels/slack/manifest.ts
- test/messaging-build-applier.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- test/hermes-runtime-api-key.test.ts
Selective E2E Results — ❌ Some jobs failedRun: 28219927704
|
1 similar comment
Selective E2E Results — ❌ Some jobs failedRun: 28219927704
|
Selective E2E Results — ✅ All requested jobs passedRun: 28222775699
|
## Summary - follow up merged PR #5837 by addressing the PR Review Advisor source-of-truth/security/test follow-ups - restrict Hermes provider-placeholder fallback to runtime-plan credential bindings once a reduced runtime plan is present, avoiding arbitrary `.env` key rewrites such as `API_SERVER_KEY` - keep the useful PR #5866 pieces: shared `.env` upsert/dedupe helper, duplicate `API_SERVER_KEY` cleanup without reminting, missing provider placeholder append, and no-op hash stability - document the Slack alias compatibility boundary in the Slack manifest and assert the baked Hermes runtime-plan artifact is safe/reduced in the image - fix the current main TypeScript compile regression in `detectMessagingChannelsFromEnv` by passing the manifest list to `getMessagingManifestAvailabilityContext` ## Validation - `python3 -m py_compile agents/hermes/runtime-config-guard.py` - `npm run build:cli` - `npm test -- --run test/hermes-runtime-api-key.test.ts test/messaging-build-applier.test.ts src/lib/messaging/compiler/manifest-compiler.test.ts` ## Notes - Full pre-push `test-cli` was attempted but hit unrelated local-environment failures/timeouts (missing `../nemoclaw/dist/blueprint/private-networks.js`, missing `nemoclaw/node_modules/json5`, local Docker/OpenShell/CLI timeout tests). Targeted tests and TypeScript build pass. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved messaging channel availability detection using the built-in channel manifest list. * Prevents duplicate `.env` entries by upserting targeted `KEY=VALUE` assignments while preserving the first occurrence. * Fixes Hermes runtime API key refresh flow so “updated” outcomes succeed correctly. * Tightens runtime placeholder/env-key validation to reject malformed or unsafe updates before any `.env` rewrite. * **Documentation** * Clarified Slack runtime placeholder alias behavior with compatibility-boundary guidance. * **Tests / CI** * Expanded Hermes runtime placeholder refresh and strict-hash assertions with deterministic fixtures, including negative and deduplication scenarios. * Added a functional check that the runtime plan artifact is not written when messaging isn’t configured. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
<!-- markdownlint-disable MD041 --> ## Summary Fixes the Hermes Slack messaging regression introduced by the Hermes upgrade by applying manifest-owned runtime env aliases during Hermes startup. This keeps Slack provider placeholders in Bolt-compatible `xoxb-` / `xapp-` shape while preserving the generic messaging runtime setup flow. ## Changes - Reuses Slack runtime env alias metadata for both OpenClaw and Hermes in the Slack channel manifest. - Bakes the reduced messaging runtime plan into the Hermes image and passes it to the Hermes runtime config guard. - Applies active manifest-owned runtime aliases when safely refreshing `.hermes/.env`, with canonical placeholder normalization retained as fallback. - Adds compiler, runtime artifact, and Hermes runtime guard coverage for the Slack alias path. ## Type of Change - [x] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates <!-- Check all that apply. For any "covered by existing tests", "not applicable", or waiver entry, add a brief justification on the same line or in the Changes section. --> - [x] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [ ] Tests not applicable — justification: - [ ] Docs updated for user-facing behavior changes - [x] Docs not applicable — justification: internal runtime placeholder plumbing; existing Slack docs already describe runtime placeholder normalization. - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [x] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: self-reviewed manifest-first runtime alias handling; Slack-specific alias values remain in the Slack manifest and runtime guard application remains generic. - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Verification <!-- Check each item you ran and confirmed. Leave unchecked items you skipped. Doc-only changes do not require npm test unless you ran it. --> - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [ ] Git hooks passed during commit and push, or `npx prek run --from-ref main --to-ref HEAD` passes - [x] Targeted tests pass for changed behavior - [ ] Full `npm test` passes (broad runtime changes only) - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) - [ ] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) --- <!-- DCO sign-off is required in this PR description, and every commit must appear as Verified in GitHub. Run: git config user.name && git config user.email --> Signed-off-by: San Dang <[email protected]> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Hermes provider placeholder refresh can now use a messaging runtime plan to consistently normalize Slack bot/app token aliases. * Hermes build artifacts now bake reduced messaging runtime metadata to keep alias behavior aligned. * **Bug Fixes** * Centralized Slack runtime alias normalization and improved “Normalized …” messaging during refresh. * Preserves `runtimeSetup.envAliases` when generating reduced runtime plan artifacts. * Adds validation to reject unsafe or symlinked runtime plans and strengthens `.env` boundary validation. * **Tests** * Added coverage for runtime-plan-driven alias refresh, preserved `envAliases`, and refusing symlinked plans. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…#5866) ## Summary - follow up merged PR NVIDIA#5837 by addressing the PR Review Advisor source-of-truth/security/test follow-ups - restrict Hermes provider-placeholder fallback to runtime-plan credential bindings once a reduced runtime plan is present, avoiding arbitrary `.env` key rewrites such as `API_SERVER_KEY` - keep the useful PR NVIDIA#5866 pieces: shared `.env` upsert/dedupe helper, duplicate `API_SERVER_KEY` cleanup without reminting, missing provider placeholder append, and no-op hash stability - document the Slack alias compatibility boundary in the Slack manifest and assert the baked Hermes runtime-plan artifact is safe/reduced in the image - fix the current main TypeScript compile regression in `detectMessagingChannelsFromEnv` by passing the manifest list to `getMessagingManifestAvailabilityContext` ## Validation - `python3 -m py_compile agents/hermes/runtime-config-guard.py` - `npm run build:cli` - `npm test -- --run test/hermes-runtime-api-key.test.ts test/messaging-build-applier.test.ts src/lib/messaging/compiler/manifest-compiler.test.ts` ## Notes - Full pre-push `test-cli` was attempted but hit unrelated local-environment failures/timeouts (missing `../nemoclaw/dist/blueprint/private-networks.js`, missing `nemoclaw/node_modules/json5`, local Docker/OpenShell/CLI timeout tests). Targeted tests and TypeScript build pass. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved messaging channel availability detection using the built-in channel manifest list. * Prevents duplicate `.env` entries by upserting targeted `KEY=VALUE` assignments while preserving the first occurrence. * Fixes Hermes runtime API key refresh flow so “updated” outcomes succeed correctly. * Tightens runtime placeholder/env-key validation to reject malformed or unsafe updates before any `.env` rewrite. * **Documentation** * Clarified Slack runtime placeholder alias behavior with compatibility-boundary guidance. * **Tests / CI** * Expanded Hermes runtime placeholder refresh and strict-hash assertions with deterministic fixtures, including negative and deduplication scenarios. * Added a functional check that the runtime plan artifact is not written when messaging isn’t configured. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Summary
Fixes the Hermes Slack messaging regression introduced by the Hermes upgrade by applying manifest-owned runtime env aliases during Hermes startup. This keeps Slack provider placeholders in Bolt-compatible
xoxb-/xapp-shape while preserving the generic messaging runtime setup flow.Changes
.hermes/.env, with canonical placeholder normalization retained as fallback.Type of Change
Quality Gates
Verification
Verifiedin GitHubnpx prek run --from-ref main --to-ref HEADpassesnpm testpasses (broad runtime changes only)npm run docsbuilds without warnings (doc changes only)Signed-off-by: San Dang [email protected]
Summary by CodeRabbit
runtimeSetup.envAliaseswhen generating reduced runtime plan artifacts..envboundary validation.envAliases, and refusing symlinked plans.