Skip to content

fix(messaging): fix Hermes messaging after upgrade - #5837

Merged
jyaunches merged 10 commits into
mainfrom
fix/hermes-messaging-after-upgrade
Jun 26, 2026
Merged

jyaunches merged 10 commits into
mainfrom
fix/hermes-messaging-after-upgrade

Conversation

@sandl99

@sandl99 sandl99 commented Jun 26, 2026 •

Copy link
Copy Markdown
Collaborator

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

  • 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

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: internal runtime placeholder plumbing; existing Slack docs already describe runtime placeholder normalization.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • 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

  • 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
  • Targeted tests pass for changed behavior
  • Full npm test passes (broad runtime changes only)
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: San Dang [email protected]

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.

@sandl99 sandl99 self-assigned this Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Hermes 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.

Changes

Hermes runtime alias plumbing

Layer / File(s) Summary
Runtime plan artifact
src/lib/messaging/channels/slack/manifest.ts, src/lib/messaging/compiler/manifest-compiler.test.ts, test/messaging-build-applier.test.ts, agents/hermes/Dockerfile
slackRuntimeEnvAliases centralizes Slack token alias entries, the manifest compiler test asserts them in plan.runtimeSetup.envAliases, the build-applier test checks the reduced runtime plan preserves that field, and the Hermes Dockerfile runs the runtime-setup build applier.
Runtime plan validation
agents/hermes/runtime-config-guard.py
Adds JSON runtime-plan parsing, alias validation for active channels, regex and control-character checks, and runtime-plan replacement lookup for provider placeholders.
Runtime placeholder refresh
agents/hermes/runtime-config-guard.py, agents/hermes/start.sh, test/hermes-runtime-api-key.test.ts
provider_placeholders accepts --runtime-plan, prefers runtime-plan replacements during .env rewrites, prints normalized messages, start.sh passes the runtime plan path, and the Hermes runtime API key test covers the new invocation path.

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • cv

Poem

A rabbit hopped through runtime light,
With Slack tokens tucked in neat and right.
Hermes hummed, the carrots gleamed,
And alias messages softly beamed. 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and matches the main change: a Hermes messaging fix related to the upgrade.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/hermes-messaging-after-upgrade

Comment @coderabbitai help to get the list of available commands.

@github-code-quality

github-code-quality Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in the fix/hermes-messaging... branch is 96%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main fix/hermes-messaging... 819c787 +/-
nemoclaw/src/se...cret-scanner.ts — 100% —
nemoclaw/src/commands/slash.ts — 100% —
nemoclaw/src/li...bprocess-env.ts — 100% —
nemoclaw/src/bl...eprint/state.ts — 98% —
nemoclaw/src/onboard/config.ts — 98% —
nemoclaw/src/bl...int/snapshot.ts — 97% —
nemoclaw/src/bl...print/runner.ts — 95% —
nemoclaw/src/co...ration-state.ts — 94% —
nemoclaw/src/bl...ate-networks.ts — 94% —
nemoclaw/src/index.ts — 94% —

TypeScript / code-coverage/cli

The overall coverage in the fix/hermes-messaging... branch is 47%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main fix/hermes-messaging... 819c787 +/-
src/lib/state/o...oard-session.ts — 91% —
src/lib/actions...dbox/rebuild.ts — 72% —
src/lib/sandbox/config.ts — 72% —
src/lib/onboard/preflight.ts — 62% —
src/lib/shields/index.ts — 62% —
src/lib/actions...licy-channel.ts — 60% —
src/lib/state/sandbox.ts — 56% —
src/lib/policy/index.ts — 48% —
src/lib/onboard...er-gpu-patch.ts — 47% —
src/lib/onboard.ts — 19% —

Updated June 26, 2026 06:42 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@sandl99 sandl99 added area: messaging Messaging channels, bridges, manifests, or channel lifecycle integration: hermes Hermes integration behavior bug-fix PR fixes a bug or regression v0.0.69 labels Jun 26, 2026
@github-actions

github-actions Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: hermes-slack-vitest, hermes-sandbox-secret-boundary-vitest, rebuild-hermes-vitest
Optional E2E: hermes-e2e-vitest, channels-stop-start-vitest, messaging-providers-vitest

Dispatch hint: hermes-slack-vitest,hermes-sandbox-secret-boundary-vitest,rebuild-hermes-vitest

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • hermes-slack-vitest (high): Directly covers the changed Hermes Slack provider placeholder, policy, secret-boundary, and Python Slack egress contracts in a real Docker/OpenShell/Hermes sandbox.
  • hermes-sandbox-secret-boundary-vitest (high): Required because the Hermes runtime-config guard and entrypoint now validate rewritten .env content and enforce the startup secret boundary; this job probes image and startup secret-boundary behavior in a real Hermes sandbox.
  • rebuild-hermes-vitest (high): Required because the Hermes Dockerfile now bakes a messaging runtime-plan artifact and changes the image build/runtime setup sequence; this job preserves real install, Hermes rebuild, messaging-placeholder, registry, and backup hygiene coverage.

Optional E2E

  • hermes-e2e-vitest (high): Useful broader confidence for the hosted Hermes assistant flow after entrypoint/runtime config changes, but less targeted than the Slack and secret-boundary jobs.
  • channels-stop-start-vitest (high): Adjacent coverage for Hermes messaging channel stop/start, rebuild, provider reuse, policy-list, and in-sandbox config contracts after changing runtime aliases and messaging runtime setup metadata.
  • messaging-providers-vitest (high): Optional cross-channel provider/placeholder regression coverage for the messaging provider pipeline; the required Hermes Slack job is more directly aligned to this PR.

New E2E recommendations

  • Hermes messaging runtime-plan tamper resistance (medium): Existing required jobs cover real Hermes startup and Slack placeholder behavior, but there is no clearly dedicated live E2E that plants an unsafe or symlinked baked messaging-runtime-plan artifact inside a Hermes image/sandbox and verifies startup fails closed before .env mutation.
    • Suggested test: Add a Hermes runtime-plan tamper E2E scenario that builds or prepares a Hermes sandbox with a malicious/symlinked messaging-runtime-plan.json and asserts provider placeholder refresh refuses to mutate .env and preserves config hashes.

Dispatch hint

  • Workflow: .github/workflows/e2e-vitest-scenarios.yaml
  • jobs input: hermes-slack-vitest,hermes-sandbox-secret-boundary-vitest,rebuild-hermes-vitest

@github-actions

github-actions Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

Vitest E2E Scenario Recommendation

Required Vitest E2E scenarios: hermes-slack-vitest, hermes-sandbox-secret-boundary-vitest
Optional Vitest E2E scenarios: hermes-root-entrypoint-smoke-vitest, messaging-providers-vitest

Dispatch required Vitest E2E scenarios:

  • gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=hermes-slack-vitest
  • gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=hermes-sandbox-secret-boundary-vitest

Workflow run

Full Vitest E2E advisor summary

Vitest E2E Scenario Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required Vitest E2E scenarios

  • hermes-slack-vitest: Hermes Slack runtime placeholder normalization now depends on manifest-owned Hermes envAliases, the baked messaging runtime plan, and runtime-config-guard provider placeholder refresh. The wired Hermes Slack live Vitest job exercises Hermes Slack onboarding, placeholder/provider handling, secret-boundary behavior, policy, and egress through the real workflow job.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=hermes-slack-vitest
  • hermes-sandbox-secret-boundary-vitest: The PR changes Hermes runtime-config-guard secret-boundary validation, start.sh provider placeholder refresh, and Dockerfile runtime setup. This job is the focused live Docker/image-boundary smoke for Hermes sandbox secret-boundary contracts, including allowed Slack placeholder aliases and startup rejection of raw secret-shaped values.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=hermes-sandbox-secret-boundary-vitest

Optional Vitest E2E scenarios

  • hermes-root-entrypoint-smoke-vitest: Adjacent coverage for the changed Hermes Dockerfile and start.sh root entrypoint path. Useful if maintainers want an additional image-build/startup smoke beyond the Slack and secret-boundary focused jobs.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=hermes-root-entrypoint-smoke-vitest
  • messaging-providers-vitest: Adjacent messaging provider coverage for Slack provider placeholder and redaction behavior across the messaging provider flow; optional because the primary affected live Hermes Slack path is covered by hermes-slack-vitest.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref> --field jobs=messaging-providers-vitest

Relevant changed files

  • agents/hermes/Dockerfile
  • agents/hermes/runtime-config-guard.py
  • agents/hermes/start.sh
  • src/lib/messaging/channels/slack/manifest.ts

@github-actions

github-actions Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

PR Review Advisor — Changes requested

Merge posture: Do not merge yet
Primary next action: Resolve or justify PRA-1: Source-of-truth review needed: Hermes Slack runtime env alias normalization.
Open items: 0 required · 6 warnings · 0 suggestions · 8 test follow-ups
Since last review: 0 prior items resolved · 6 still apply · 0 new items found

Action checklist

  • PRA-1 Resolve or justify: Source-of-truth review needed: Hermes Slack runtime env alias normalization
  • PRA-2 Resolve or justify: Source-of-truth review needed: Canonical provider placeholder fallback
  • PRA-3 Resolve or justify: Canonical fallback still rewrites arbitrary Hermes .env keys in agents/hermes/runtime-config-guard.py:524
  • PRA-4 Resolve or justify: Document and negatively test the Hermes Slack alias compatibility boundary in src/lib/messaging/channels/slack/manifest.ts:6
  • PRA-5 Resolve or justify: Add negative credential-boundary tests for rejected runtime-plan aliases in agents/hermes/runtime-config-guard.py:443
  • PRA-6 Resolve or justify: Validate the baked Hermes messaging runtime plan artifact in the runtime image in agents/hermes/Dockerfile:190
  • PRA-T1 Add or justify test follow-up: Runtime validation
  • PRA-T2 Add or justify test follow-up: Runtime validation
  • PRA-T3 Add or justify test follow-up: Runtime validation
  • PRA-T4 Add or justify test follow-up: Runtime validation
  • PRA-T5 Add or justify test follow-up: Runtime validation
  • PRA-T6 Add or justify test follow-up: Add negative credential-boundary tests for rejected runtime-plan aliases
  • PRA-T7 Add or justify test follow-up: Validate the baked Hermes messaging runtime plan artifact in the runtime image
  • PRA-T8 Add or justify test follow-up: Hermes Slack runtime env alias normalization

Findings index

ID Severity Category Location Required action
PRA-1 Resolve/justify architecture — Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
PRA-2 Resolve/justify architecture — Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
PRA-3 Resolve/justify security agents/hermes/runtime-config-guard.py:524 Restrict fallback normalization to known provider credential keys. Prefer deriving the allowed set from the reduced runtime plan `credentialBindings.providerEnvKey`, plus a minimal explicit legacy allowlist for pre-runtime-plan provider tokens that still need compatibility. Keep runtime-plan `envAliases` as the generic mechanism for channel-specific rewrites.
PRA-4 Resolve/justify architecture src/lib/messaging/channels/slack/manifest.ts:6 Add a short comment near `slackRuntimeEnvAliases` or the Hermes runtime guard handoff describing the invalid placeholder state, the authoritative manifest/runtime-plan source, why runtime normalization is still required, and the removal condition. Add negative tests for Slack inactive, channel-level `disabled: true`, and `disabledChannels` suppression.
PRA-5 Resolve/justify tests agents/hermes/runtime-config-guard.py:443 Keep the direct temp-file/spawn harness and add focused negative tests for raw-secret alias values, control characters in alias values/messages, and invalid regexes. Assert the guard exits non-zero, leaves `.env` unchanged, and leaves the trusted hash valid for the original file.
PRA-6 Resolve/justify tests agents/hermes/Dockerfile:190 Add a small direct Dockerfile assertion after the runtime-setup `RUN`, or a focused runtime-image validation, that checks the default artifact path exists when messaging metadata is expected, is a regular non-symlink root-owned file, is not group/world writable, and contains only the reduced JSON shape.
Review findings by urgency: 0 required fixes, 6 items to resolve/justify, 0 in-scope improvements

⚠️ Resolve or justify before merge

Investigate these in the current review; either fix them, explain why they are not applicable, or document the accepted risk.

PRA-1 Resolve/justify — Source-of-truth review needed: Hermes Slack runtime env alias normalization

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: The active Slack rewrite is tested, but inactive Slack, channel-level `disabled: true`, and `disabledChannels` suppression are not tested.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: Covered by the architecture finding on `src/lib/messaging/channels/slack/manifest.ts`: manifest-owned aliases are consumed by the Hermes runtime plan, but the compatibility/removal contract and disabled-channel negative tests are missing.

PRA-2 Resolve/justify — Source-of-truth review needed: Canonical provider placeholder fallback

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: A positive Discord normalization test exists; a negative test proving `API_SERVER_KEY` and unrelated keys are not rewritten is missing.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: Covered by the security finding on `agents/hermes/runtime-config-guard.py`: line 524 computes a normalized replacement from `os.environ` using the parsed `.env` key without first checking that the key is a provider credential binding or explicit legacy provider-token key.

PRA-3 Resolve/justify — Canonical fallback still rewrites arbitrary Hermes .env keys

  • Location: agents/hermes/runtime-config-guard.py:524
  • Category: security
  • Problem: `provider_placeholders()` still falls back to `_normalize_provider_placeholder_for_env_key(os.environ.get(key, ""), key)` for every parsed assignment in `.hermes/.env` that is not already covered by the runtime plan. Any key in `.env` can therefore be replaced and hash-trusted when the runtime environment contains `openshell:resolve:env:<KEY>` or a versioned equivalent.
  • Impact: Ambient runtime environment becomes a broad configuration authority instead of a provider-credential-only compatibility path. In particular, `API_SERVER_KEY` is Hermes API authentication material, and the boundary validator permits placeholder-shaped values, so this fallback can replace the locally minted bearer key with a resolver placeholder and refresh trusted hashes.
  • Recommended action: Restrict fallback normalization to known provider credential keys. Prefer deriving the allowed set from the reduced runtime plan `credentialBindings.providerEnvKey`, plus a minimal explicit legacy allowlist for pre-runtime-plan provider tokens that still need compatibility. Keep runtime-plan `envAliases` as the generic mechanism for channel-specific rewrites.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read `agents/hermes/runtime-config-guard.py` around `provider_placeholders()` and confirm the fallback is only attempted after the parsed key is checked against provider credential bindings or an explicit legacy provider-token allowlist.
  • Missing regression test: Add `provider-placeholders does not rewrite API_SERVER_KEY or unrelated .env keys from runtime env fallback unless the key is an allowed provider credential binding`: create `.env` with a generated `API_SERVER_KEY` and an `UNRELATED_TOKEN`, set matching runtime env placeholders, run the guard, and assert those lines and the trusted hash remain unchanged unless the key appears in `credentialBindings.providerEnvKey`.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read `agents/hermes/runtime-config-guard.py` around `provider_placeholders()` and confirm the fallback is only attempted after the parsed key is checked against provider credential bindings or an explicit legacy provider-token allowlist.
  • Evidence: The new boundary-validation step validates the candidate `.env`, but `validate-env-secret-boundary.py` accepts `openshell:resolve:env:*` values generally, so it does not prevent `API_SERVER_KEY=openshell:resolve:env:API_SERVER_KEY` from being trusted.

PRA-4 Resolve/justify — Document and negatively test the Hermes Slack alias compatibility boundary

  • Location: src/lib/messaging/channels/slack/manifest.ts:6
  • Category: architecture
  • Problem: The PR moves Slack alias metadata into a shared manifest constant and applies it to Hermes through the reduced runtime plan, but the changed source still does not document the compatibility contract: which invalid placeholder shape is being normalized, why the render/source cannot emit the final Slack-shaped placeholder, which source owns the allowed aliases, and when the runtime rewrite can be removed.
  • Impact: Without an explicit source/removal contract and disabled-channel coverage, the startup `.env` rewrite can become a second messaging configuration authority. Future manifest or planner changes could accidentally apply Slack-only alias recovery to inactive or disabled channels, or preserve a workaround where the compiler/render source should be fixed instead.
  • Recommended action: Add a short comment near `slackRuntimeEnvAliases` or the Hermes runtime guard handoff describing the invalid placeholder state, the authoritative manifest/runtime-plan source, why runtime normalization is still required, and the removal condition. Add negative tests for Slack inactive, channel-level `disabled: true`, and `disabledChannels` suppression.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect `src/lib/messaging/channels/slack/manifest.ts` around `slackRuntimeEnvAliases`, `src/lib/messaging/compiler/engines/runtime-setup-engine.ts` around `planRuntimeSetup()`, and `agents/hermes/runtime-config-guard.py` around `_runtime_plan_alias_replacements()` for a documented contract and disabled-channel test evidence.
  • Missing regression test: Add `provider-placeholders ignores Slack envAliases when Slack is inactive, channel disabled, or listed in disabledChannels`: run the guard with each suppressed channel shape and assert `SLACK_BOT_TOKEN`/`SLACK_APP_TOKEN` remain unchanged and the trusted hash stays valid.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect `src/lib/messaging/channels/slack/manifest.ts` around `slackRuntimeEnvAliases`, `src/lib/messaging/compiler/engines/runtime-setup-engine.ts` around `planRuntimeSetup()`, and `agents/hermes/runtime-config-guard.py` around `_runtime_plan_alias_replacements()` for a documented contract and disabled-channel test evidence.
  • Evidence: `slackRuntimeEnvAliases` is manifest-owned and the guard gates aliases by active/non-disabled channels, but the changed tests only cover the active Slack rewrite and symlinked runtime-plan rejection.

PRA-5 Resolve/justify — Add negative credential-boundary tests for rejected runtime-plan aliases

  • Location: agents/hermes/runtime-config-guard.py:443
  • Category: tests
  • Problem: The guard now rejects unsafe alias values/messages and invalid regexes before writing `.env`, and it validates the resulting `.env` with the secret-boundary validator. The current tests cover the positive Slack alias path and symlinked runtime plans, but they do not exercise these rejection branches.
  • Impact: A future change could silently weaken alias value validation, leak a raw Slack token into `.env`, print a forged multiline log message, or refresh trusted hashes after a rejected runtime-plan alias without any focused regression failure.
  • Recommended action: Keep the direct temp-file/spawn harness and add focused negative tests for raw-secret alias values, control characters in alias values/messages, and invalid regexes. Assert the guard exits non-zero, leaves `.env` unchanged, and leaves the trusted hash valid for the original file.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect `test/hermes-runtime-api-key.test.ts` for tests named around raw-secret alias values, control characters, invalid regexes, unchanged `.env`, and unchanged trusted hash after guard failure.
  • Missing regression test: Add three tests: `provider-placeholders rejects runtime-plan alias raw secret values and leaves .env and trusted hash unchanged`, `provider-placeholders rejects runtime-plan alias control characters in value or message and leaves .env and trusted hash unchanged`, and `provider-placeholders rejects invalid runtime-plan alias regex and leaves .env and trusted hash unchanged`.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect `test/hermes-runtime-api-key.test.ts` for tests named around raw-secret alias values, control characters, invalid regexes, unchanged `.env`, and unchanged trusted hash after guard failure.
  • Evidence: `_runtime_plan_alias_replacements()` validates control characters and regex syntax, and `_validate_env_text_with_boundary()` rejects boundary violations, but the changed test inventory only includes the active Slack rewrite and symlinked runtime-plan negative case.

PRA-6 Resolve/justify — Validate the baked Hermes messaging runtime plan artifact in the runtime image

  • Location: agents/hermes/Dockerfile:190
  • Category: tests
  • Problem: The Dockerfile now bakes the reduced messaging runtime plan before Hermes agent-install hooks, and the runtime guard consumes `/usr/local/share/nemoclaw/messaging-runtime-plan.json` at startup. The tests validate the applier's reduced artifact shape, but not the image-level path, ownership, file type, or permissions that the entrypoint depends on.
  • Impact: If the Docker build writes the artifact to an unexpected path, leaves it absent, makes it writable, or includes unreduced plan data, Hermes startup may silently fall back to broad env normalization or consume mutable/tampered runtime metadata.
  • Recommended action: Add a small direct Dockerfile assertion after the runtime-setup `RUN`, or a focused runtime-image validation, that checks the default artifact path exists when messaging metadata is expected, is a regular non-symlink root-owned file, is not group/world writable, and contains only the reduced JSON shape.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect `agents/hermes/Dockerfile` after the runtime-setup `RUN` or a focused image validation test for checks on `/usr/local/share/nemoclaw/messaging-runtime-plan.json` existence, type, owner, permissions, and reduced keys.
  • Missing regression test: Add `Hermes runtime image contains a regular non-symlink root-owned 0644 reduced messaging runtime plan at /usr/local/share/nemoclaw/messaging-runtime-plan.json` and assert no `agentRender`, `buildSteps`, raw placeholders, or install-only fields are present.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect `agents/hermes/Dockerfile` after the runtime-setup `RUN` or a focused image validation test for checks on `/usr/local/share/nemoclaw/messaging-runtime-plan.json` existence, type, owner, permissions, and reduced keys.
  • Evidence: `test/messaging-build-applier.test.ts` now checks reduced artifact generation and Hermes `envAliases` preservation, but the Dockerfile change itself has no image-path validation.

💡 In-scope improvements

These are lower-risk, not throwaway. Prefer fixing them in this PR when they are local to changed code; defer only with rationale or a linked follow-up.

  • None.
Test follow-ups to resolve or justify

If these cover changed behavior, prefer adding them in this PR; otherwise state why existing coverage is enough or link the follow-up.

  • PRA-T1 Runtime validation — provider-placeholders does not rewrite API_SERVER_KEY or unrelated .env keys from runtime env fallback unless the key is an allowed provider credential binding. The PR changes Hermes Docker/runtime startup, secret-boundary-sensitive `.env` mutation, and manifest-driven runtime metadata. Direct unit-style tests cover part of the behavior, but runtime/sandbox validation remains advisable for the baked artifact and negative credential-boundary paths.
  • PRA-T2 Runtime validation — provider-placeholders rejects runtime-plan alias raw secret values and leaves .env and trusted hash unchanged. The PR changes Hermes Docker/runtime startup, secret-boundary-sensitive `.env` mutation, and manifest-driven runtime metadata. Direct unit-style tests cover part of the behavior, but runtime/sandbox validation remains advisable for the baked artifact and negative credential-boundary paths.
  • PRA-T3 Runtime validation — provider-placeholders rejects runtime-plan alias control characters in value or message and leaves .env and trusted hash unchanged. The PR changes Hermes Docker/runtime startup, secret-boundary-sensitive `.env` mutation, and manifest-driven runtime metadata. Direct unit-style tests cover part of the behavior, but runtime/sandbox validation remains advisable for the baked artifact and negative credential-boundary paths.
  • PRA-T4 Runtime validation — provider-placeholders rejects invalid runtime-plan alias regex and leaves .env and trusted hash unchanged. The PR changes Hermes Docker/runtime startup, secret-boundary-sensitive `.env` mutation, and manifest-driven runtime metadata. Direct unit-style tests cover part of the behavior, but runtime/sandbox validation remains advisable for the baked artifact and negative credential-boundary paths.
  • PRA-T5 Runtime validation — provider-placeholders ignores Slack envAliases when Slack is inactive, channel disabled, or listed in disabledChannels. The PR changes Hermes Docker/runtime startup, secret-boundary-sensitive `.env` mutation, and manifest-driven runtime metadata. Direct unit-style tests cover part of the behavior, but runtime/sandbox validation remains advisable for the baked artifact and negative credential-boundary paths.
  • PRA-T6 Add negative credential-boundary tests for rejected runtime-plan aliases — Keep the direct temp-file/spawn harness and add focused negative tests for raw-secret alias values, control characters in alias values/messages, and invalid regexes. Assert the guard exits non-zero, leaves `.env` unchanged, and leaves the trusted hash valid for the original file.
  • PRA-T7 Validate the baked Hermes messaging runtime plan artifact in the runtime image — Add a small direct Dockerfile assertion after the runtime-setup `RUN`, or a focused runtime-image validation, that checks the default artifact path exists when messaging metadata is expected, is a regular non-symlink root-owned file, is not group/world writable, and contains only the reduced JSON shape.
  • PRA-T8 Hermes Slack runtime env alias normalization — The active Slack rewrite is tested, but inactive Slack, channel-level `disabled: true`, and `disabledChannels` suppression are not tested.. Covered by the architecture finding on `src/lib/messaging/channels/slack/manifest.ts`: manifest-owned aliases are consumed by the Hermes runtime plan, but the compatibility/removal contract and disabled-channel negative tests are missing.
Since last review details

Current findings, using the urgency labels above:

PRA-1 Resolve/justify — Source-of-truth review needed: Hermes Slack runtime env alias normalization

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: The active Slack rewrite is tested, but inactive Slack, channel-level `disabled: true`, and `disabledChannels` suppression are not tested.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: Covered by the architecture finding on `src/lib/messaging/channels/slack/manifest.ts`: manifest-owned aliases are consumed by the Hermes runtime plan, but the compatibility/removal contract and disabled-channel negative tests are missing.

PRA-2 Resolve/justify — Source-of-truth review needed: Canonical provider placeholder fallback

  • Location: not file-specific
  • Category: architecture
  • Problem: The advisor marked localized patch analysis as needs_followup.
  • Impact: A localized workaround can preserve or hide an invalid state when the source boundary is unclear.
  • Recommended action: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Missing regression test: A positive Discord normalization test exists; a negative test proving `API_SERVER_KEY` and unrelated keys are not rewritten is missing.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect the localized patch and source-of-truth review fields for a concrete invalid state, source boundary, source-fix constraint, regression test, and removal condition.
  • Evidence: Covered by the security finding on `agents/hermes/runtime-config-guard.py`: line 524 computes a normalized replacement from `os.environ` using the parsed `.env` key without first checking that the key is a provider credential binding or explicit legacy provider-token key.

PRA-3 Resolve/justify — Canonical fallback still rewrites arbitrary Hermes .env keys

  • Location: agents/hermes/runtime-config-guard.py:524
  • Category: security
  • Problem: `provider_placeholders()` still falls back to `_normalize_provider_placeholder_for_env_key(os.environ.get(key, ""), key)` for every parsed assignment in `.hermes/.env` that is not already covered by the runtime plan. Any key in `.env` can therefore be replaced and hash-trusted when the runtime environment contains `openshell:resolve:env:<KEY>` or a versioned equivalent.
  • Impact: Ambient runtime environment becomes a broad configuration authority instead of a provider-credential-only compatibility path. In particular, `API_SERVER_KEY` is Hermes API authentication material, and the boundary validator permits placeholder-shaped values, so this fallback can replace the locally minted bearer key with a resolver placeholder and refresh trusted hashes.
  • Recommended action: Restrict fallback normalization to known provider credential keys. Prefer deriving the allowed set from the reduced runtime plan `credentialBindings.providerEnvKey`, plus a minimal explicit legacy allowlist for pre-runtime-plan provider tokens that still need compatibility. Keep runtime-plan `envAliases` as the generic mechanism for channel-specific rewrites.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Read `agents/hermes/runtime-config-guard.py` around `provider_placeholders()` and confirm the fallback is only attempted after the parsed key is checked against provider credential bindings or an explicit legacy provider-token allowlist.
  • Missing regression test: Add `provider-placeholders does not rewrite API_SERVER_KEY or unrelated .env keys from runtime env fallback unless the key is an allowed provider credential binding`: create `.env` with a generated `API_SERVER_KEY` and an `UNRELATED_TOKEN`, set matching runtime env placeholders, run the guard, and assert those lines and the trusted hash remain unchanged unless the key appears in `credentialBindings.providerEnvKey`.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Read `agents/hermes/runtime-config-guard.py` around `provider_placeholders()` and confirm the fallback is only attempted after the parsed key is checked against provider credential bindings or an explicit legacy provider-token allowlist.
  • Evidence: The new boundary-validation step validates the candidate `.env`, but `validate-env-secret-boundary.py` accepts `openshell:resolve:env:*` values generally, so it does not prevent `API_SERVER_KEY=openshell:resolve:env:API_SERVER_KEY` from being trusted.

PRA-4 Resolve/justify — Document and negatively test the Hermes Slack alias compatibility boundary

  • Location: src/lib/messaging/channels/slack/manifest.ts:6
  • Category: architecture
  • Problem: The PR moves Slack alias metadata into a shared manifest constant and applies it to Hermes through the reduced runtime plan, but the changed source still does not document the compatibility contract: which invalid placeholder shape is being normalized, why the render/source cannot emit the final Slack-shaped placeholder, which source owns the allowed aliases, and when the runtime rewrite can be removed.
  • Impact: Without an explicit source/removal contract and disabled-channel coverage, the startup `.env` rewrite can become a second messaging configuration authority. Future manifest or planner changes could accidentally apply Slack-only alias recovery to inactive or disabled channels, or preserve a workaround where the compiler/render source should be fixed instead.
  • Recommended action: Add a short comment near `slackRuntimeEnvAliases` or the Hermes runtime guard handoff describing the invalid placeholder state, the authoritative manifest/runtime-plan source, why runtime normalization is still required, and the removal condition. Add negative tests for Slack inactive, channel-level `disabled: true`, and `disabledChannels` suppression.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect `src/lib/messaging/channels/slack/manifest.ts` around `slackRuntimeEnvAliases`, `src/lib/messaging/compiler/engines/runtime-setup-engine.ts` around `planRuntimeSetup()`, and `agents/hermes/runtime-config-guard.py` around `_runtime_plan_alias_replacements()` for a documented contract and disabled-channel test evidence.
  • Missing regression test: Add `provider-placeholders ignores Slack envAliases when Slack is inactive, channel disabled, or listed in disabledChannels`: run the guard with each suppressed channel shape and assert `SLACK_BOT_TOKEN`/`SLACK_APP_TOKEN` remain unchanged and the trusted hash stays valid.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect `src/lib/messaging/channels/slack/manifest.ts` around `slackRuntimeEnvAliases`, `src/lib/messaging/compiler/engines/runtime-setup-engine.ts` around `planRuntimeSetup()`, and `agents/hermes/runtime-config-guard.py` around `_runtime_plan_alias_replacements()` for a documented contract and disabled-channel test evidence.
  • Evidence: `slackRuntimeEnvAliases` is manifest-owned and the guard gates aliases by active/non-disabled channels, but the changed tests only cover the active Slack rewrite and symlinked runtime-plan rejection.

PRA-5 Resolve/justify — Add negative credential-boundary tests for rejected runtime-plan aliases

  • Location: agents/hermes/runtime-config-guard.py:443
  • Category: tests
  • Problem: The guard now rejects unsafe alias values/messages and invalid regexes before writing `.env`, and it validates the resulting `.env` with the secret-boundary validator. The current tests cover the positive Slack alias path and symlinked runtime plans, but they do not exercise these rejection branches.
  • Impact: A future change could silently weaken alias value validation, leak a raw Slack token into `.env`, print a forged multiline log message, or refresh trusted hashes after a rejected runtime-plan alias without any focused regression failure.
  • Recommended action: Keep the direct temp-file/spawn harness and add focused negative tests for raw-secret alias values, control characters in alias values/messages, and invalid regexes. Assert the guard exits non-zero, leaves `.env` unchanged, and leaves the trusted hash valid for the original file.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect `test/hermes-runtime-api-key.test.ts` for tests named around raw-secret alias values, control characters, invalid regexes, unchanged `.env`, and unchanged trusted hash after guard failure.
  • Missing regression test: Add three tests: `provider-placeholders rejects runtime-plan alias raw secret values and leaves .env and trusted hash unchanged`, `provider-placeholders rejects runtime-plan alias control characters in value or message and leaves .env and trusted hash unchanged`, and `provider-placeholders rejects invalid runtime-plan alias regex and leaves .env and trusted hash unchanged`.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect `test/hermes-runtime-api-key.test.ts` for tests named around raw-secret alias values, control characters, invalid regexes, unchanged `.env`, and unchanged trusted hash after guard failure.
  • Evidence: `_runtime_plan_alias_replacements()` validates control characters and regex syntax, and `_validate_env_text_with_boundary()` rejects boundary violations, but the changed test inventory only includes the active Slack rewrite and symlinked runtime-plan negative case.

PRA-6 Resolve/justify — Validate the baked Hermes messaging runtime plan artifact in the runtime image

  • Location: agents/hermes/Dockerfile:190
  • Category: tests
  • Problem: The Dockerfile now bakes the reduced messaging runtime plan before Hermes agent-install hooks, and the runtime guard consumes `/usr/local/share/nemoclaw/messaging-runtime-plan.json` at startup. The tests validate the applier's reduced artifact shape, but not the image-level path, ownership, file type, or permissions that the entrypoint depends on.
  • Impact: If the Docker build writes the artifact to an unexpected path, leaves it absent, makes it writable, or includes unreduced plan data, Hermes startup may silently fall back to broad env normalization or consume mutable/tampered runtime metadata.
  • Recommended action: Add a small direct Dockerfile assertion after the runtime-setup `RUN`, or a focused runtime-image validation, that checks the default artifact path exists when messaging metadata is expected, is a regular non-symlink root-owned file, is not group/world writable, and contains only the reduced JSON shape.
  • Expected follow-up: Resolve in this PR or explain why the risk is acceptable.
  • Verification: Inspect `agents/hermes/Dockerfile` after the runtime-setup `RUN` or a focused image validation test for checks on `/usr/local/share/nemoclaw/messaging-runtime-plan.json` existence, type, owner, permissions, and reduced keys.
  • Missing regression test: Add `Hermes runtime image contains a regular non-symlink root-owned 0644 reduced messaging runtime plan at /usr/local/share/nemoclaw/messaging-runtime-plan.json` and assert no `agentRender`, `buildSteps`, raw placeholders, or install-only fields are present.
  • Done when: The risk is fixed or explicitly justified in the PR. Verification: Inspect `agents/hermes/Dockerfile` after the runtime-setup `RUN` or a focused image validation test for checks on `/usr/local/share/nemoclaw/messaging-runtime-plan.json` existence, type, owner, permissions, and reduced keys.
  • Evidence: `test/messaging-build-applier.test.ts` now checks reduced artifact generation and Hermes `envAliases` preservation, but the Dockerfile change itself has no image-path validation.

Workflow run details

This is an automated, non-binding review; it still expects maintainers and agents to respond to each required or warning item. Treat suggestions as current-PR improvements when they touch changed code; defer only with maintainer rationale or a linked follow-up. A human maintainer must make the final merge decision.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
agents/hermes/start.sh (1)

1184-1201: 🩺 Stability & Availability | 🔵 Trivial

Re-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 out hermes-slack-e2e, messaging-providers-e2e, and channels-stop-start-hermes-e2e for 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

📥 Commits

Reviewing files that changed from the base of the PR and between 8e047a6 and 88d8253.

📒 Files selected for processing (7)
  • agents/hermes/Dockerfile
  • agents/hermes/runtime-config-guard.py
  • agents/hermes/start.sh
  • src/lib/messaging/channels/slack/manifest.ts
  • src/lib/messaging/compiler/manifest-compiler.test.ts
  • test/hermes-runtime-api-key.test.ts
  • test/messaging-build-applier.test.ts

Comment thread agents/hermes/runtime-config-guard.py Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 28217519835
Target ref: fix/hermes-messaging-after-upgrade
Requested jobs: channels-stop-start-hermes-e2e,hermes-slack-e2e
Summary: 2 passed, 0 failed, 0 cancelled, 0 skipped

Job Result
channels-stop-start-hermes-e2e ✅ success
hermes-slack-e2e ✅ success

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
agents/hermes/start.sh (1)

1184-1201: 🩺 Stability & Availability | 🔵 Trivial

Run 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, and hermes-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

📥 Commits

Reviewing files that changed from the base of the PR and between c3b3b49 and 8c98c12.

📒 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>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between fa98208 and f88b3cd.

📒 Files selected for processing (5)
  • agents/hermes/runtime-config-guard.py
  • agents/hermes/start.sh
  • src/lib/messaging/channels/slack/manifest.ts
  • test/hermes-runtime-api-key.test.ts
  • test/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

Comment thread agents/hermes/runtime-config-guard.py Resolved
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ❌ Some jobs failed

Run: 28219927704
Target ref: fix/hermes-messaging-after-upgrade
Requested jobs: onboard-resume-e2e,onboard-repair-e2e,cloud-onboard-e2e,messaging-providers-e2e,channels-add-remove-e2e,channels-stop-start-openclaw-e2e,channels-stop-start-hermes-e2e,rebuild-openclaw-e2e,rebuild-hermes-e2e,hermes-discord-e2e,hermes-slack-e2e,telegram-injection-e2e,openclaw-discord-pairing-e2e,openclaw-slack-pairing-e2e,hermes-e2e
Summary: 14 passed, 1 failed, 0 cancelled, 0 skipped

Job Result
channels-add-remove-e2e ✅ success
channels-stop-start-hermes-e2e ✅ success
channels-stop-start-openclaw-e2e ✅ success
cloud-onboard-e2e ✅ success
hermes-discord-e2e ✅ success
hermes-e2e ❌ failure
hermes-slack-e2e ✅ success
messaging-providers-e2e ✅ success
onboard-repair-e2e ✅ success
onboard-resume-e2e ✅ success
openclaw-discord-pairing-e2e ✅ success
openclaw-slack-pairing-e2e ✅ success
rebuild-hermes-e2e ✅ success
rebuild-openclaw-e2e ✅ success
telegram-injection-e2e ✅ success

Failed jobs: hermes-e2e. Check run artifacts for logs.

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ❌ Some jobs failed

Run: 28219927704
Target ref: fix/hermes-messaging-after-upgrade
Requested jobs: onboard-resume-e2e,onboard-repair-e2e,cloud-onboard-e2e,messaging-providers-e2e,channels-add-remove-e2e,channels-stop-start-openclaw-e2e,channels-stop-start-hermes-e2e,rebuild-openclaw-e2e,rebuild-hermes-e2e,hermes-discord-e2e,hermes-slack-e2e,telegram-injection-e2e,openclaw-discord-pairing-e2e,openclaw-slack-pairing-e2e,hermes-e2e
Summary: 14 passed, 1 failed, 0 cancelled, 0 skipped

Job Result
channels-add-remove-e2e ✅ success
channels-stop-start-hermes-e2e ✅ success
channels-stop-start-openclaw-e2e ✅ success
cloud-onboard-e2e ✅ success
hermes-discord-e2e ✅ success
hermes-e2e ❌ failure
hermes-slack-e2e ✅ success
messaging-providers-e2e ✅ success
onboard-repair-e2e ✅ success
onboard-resume-e2e ✅ success
openclaw-discord-pairing-e2e ✅ success
openclaw-slack-pairing-e2e ✅ success
rebuild-hermes-e2e ✅ success
rebuild-openclaw-e2e ✅ success
telegram-injection-e2e ✅ success

Failed jobs: hermes-e2e. Check run artifacts for logs.

@NVIDIA NVIDIA deleted a comment from github-actions Bot Jun 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 28222775699
Target ref: fix/hermes-messaging-after-upgrade
Requested jobs: onboard-resume-e2e,onboard-repair-e2e,cloud-onboard-e2e,messaging-providers-e2e,channels-add-remove-e2e,channels-stop-start-openclaw-e2e,channels-stop-start-hermes-e2e,rebuild-openclaw-e2e,rebuild-hermes-e2e,hermes-discord-e2e,hermes-slack-e2e,telegram-injection-e2e,openclaw-discord-pairing-e2e,openclaw-slack-pairing-e2e,hermes-e2e
Summary: 15 passed, 0 failed, 0 cancelled, 0 skipped

Job Result
channels-add-remove-e2e ✅ success
channels-stop-start-hermes-e2e ✅ success
channels-stop-start-openclaw-e2e ✅ success
cloud-onboard-e2e ✅ success
hermes-discord-e2e ✅ success
hermes-e2e ✅ success
hermes-slack-e2e ✅ success
messaging-providers-e2e ✅ success
onboard-repair-e2e ✅ success
onboard-resume-e2e ✅ success
openclaw-discord-pairing-e2e ✅ success
openclaw-slack-pairing-e2e ✅ success
rebuild-hermes-e2e ✅ success
rebuild-openclaw-e2e ✅ success
telegram-injection-e2e ✅ success

@sandl99
sandl99 requested a review from cv June 26, 2026 07:34
@jyaunches
jyaunches merged commit 195a6af into main Jun 26, 2026
112 checks passed
@jyaunches
jyaunches deleted the fix/hermes-messaging-after-upgrade branch June 26, 2026 16:29
cv pushed a commit that referenced this pull request Jun 26, 2026
## 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 -->
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
<!-- 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>
Hadar301 pushed a commit to Hadar301/NemoClaw-OpenShift that referenced this pull request Jul 12, 2026
…#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 -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: messaging Messaging channels, bridges, manifests, or channel lifecycle bug-fix PR fixes a bug or regression integration: hermes Hermes integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants