Files
cleveragents-core/tools/controller
drew 1e27039555 feat(controller): render CI raw_log_excerpt + target_url in worker prompts
Phase 1j shipped prefetch + parsers; Phase 1i shipped the prompt
templates. But the prompt's CI-summary section only rendered each
failing gate's name, status, and summary_line — the raw_log_excerpt
(up to 16KB captured per gate) and target_url were sitting in the
input_payload dict, never surfaced to the LLM.

Impact: for stub-parser gates (7 of 10 tools — robot_framework,
bandit, semgrep, vulture, radon, slipcover, build), the implementer
saw "parser pending; see raw_log_excerpt" with no log in the prompt.
It would have to shell out via OpenCode to re-fetch the log, which
is wasteful and a regression vs the existing pipeline.

This commit:
- Renders ``target_url`` as ``log: <url>`` for failing gates so the
  LLM can curl it if needed.
- Renders ``raw_log_excerpt`` inside a fenced code block, truncated
  to 3KB per gate (storage cap is 16KB; trim to prompt-friendly
  size with a marker preserving the original byte count).
- Renders ``composite_findings`` as nested sub-findings (security_scan
  → bandit head + semgrep/vulture children, each with their own
  excerpt) so multi-tool gates are first-class in the prompt.
- Skips the fence + URL for passing gates (already filtered) and
  for failures with no excerpt (defensive — keeps clean parsers
  from emitting empty log blocks).

Conversion: the 20% of CI failures handled by stub parsers go from
"broken — implementer doesn't see the log" to "less structured —
implementer sees the raw log and can reason about it." Real parsers
still ship in priority order as a follow-up.

Tests (+7 in TestCIFailureRendering, 0 regressions):
- target_url rendered for failing gate
- target_url skipped for passing gate
- raw_log_excerpt rendered in markdown code fence
- Long log excerpt truncated with marker
- Missing excerpt → no log block (no empty fence)
- composite_findings render as sub-findings with their own excerpts
- Stub-parser-pending failure now surfaces the actual log (the
  whole point of the commit)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 15:00:28 -04:00
..