Skip to content

test(cli): accept force= kwarg on DummyAgent._compress_context - #28303

Closed
briandevans wants to merge 1 commit into
NousResearch:mainfrom
briandevans:fix/manual-compress-test-force-kwarg
Closed

test(cli): accept force= kwarg on DummyAgent._compress_context#28303
briandevans wants to merge 1 commit into
NousResearch:mainfrom
briandevans:fix/manual-compress-test-force-kwarg

Conversation

@briandevans

Copy link
Copy Markdown
Contributor

What does this PR do?

Aligns the DummyAgent._compress_context stub in tests/test_cli_manual_compress.py with the production signature after PR #28102 added force=True to the manual /compress code path.

Without this fix, tests/test_cli_manual_compress.py::test_manual_compress_does_not_pass_cached_system_prompt is a baseline failure on every open PR's CI. The CLI passes force=True (cli.py:9194), the stub raises TypeError: got an unexpected keyword argument 'force', the surrounding except Exception prints ❌ Compression failed, and the test fails on assert len(cli.agent.calls) == 1 because the append never ran.

Related Issue

N/A — baseline CI fix surfaced by PR #28102 and observed on every open PR (e.g. https://github.com/NousResearch/hermes-agent/actions/runs/26068814560/job/76645496736).

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • tests/test_cli_manual_compress.py — add force=False to DummyAgent._compress_context so the production call from cli.HermesCLI._manual_compress reaches the stub cleanly. Capture force in the call record and assert call["force"] is True so the manual-/compress contract from fix(compress): abort instead of dropping messages when summary LLM fails #28102 is covered by an explicit regression check rather than swallowed by the TypeError → except Exception path.

How to Test

  1. Reproduce the baseline failure on clean origin/main:
    uv run --with pytest --with pytest-xdist --with pytest-asyncio python3 -m pytest tests/test_cli_manual_compress.py -v
    → fails with ❌ Compression failed: DummyAgent._compress_context() got an unexpected keyword argument 'force' and assert 0 == 1.
  2. Apply this PR and rerun the same command → passes (1 passed).

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (test(cli):)
  • I searched for existing PRs to make sure this isn't a duplicate — only fix: unblock current PR CI drift #27931 was touching CI drift and it covers the kanban dashboard fixture, not this test.
  • My PR contains only changes related to this fix (one test file)
  • I've run focused tests for the touched code and all pass
  • I've added an explicit assertion for the production contract (call["force"] is True)
  • I've tested on my platform: macOS 15.x

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — N/A, test-only change
  • I've updated cli-config.yaml.example if I added/changed config keys — N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — test is platform-independent
  • I've updated tool descriptions/schemas if I changed tool behavior — N/A

Screenshots / Logs

Baseline failure on origin/main (from PR #24395's CI run, 2026-05-18):

FAILED tests/test_cli_manual_compress.py::test_manual_compress_does_not_pass_cached_system_prompt - assert 0 == 1
  ❌ Compression failed: DummyAgent._compress_context() got an unexpected keyword argument 'force'

Local run after this PR:

tests/test_cli_manual_compress.py::test_manual_compress_does_not_pass_cached_system_prompt PASSED
======================== 1 passed in 122.65s ========================

Audited siblings: the other compression-test fallout from PR #28102 lives in tests/run_agent/test_compression_boundary_hook.py (MagicMock auto-creates a truthy _last_compress_aborted and steers the production code into the abort branch). That's addressed in #27659 — different test file, different root mechanism, kept separate to keep each diff minimal. No further widening needed.

PR NousResearch#28102 added a ``force=True`` argument to the manual /compress code
path so users can bypass the auto-compress summary-failure cooldown.
``cli.HermesCLI._manual_compress`` now passes ``force=True`` when
forwarding to ``agent._compress_context`` (cli.py:9194), but the
``DummyAgent._compress_context`` stub in test_cli_manual_compress.py
doesn't accept ``force=``.

Result on origin/main: the stub raises ``TypeError: got an unexpected
keyword argument 'force'``, the try/except in _manual_compress prints
``❌ Compression failed`` and the conversation history is never
replaced. The test then fails at ``assert len(cli.agent.calls) == 1``
because the append never ran. This shows up as a baseline failure on
every open PR's CI.

- Add ``force=False`` to the DummyAgent signature so the real
  ``cli._manual_compress`` call reaches the stub cleanly.
- Capture ``force`` in the call record and assert ``call["force"] is
  True`` so the manual-/compress contract from NousResearch#28102 is now covered
  by an explicit regression check rather than masked by a TypeError.
Copilot AI review requested due to automatic review settings May 19, 2026 02:06
@alt-glitch alt-glitch added type/test Test coverage or test infrastructure P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels May 19, 2026
@briandevans

Copy link
Copy Markdown
Contributor Author

Closing — superseded by commit 19128108a (fix(tests): catch up six stale tests after compression/aux/kanban changes, PR #28465). That commit's cli_manual_compress bullet covers exactly this fix:

- cli_manual_compress: accept force kwarg on DummyAgent._compress_context
  (cli._manual_compress now passes force=True)

Thanks for batching the four stale-fixture fixes together — keeps the queue clean.

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

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/test Test coverage or test infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants