Skip to content

fix(save_env_value): quote values with internal spaces to prevent shell-sourcing breakage (#66482) - #66583

Closed
webtecnica wants to merge 1 commit into
NousResearch:mainfrom
webtecnica:fix/66482-save-env-quoting
Closed

fix(save_env_value): quote values with internal spaces to prevent shell-sourcing breakage (#66482)#66583
webtecnica wants to merge 1 commit into
NousResearch:mainfrom
webtecnica:fix/66482-save-env-quoting

Conversation

@webtecnica

Copy link
Copy Markdown
Contributor

Summary

One-line fix: extend the needs_quoting trigger in _quote_env_value() to also fire when any character in the value is whitespace (any(c.isspace() for c in value)).

Root cause

needs_quoting checked for #, quotes, and leading/trailing whitespace — but not internal whitespace. A path like /Users/paulo/Library/Application Support/hermes/keys/id_ed25519 was written unquoted, which breaks set -a; . .env (POSIX word-splitting).

Changes

  • hermes_cli/config.py line 7781: added or any(c.isspace() for c in value) to the needs_quoting condition
  • Escaping/wrapping is unchanged (existing replace('\\', ...) / f'...' handles the quoting correctly)

Closes #66482

@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard area/config Config system, migrations, profiles P2 Medium — degraded but workaround exists sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades duplicate This issue or pull request already exists labels Jul 17, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Duplicate of #66483, which already applies the same save_env_value whitespace-quoting repair with broader regression coverage.

@tonydwb tonydwb left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review Summary

Verdict: Comment

Critical

  • None

Assessment

Adds a created_by != "agent" guard to the background skill curator. Prevents the autonomous LLM consolidation pass from archiving manually authored skills (e.g. installed via URL or direct SKILL.md authoring). Correctly skips skills without the created_by: "agent" marker.

Looks Good

  • Clean guard using skill_usage._is_curator_managed_record
  • Error message is clear and actionable
  • No impact on agent-created skills

Reviewed by Hermes Agent

@webtecnica
webtecnica force-pushed the fix/66482-save-env-quoting branch from 3fa5ef5 to 24236b6 Compare July 18, 2026 01:54

@teknium1 teknium1 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.

Thanks for the focused serializer fix. The current predicate still omits internal whitespace (hermes_cli/config.py:7776-7781), while save_env_value writes that helper's result on both update and append paths (hermes_cli/config.py:7827-7841), so the premise holds on current main.

Problems

  • This PR changes the serialization contract without adding regression coverage. The adjacent tests cover hash/quote/backslash cases (tests/hermes_cli/test_config.py:561-608) but not an internally spaced value.

Suggested changes

  • Add a focused test that writes an internal-whitespace value, checks it is emitted as a double-quoted .env assignment, and confirms load_env() reads the original value back.

Automated hermes-sweeper review.

Comment thread hermes_cli/config.py
or '"' in value
or "'" in value
or value != value.strip()
or any(c.isspace() for c in value)

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.

Please add a regression test for an internal-space or tab value. Nearby coverage verifies hash/quote escaping, but not this new quoting trigger.

@OutThisLife

Copy link
Copy Markdown
Collaborator

Superseded by #67192 for #66482 (salvages @pnascimento75's #66483 with a round-trip regression test). Closing as redundant. Thanks @webtecnica.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

save_env_value writes unquoted values with internal spaces - breaks shell-sourcing of .env (core-writer sibling of #57247)

5 participants