Skip to content

fix: prompt module hardening — null guard, token preflight, dead code removal#708

Merged
Muizzkolapo merged 3 commits into
mainfrom
fix/prompt-hardening
Jun 19, 2026
Merged

fix: prompt module hardening — null guard, token preflight, dead code removal#708
Muizzkolapo merged 3 commits into
mainfrom
fix/prompt-hardening

Conversation

@Muizzkolapo

Copy link
Copy Markdown
Owner

Summary

  • P0: Raise ConfigValidationError on prompt: null for LLM actions — was silently falling back to generic "Process the following content" prompt
  • P1: Token overflow guard now always runs with default 128K limit when model_name not provided — previously Groq, Cohere, Gemini, and all non-json paths bypassed the check entirely
  • P1: Wrap skipped-dependency re-render in try/except for proper TemplateVariableError — second UndefinedError was surfacing as misleading template blame
  • P2: Raise ConfigurationError on seed namespace collision — was logging warning then silently overwriting action output with static seed data
  • P3: Remove dead _enrich_source_namespace (zero production callers, confirmed by grep)
  • P3: Remove dead replace_field_references, resolve_field_reference, parse_field_references (zero production callers — Jinja2 templating replaced this)

Verification

  • ruff format --check + ruff check: clean
  • pytest: 7483 passed, 2 skipped
  • Pi consensus: 4/5 YES (near consensus — 1 reviewer asked about dead code removal justification, confirmed zero callers)
  • Smoke test: first 4 LLM actions completed successfully; later steps hit Ollama Cloud rate limit (external, not framework)

… removal

- Raise ConfigValidationError on prompt:null for LLM actions (was silent fallback)
- Token overflow guard always runs with default 128K limit when model unknown
- Wrap skipped-dep re-render in try/except for proper TemplateVariableError
- Raise ConfigurationError on seed namespace collision (was warn+overwrite)
- Remove dead code: _enrich_source_namespace (zero callers)
- Remove dead code: replace_field_references and helpers (zero callers)
dict.get() requires str key but model_name is str | None.
Use conditional expression to handle None explicitly.
…en guard

- service.py: Remove try/except around re-render — inner TemplateVariableError
  was caught by outer except Exception handler, double-wrapping the error.
  UndefinedError now propagates to the rich diagnostics handler directly.
- message_builder.py: Collapse 4-line ternary to single line (dict.get handles
  None key correctly, ternary only needed for mypy).
- scope_application.py: Shorten 4-line comment to 1-line.
@Muizzkolapo Muizzkolapo merged commit 6825332 into main Jun 19, 2026
5 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 19, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant