Skip to content

fix(cli): preserve Hermes light terminal hints - #6391

Closed
chengjiew wants to merge 4 commits into
mainfrom
fix/6380_hermes_light_terminal
Closed

fix(cli): preserve Hermes light terminal hints#6391
chengjiew wants to merge 4 commits into
mainfrom
fix/6380_hermes_light_terminal

Conversation

@chengjiew

@chengjiew chengjiew commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Preserve light-terminal hints when connecting to Hermes sandboxes so Hermes can select its readable light TUI theme on macOS Terminal.app.

Fixes #6380.

Related Issue

Fixes #6380

Changes

  • Derive HERMES_TUI_LIGHT=1 for Hermes sandbox connect sessions when the host terminal reports a light background and no explicit Hermes TUI theme/light override is set.
  • Keep the light-mode detection in a pure domain helper and require positive COLORFGBG light-background evidence instead of inferring light mode from TERM_PROGRAM alone.
  • Preserve user overrides for HERMES_TUI_LIGHT and HERMES_TUI_THEME.
  • Add focused regression and boundary tests for macOS Terminal.app with COLORFGBG=0;15, dark backgrounds, explicit overrides, malformed inputs, and non-Hermes agents.

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: behavior is an automatic connect-time environment bridge with no user-facing command or configuration change.
  • 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:
  • 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
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: NPM_CONFIG_CACHE=/tmp/nemoclaw-6380-npm-cache npx vitest run --project cli src/lib/domain/sandbox/connect-env.test.ts src/lib/actions/sandbox/connect-hermes-light-theme.test.ts src/lib/actions/sandbox/connect-flow.test.ts passed, 20 tests.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result: NPM_CONFIG_CACHE=/tmp/nemoclaw-6380-npm-cache npm test was run and failed with 53 failures outside the touched connect files, including installer locale/timeouts, macOS /private path expectations, bash/BASHPID environment issues, Deep Agents Python fcntl support, policy-denial hint tests, and shields timing failures.
  • 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)

Additional verification:

  • Red regression run before the fix confirmed the new Hermes light-terminal test failed because HERMES_TUI_LIGHT remained empty.
  • Red domain follow-up run confirmed src/lib/domain/sandbox/connect-env.test.ts failed before the domain helper existed.
  • NPM_CONFIG_CACHE=/tmp/nemoclaw-6380-npm-cache npm run typecheck:cli passed.
  • NPM_CONFIG_CACHE=/tmp/nemoclaw-6380-npm-cache npx prek run --all-files passed.
  • git diff --check passed.

Signed-off-by: Chengjie Wang chengjiew@nvidia.com

Summary by CodeRabbit

  • New Features
    • Improved sandbox connect environment handling by automatically enabling Hermes light-mode UI when terminal color settings indicate a light background.
    • Explicit light/theme selections still take priority, preventing unwanted overrides.
  • Tests
    • Added Vitest coverage for Hermes light-mode inference (including macOS Terminal behavior) and for theme/light override precedence across multiple environment scenarios.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 9de365f2-d019-4311-aa7f-41eaecc59f03

📥 Commits

Reviewing files that changed from the base of the PR and between 68c9c26 and ab1368f.

📒 Files selected for processing (2)
  • src/lib/actions/sandbox/connect.ts
  • src/lib/domain/sandbox/connect-env.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/lib/actions/sandbox/connect.ts
  • src/lib/domain/sandbox/connect-env.ts

📝 Walkthrough

Walkthrough

Adds buildSandboxConnectEnv to infer Hermes light-theme terminal state from environment variables, wires that environment into sandbox connect subprocess spawning, and adds tests covering the new inference and integration path.

Changes

Hermes TUI light-mode env injection

Layer / File(s) Summary
Light-mode detection and env builder
src/lib/domain/sandbox/connect-env.ts, src/lib/domain/sandbox/connect-env.test.ts
Adds SPDX header comments, boolean-like env helpers, terminal light-mode inference from COLORFGBG, and buildSandboxConnectEnv, with tests for light/dark backgrounds, explicit overrides, non-Hermes agents, and missing COLORFGBG.
Sandbox connect wiring and integration test
src/lib/actions/sandbox/connect.ts, src/lib/actions/sandbox/connect-hermes-light-theme.test.ts
Imports and uses buildSandboxConnectEnv(agent, process.env) for openshell sandbox connect, and adds a Hermes connect test that asserts the spawned environment includes HERMES_TUI_LIGHT: "1".

Estimated code review effort: 2 (Simple) | ~15 minutes

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant connect.ts
    participant buildSandboxConnectEnv
    participant openshell

    User->>connect.ts: nemoclaw sandbox connect
    connect.ts->>buildSandboxConnectEnv: buildSandboxConnectEnv(agent, process.env)
    buildSandboxConnectEnv-->>connect.ts: env with optional HERMES_TUI_LIGHT
    connect.ts->>openshell: spawnSync(sandbox connect, env)
    openshell-->>User: Hermes TUI session
Loading

Suggested labels: bug-fix

Suggested reviewers: ericksoa

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: preserving Hermes light-terminal hints in the CLI.
Linked Issues check ✅ Passed The PR matches #6380 by propagating a light-terminal hint for Hermes connect while preserving explicit light/theme overrides.
Out of Scope Changes check ✅ Passed The changes stay focused on Hermes connect environment handling and regression tests, with no obvious unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/6380_hermes_light_terminal

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

@github-code-quality

github-code-quality Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in the fix/6380_hermes_ligh... 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/6380_hermes_ligh... ab1368f +/-
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/6380_hermes_ligh... branch is 75%. Coverage data for the main branch is not yet available.

Show a code coverage summary of the most covered files.
File main fix/6380_hermes_ligh... ab1368f +/-
src/lib/shields...nsition-lock.ts 85%
src/lib/onboard/preflight.ts 83%
src/lib/actions...all/run-plan.ts 81%
src/lib/state/o...oard-session.ts 80%
src/lib/actions...licy-channel.ts 79%
src/lib/state/sandbox.ts 75%
src/lib/onboard...er-gpu-patch.ts 69%
src/lib/shields/index.ts 68%
src/lib/policy/index.ts 66%
src/lib/onboard.ts 28%

Updated July 07, 2026 10:56 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings

Merge posture: No blocking advisor findings
Primary next action: No advisor follow-up required beyond maintainer review.
Open items: 0 required · 0 warnings · 0 suggestions · 0 test follow-ups
Since last review: 2 prior items resolved · 0 still apply · 0 new items found

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)
src/lib/actions/sandbox/connect.ts (1)

153-190: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider moving light-mode decision logic to a domain module.

hasExplicitBoolean, hostTerminalLooksLight, and buildSandboxConnectEnv are pure decision functions with no host/process calls, embedded directly in this actions file. Per the layering rules, actions should orchestrate while pure decisions live in domain modules.

As per path instructions, src/lib/{actions,domain,adapters,state}/** should be reviewed "against src/lib/README.md: actions orchestrate, domain modules make pure decisions, adapters own host/process/network boundaries, and state modules own persisted files and state I/O."

🤖 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 `@src/lib/actions/sandbox/connect.ts` around lines 153 - 190, Move the pure
environment/theme decision logic out of the actions layer: hasExplicitBoolean,
hostTerminalLooksLight, and buildSandboxConnectEnv should not live in connect.ts
because they are domain-style decision helpers. Extract them into an appropriate
domain module under src/lib/domain, keep the actions file as an orchestrator,
and update any imports/call sites so buildSandboxConnectEnv is referenced from
the new domain location while preserving the existing behavior.

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 `@src/lib/actions/sandbox/connect-flow.test.ts`:
- Line 74: Update the test title in connect-flow.test.ts so it keeps the
behavior-oriented wording for the Hermes connect session case and appends the
local issue reference suffix as required, changing the it(...) description to
end with “(`#6380`)”.

---

Nitpick comments:
In `@src/lib/actions/sandbox/connect.ts`:
- Around line 153-190: Move the pure environment/theme decision logic out of the
actions layer: hasExplicitBoolean, hostTerminalLooksLight, and
buildSandboxConnectEnv should not live in connect.ts because they are
domain-style decision helpers. Extract them into an appropriate domain module
under src/lib/domain, keep the actions file as an orchestrator, and update any
imports/call sites so buildSandboxConnectEnv is referenced from the new domain
location while preserving the existing behavior.
🪄 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: eb95dc4f-a385-42c1-b313-957c93cea07e

📥 Commits

Reviewing files that changed from the base of the PR and between 5a6f489 and d14950b.

📒 Files selected for processing (2)
  • src/lib/actions/sandbox/connect-flow.test.ts
  • src/lib/actions/sandbox/connect.ts

expect(exitSpy).toHaveBeenCalledWith(0);
});

it("marks Hermes connect sessions as light-mode when launched from light macOS Terminal.app", async () => {

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add local issue reference to test title.

The title is behavior-oriented but is missing the required (#6380) suffix linking to the issue this regression test covers.

As per coding guidelines, **/*.test.ts should "Write behavior-oriented test titles, and put local issue references in a final (#1234) suffix."

✏️ Proposed fix
-  it("marks Hermes connect sessions as light-mode when launched from light macOS Terminal.app", async () => {
+  it("marks Hermes connect sessions as light-mode when launched from light macOS Terminal.app (`#6380`)", async () => {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
it("marks Hermes connect sessions as light-mode when launched from light macOS Terminal.app", async () => {
it("marks Hermes connect sessions as light-mode when launched from light macOS Terminal.app (`#6380`)", async () => {
🤖 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 `@src/lib/actions/sandbox/connect-flow.test.ts` at line 74, Update the test
title in connect-flow.test.ts so it keeps the behavior-oriented wording for the
Hermes connect session case and appends the local issue reference suffix as
required, changing the it(...) description to end with “(`#6380`)”.

Source: Coding guidelines

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor (Nemotron Ultra) — Changes requested

Merge posture: Do not merge yet
Primary next action: Resolve or justify PRA-1: Source-of-truth review needed: src/lib/domain/sandbox/connect-env.ts.
Open items: 0 required · 3 warnings · 1 suggestion · 5 test follow-ups
Since last review: 4 prior items resolved · 2 still apply · 1 new item found

Action checklist

  • PRA-1 Resolve or justify: Source-of-truth review needed: src/lib/domain/sandbox/connect-env.ts
  • PRA-2 Resolve or justify: PR fix(inference): contain shared gateway route conflicts #6338 overlap at spawnSync env callsite in src/lib/actions/sandbox/connect.ts:1096
  • PRA-3 Resolve or justify: Upstream Hermes workaround lacks removal criteria and regression guard in src/lib/domain/sandbox/connect-env.ts:1
  • 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: Single-use test config NEMOCLAW_TEST_NO_SLEEP could be a constant
  • PRA-T5 Add or justify test follow-up: src/lib/domain/sandbox/connect-env.ts
  • PRA-4 In-scope improvement: Single-use test config NEMOCLAW_TEST_NO_SLEEP could be a constant in src/lib/actions/sandbox/connect-hermes-light-theme.test.ts:17

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 scope src/lib/actions/sandbox/connect.ts:1096 Coordinate with PR #6338 author before merge. Verify both apply cleanly and combined test suite passes. Run connect-flow test suite after both merged.
PRA-3 Resolve/justify acceptance src/lib/domain/sandbox/connect-env.ts:1 Add a TODO comment in connect-env.ts with: upstream issue link (NousResearch/hermes-agent#8526), removal condition (e.g., 'when Hermes respects NO_COLOR or exposes theme detection API'), and a periodic review reminder. Consider adding a test that fails if Hermes_TUI_LIGHT is no longer needed (e.g., by checking Hermes version).
PRA-4 Improvement tests src/lib/actions/sandbox/connect-hermes-light-theme.test.ts:17 Replace with a module-level constant (e.g., const TEST_NO_SLEEP = true) and remove the env stub/unstub boilerplate, or keep as-is if other tests depend on the env var being set.
Review findings by urgency: 0 required fixes, 3 items to resolve/justify, 1 in-scope improvement

⚠️ 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: src/lib/domain/sandbox/connect-env.ts

  • 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: None — upstream can change independently; no version pin or compatibility test
  • 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: connect-env.ts:1-38 implements workaround with no documentation of upstream issue or removal criteria. Issue [macOS][Agent&Skills] Hermes CLI TUI reply text unreadable on light-theme Terminal.app #6380 comment Change small local model to qwen3.5:9b #3 confirms upstream issue [Bug]: [color] default color is broken, when launching hermes via terminal, not being readable NousResearch/hermes-agent#8526.

PRA-2 Resolve/justify — PR #6338 overlap at spawnSync env callsite

PRA-3 Resolve/justify — Upstream Hermes workaround lacks removal criteria and regression guard

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

PRA-4 Improvement — Single-use test config NEMOCLAW_TEST_NO_SLEEP could be a constant

  • Location: src/lib/actions/sandbox/connect-hermes-light-theme.test.ts:17
  • Category: tests
  • Problem: The test sets process.env.NEMOCLAW_TEST_NO_SLEEP = "1" in beforeEach and deletes it in afterEach. This config knob appears only in this test file and is not exercised by users or CI as a variable.
  • Impact: Minor test clarity improvement; using a constant would make intent clearer and avoid unnecessary env manipulation.
  • Suggested action: Replace with a module-level constant (e.g., const TEST_NO_SLEEP = true) and remove the env stub/unstub boilerplate, or keep as-is if other tests depend on the env var being set.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Search for NEMOCLAW_TEST_NO_SLEEP across the repo; if only used in this test file, replace with constant.
  • Missing regression test: N/A — test behavior unchanged.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: connect-hermes-light-theme.test.ts:17 sets and line 31 deletes NEMOCLAW_TEST_NO_SLEEP. No other references found in changed files.
Simplification opportunities: 1 possible cut, net -4 lines possible

These are safe simplification checks only. Do not remove validation, security controls, data-loss prevention, or required tests.

  • PRA-4 shrink (src/lib/actions/sandbox/connect-hermes-light-theme.test.ts:17): process.env.NEMOCLAW_TEST_NO_SLEEP = "1" in beforeEach and delete in afterEach
    • Replacement: const TEST_NO_SLEEP = true at module scope; use directly in harness options if needed
    • Net: -4 lines
    • Safety boundary: Test behavior must remain identical — no sleep in connect flow tests
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 — Add test for NO_COLOR=1 behavior (currently unhandled — upstream responsibility but could be documented). Runtime/sandbox/infrastructure paths need behavioral runtime validation: src/lib/actions/sandbox/connect.ts, src/lib/domain/sandbox/connect-env.ts. Unit and integration tests cover the pure function logic and spawnSync env propagation, but end-to-end sandbox connect flow with real openshell would provide higher confidence.
  • PRA-T2 Runtime validation — Add test for TERM_PROGRAM values other than Apple_Terminal (currently only Apple_Terminal triggers inference). Runtime/sandbox/infrastructure paths need behavioral runtime validation: src/lib/actions/sandbox/connect.ts, src/lib/domain/sandbox/connect-env.ts. Unit and integration tests cover the pure function logic and spawnSync env propagation, but end-to-end sandbox connect flow with real openshell would provide higher confidence.
  • PRA-T3 Runtime validation — Consider targeted runtime validation with real openshell sandbox connect for Hermes agent on light/dark terminals. Runtime/sandbox/infrastructure paths need behavioral runtime validation: src/lib/actions/sandbox/connect.ts, src/lib/domain/sandbox/connect-env.ts. Unit and integration tests cover the pure function logic and spawnSync env propagation, but end-to-end sandbox connect flow with real openshell would provide higher confidence.
  • PRA-T4 Single-use test config NEMOCLAW_TEST_NO_SLEEP could be a constant — Replace with a module-level constant (e.g., const TEST_NO_SLEEP = true) and remove the env stub/unstub boilerplate, or keep as-is if other tests depend on the env var being set.
  • PRA-T5 src/lib/domain/sandbox/connect-env.ts — None — upstream can change independently; no version pin or compatibility test. connect-env.ts:1-38 implements workaround with no documentation of upstream issue or removal criteria. Issue [macOS][Agent&Skills] Hermes CLI TUI reply text unreadable on light-theme Terminal.app #6380 comment Change small local model to qwen3.5:9b #3 confirms upstream issue [Bug]: [color] default color is broken, when launching hermes via terminal, not being readable NousResearch/hermes-agent#8526.
Since last review details

Current findings, using the urgency labels above:

PRA-1 Resolve/justify — Source-of-truth review needed: src/lib/domain/sandbox/connect-env.ts

  • 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: None — upstream can change independently; no version pin or compatibility test
  • 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: connect-env.ts:1-38 implements workaround with no documentation of upstream issue or removal criteria. Issue [macOS][Agent&Skills] Hermes CLI TUI reply text unreadable on light-theme Terminal.app #6380 comment Change small local model to qwen3.5:9b #3 confirms upstream issue [Bug]: [color] default color is broken, when launching hermes via terminal, not being readable NousResearch/hermes-agent#8526.

PRA-2 Resolve/justify — PR #6338 overlap at spawnSync env callsite

PRA-3 Resolve/justify — Upstream Hermes workaround lacks removal criteria and regression guard

PRA-4 Improvement — Single-use test config NEMOCLAW_TEST_NO_SLEEP could be a constant

  • Location: src/lib/actions/sandbox/connect-hermes-light-theme.test.ts:17
  • Category: tests
  • Problem: The test sets process.env.NEMOCLAW_TEST_NO_SLEEP = "1" in beforeEach and deletes it in afterEach. This config knob appears only in this test file and is not exercised by users or CI as a variable.
  • Impact: Minor test clarity improvement; using a constant would make intent clearer and avoid unnecessary env manipulation.
  • Suggested action: Replace with a module-level constant (e.g., const TEST_NO_SLEEP = true) and remove the env stub/unstub boilerplate, or keep as-is if other tests depend on the env var being set.
  • Expected follow-up: Prefer a current-PR fix when local to changed code; defer only with rationale or linked follow-up.
  • Verification: Search for NEMOCLAW_TEST_NO_SLEEP across the repo; if only used in this test file, replace with constant.
  • Missing regression test: N/A — test behavior unchanged.
  • Done when: The local improvement is applied, or the PR notes why it should be deferred.
  • Evidence: connect-hermes-light-theme.test.ts:17 sets and line 31 deletes NEMOCLAW_TEST_NO_SLEEP. No other references found in changed files.

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.

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: sandbox-rlimits-connect
Optional E2E: hermes-e2e

Dispatch hint: sandbox-rlimits-connect

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • sandbox-rlimits-connect (high): This is the existing live E2E job that exercises nemoclaw <sandbox> connect through a real onboarded sandbox and OpenShell connect shell. It is the closest existing merge-blocking coverage for regressions from changing the environment passed to openshell sandbox connect.

Optional E2E

  • hermes-e2e (high): Adjacent confidence for Hermes sandbox onboarding/runtime behavior. It does not appear to directly validate the interactive connect-shell theme environment, but it can catch broader Hermes regressions if the agent/session resolution feeding connect is affected.

New E2E recommendations

  • hermes-connect-theme-environment (medium): No existing live E2E found that launches a Hermes sandbox through nemoclaw <sandbox> connect with a simulated light host terminal and asserts HERMES_TUI_LIGHT reaches the in-sandbox Hermes TUI environment.
    • Suggested test: Add a Hermes connect-shell live E2E that onboards a Hermes sandbox, runs nemoclaw <sandbox> connect with TERM_PROGRAM=Apple_Terminal and COLORFGBG=0;15, and verifies the connected sandbox session sees HERMES_TUI_LIGHT=1 while explicit HERMES_TUI_LIGHT/HERMES_TUI_THEME overrides are preserved.

Dispatch hint

  • Workflow: .github/workflows/e2e.yaml
  • jobs input: sandbox-rlimits-connect

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

E2E Target Recommendation

Required E2E targets: None
Optional E2E targets: ubuntu-repo-cloud-openclaw

Workflow run

Full E2E target advisor summary

E2E Target Advisor

Base: origin/main
Head: HEAD
Confidence: medium

Required E2E targets

  • None.

Optional E2E targets

  • ubuntu-repo-cloud-openclaw: Optional regression guard for the shared sandbox connect path on the standard OpenClaw live-supported target, since connect.ts now passes a rebuilt environment object for all agents.
    • Dispatch: gh workflow run e2e.yaml --ref <pr-head-ref> --field targets=ubuntu-repo-cloud-openclaw

Relevant changed files

  • src/lib/actions/sandbox/connect.ts
  • src/lib/domain/sandbox/connect-env.ts

@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: 2

🤖 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 `@src/lib/actions/sandbox/connect-hermes-light-theme.test.ts`:
- Around line 24-37: The afterEach cleanup in connect-hermes-light-theme.test.ts
has a redundant conditional around restoring process.stdout.isTTY; both branches
do the same reset behavior, so simplify it to a single Object.defineProperty
call using originalStdoutIsTty directly and remove the unnecessary if/else to
satisfy the growth guardrail.

In `@src/lib/domain/sandbox/connect-env.ts`:
- Around line 24-27: The sandbox domain helper is still crossing the process
boundary by defaulting `env` to `process.env`, which violates domain purity.
Update `buildSandboxConnectEnv` in `connect-env.ts` so `env` is a required
argument with no `process` reference, then change the `connect.ts` call site to
pass `process.env` explicitly. Keep the process access in the action layer and
let the domain helper only transform the provided environment.
🪄 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: 3c4b7d2d-32a7-438a-b0ea-cef23a0010a4

📥 Commits

Reviewing files that changed from the base of the PR and between d14950b and 7c0fb8c.

📒 Files selected for processing (4)
  • src/lib/actions/sandbox/connect-hermes-light-theme.test.ts
  • src/lib/actions/sandbox/connect.ts
  • src/lib/domain/sandbox/connect-env.test.ts
  • src/lib/domain/sandbox/connect-env.ts

Comment thread src/lib/actions/sandbox/connect-hermes-light-theme.test.ts
Comment on lines +24 to +27
export function buildSandboxConnectEnv(
agent: { name?: string } | null | undefined,
env: NodeJS.ProcessEnv = process.env,
): NodeJS.ProcessEnv {

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Domain helper directly references process.env, breaking layer purity.

src/lib/README.md requires domain modules to stay pure with no direct process/fs/Docker/network calls, and this PR explicitly calls for the connect action to delegate to "a pure domain helper... rather than manipulating process environment... inside the action." The default parameter env: NodeJS.ProcessEnv = process.env embeds a direct process reference inside the domain module itself, and the actual call site (connect.ts) never passes process.env explicitly — so the domain layer, not the action, ends up owning the process boundary access.

Make env a required parameter and have the action pass process.env explicitly, keeping the process boundary owned by the action layer as intended.

♻️ Proposed fix
 export function buildSandboxConnectEnv(
   agent: { name?: string } | null | undefined,
-  env: NodeJS.ProcessEnv = process.env,
+  env: NodeJS.ProcessEnv,
 ): NodeJS.ProcessEnv {

And update the call site in src/lib/actions/sandbox/connect.ts:

-    env: buildSandboxConnectEnv(agent),
+    env: buildSandboxConnectEnv(agent, process.env),
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export function buildSandboxConnectEnv(
agent: { name?: string } | null | undefined,
env: NodeJS.ProcessEnv = process.env,
): NodeJS.ProcessEnv {
export function buildSandboxConnectEnv(
agent: { name?: string } | null | undefined,
env: NodeJS.ProcessEnv,
): NodeJS.ProcessEnv {
🤖 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 `@src/lib/domain/sandbox/connect-env.ts` around lines 24 - 27, The sandbox
domain helper is still crossing the process boundary by defaulting `env` to
`process.env`, which violates domain purity. Update `buildSandboxConnectEnv` in
`connect-env.ts` so `env` is a required argument with no `process` reference,
then change the `connect.ts` call site to pass `process.env` explicitly. Keep
the process access in the action layer and let the domain helper only transform
the provided environment.

Source: Path instructions

@chengjiew chengjiew closed this Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[macOS][Agent&Skills] Hermes CLI TUI reply text unreadable on light-theme Terminal.app

1 participant