Skip to content

Hardening fixes for compression, Hindsight, and env snapshots - #57612

Closed
ai-ag2026 wants to merge 7 commits into
NousResearch:mainfrom
ai-ag2026:tars/agent-generic-hardening-pr
Closed

Hardening fixes for compression, Hindsight, and env snapshots#57612
ai-ag2026 wants to merge 7 commits into
NousResearch:mainfrom
ai-ag2026:tars/agent-generic-hardening-pr

Conversation

@ai-ag2026

@ai-ag2026 ai-ag2026 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR collects small, generic hardening fixes that were carried locally and replay cleanly on current origin/main:

  • tolerate non-object tool-call args while compressing context
  • surface Hindsight retain timeouts clearly instead of returning ambiguous failures
  • scrub secret-looking variables from terminal environment snapshots
  • keep shell snapshot temp filenames stable across export -p | grep ... && mv ... pipelines so exported env/session PATH changes persist correctly

Verification

Run locally on the PR branch after the latest push:

PYTHONPATH="$PWD" /home/manfred/.hermes/hermes-agent/venv/bin/python -m pytest \
  tests/agent/test_context_compressor.py \
  tests/plugins/memory/test_hindsight_provider.py \
  tests/tools/test_init_session_cwd_respect.py \
  tests/tools/test_base_environment.py \
  -q
# 301 passed in 10.64s

PYTHONPATH="$PWD" /home/manfred/.hermes/hermes-agent/venv/bin/python -m pytest \
  tests/tools/test_local_shell_init.py \
  -q
# 16 passed in 1.01s

git diff --check origin/main...HEAD
# rc=0

Earlier CI caught the shell-snapshot temp-name regression in tests/tools/test_local_shell_init.py; this branch now includes the fix and the local reproducer suite is green.

@ai-ag2026
ai-ag2026 force-pushed the tars/agent-generic-hardening-pr branch from b48d742 to 48462b0 Compare July 3, 2026 08:59
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint tool/terminal Terminal execution and process management tool/memory Memory tool and memory providers comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have labels Jul 3, 2026
ai-ag2026 added 6 commits July 9, 2026 04:35
(cherry picked from commit d05f07c9873705400d5ddfd9b352ea387aeb8efd)
(cherry picked from commit ee02fb231ac6c144c947eed71c82eb568f0d9437)
(cherry picked from commit 38de0dc12571529d87b8905c57a0ba2ce4c9226c)
(cherry picked from commit fabc245c382da529ad6deab5786dfee2a75a414e)
(cherry picked from commit 1b5d0fedda9131f1b56876e0aa369a29d9356e08)
(cherry picked from commit cd4eff10c6b4e4509ebce89a06b7c6372a68e015)
(cherry picked from commit 4f1ea6f0632bd0c623a11f289fbd742d55537db8)
(cherry picked from commit 268666e7b0bd4ba88c4ea6a883a6caf595324751)
(cherry picked from commit 8e9a47d710214cf7fd367b01cc2e54c47212a369)
@ai-ag2026
ai-ag2026 force-pushed the tars/agent-generic-hardening-pr branch from 0cc0173 to 4b8bbc4 Compare July 9, 2026 02:38
@ai-ag2026
ai-ag2026 force-pushed the tars/agent-generic-hardening-pr branch from 4b8bbc4 to 919632e Compare July 9, 2026 02:47
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused hardening work. Two parts still target current-main behavior: plugins/memory/hindsight/__init__.py:274-281 still exposes a raw future timeout, and tools/environments/base.py:502,650 still snapshots all exported variables.

Problems

  • The compression hunk is already superseded. Current main commit 3804df5b36aeb2fcb6ae1c2bc38dd53f46c4de01 rejects non-dict parsed arguments at agent/context_compressor.py:638-639; its coverage includes list and scalar arguments at tests/agent/test_summarize_tool_result_type_safety.py:190-195.

Suggested changes

  • When salvaging, omit fa859c1b0429 and its duplicate compressor test; preserve the independent Hindsight and shell-snapshot changes.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit labels Jul 15, 2026
@ai-ag2026

Copy link
Copy Markdown
Contributor Author

Summary

Closing this older combined hardening PR after reconciling every slice against the maintained replacements and current main.

Why

No remaining unique hunk needs to be ported, and no target branch was changed during this consolidation.

Validation

Notes

This is a consolidation close, not a rejection of the fixes. The maintained destinations are #59840, #59842, and main commit 3804df5b3.

Refs

@ai-ag2026 ai-ag2026 closed this Jul 17, 2026
@teknium1 teknium1 added area/memory Memory subsystem: store, providers, sync, background reviews area/compression Context compression and continuation sessions labels Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/compression Context compression and continuation sessions area/memory Memory subsystem: store, providers, sync, background reviews comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data tool/memory Memory tool and memory providers tool/terminal Terminal execution and process management type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants