Skip to content

test: add unit tests for 8 modules (batch 2)#62

Merged
teknium1 merged 1 commit intoNousResearch:mainfrom
0xbyt4:test/expand-coverage-2
Feb 27, 2026
Merged

test: add unit tests for 8 modules (batch 2)#62
teknium1 merged 1 commit intoNousResearch:mainfrom
0xbyt4:test/expand-coverage-2

Conversation

@0xbyt4
Copy link
Copy Markdown
Contributor

@0xbyt4 0xbyt4 commented Feb 26, 2026

Summary

  • Add 127 new unit tests covering 8 previously untested modules
  • Modules tested: model_tools, toolset_distributions, agent/context_compressor, agent/prompt_caching, tools/cronjob_tools, tools/session_search_tool, tools/process_registry, cron/scheduler
  • Found prompt injection bypass bug in _scan_cron_prompt regex (fix PR to follow)

Test details

Module Tests What's covered
model_tools 11 Function call dispatch, agent loop interception, legacy toolset map, backward-compat wrappers
toolset_distributions 15 Distribution lookup, listing, validation, probability sampling, structure checks
agent/context_compressor 15 Threshold checks, preflight, token tracking, truncation fallback, summarization path
agent/prompt_caching 12 Cache marker application (tool/string/list content), Anthropic cache control strategy, max 4 breakpoints
tools/cronjob_tools 23 Prompt scanning (injection, exfil, unicode, deception), schedule/list/remove dispatchers
tools/session_search_tool 13 Timestamp formatting, conversation formatting, truncation around matches, search dispatcher
tools/process_registry 27 Get/poll, read log, list/filter sessions, active queries, pruning, checkpoint, kill, tool handler
cron/scheduler 5 Origin resolution (full/missing/empty)

Bug found

_scan_cron_prompt regex for prompt injection (ignore\s+(previous|all|above|prior)\s+instructions) only allows ONE word between "ignore" and "instructions". Multi-word variants like "Ignore ALL prior instructions" bypass the scanner. Fix PR to follow.

Test plan

  • All 127 new tests pass locally
  • Full suite: 299 passed, 0 failed, 9 deselected (integration)
  • No regressions in existing tests
Cover model_tools, toolset_distributions, context_compressor,
prompt_caching, cronjob_tools, session_search, process_registry,
and cron/scheduler with 127 new test cases.
@teknium1 teknium1 merged commit 3526fa2 into NousResearch:main Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants