Skip to content

fix(core): compile fallback report if agent misses lifecycle tool call#645

Open
Kundan-Krishna366 wants to merge 2 commits into
usestrix:mainfrom
Kundan-Krishna366:fix/report-generation-fallback
Open

fix(core): compile fallback report if agent misses lifecycle tool call#645
Kundan-Krishna366 wants to merge 2 commits into
usestrix:mainfrom
Kundan-Krishna366:fix/report-generation-fallback

Conversation

@Kundan-Krishna366

@Kundan-Krishna366 Kundan-Krishna366 commented Jul 3, 2026

Copy link
Copy Markdown

Problem

When running a penetration test with some locally hosted LLMs (for example, openai/supergemma4-26b-uncensored-v2 through LM Studio), the scan may terminate during the final reporting stage with:

Agent stopped
no reports found

Environment:

  • OS: macOS Tahoe 26.4.1
  • Strix Version: 0.8.3
  • Python Version: 3.13
  • Model: openai/supergemma4-26b-uncensored-v2 (LM Studio)

Root Cause

Near the end of a scan, large tool outputs can cause some local models to stop following the expected structured response format. Instead of invoking the finish_scan lifecycle tool, the model returns a plain text response.

Since the orchestration logic only considers the lifecycle tool as the completion signal, scan_completed remains False, causing the report generation phase to be skipped and no report to be written.

Changes

  • Added a fallback execution path in strix/core/runner.py when scan_completed is False.
  • Preserved the existing lifecycle-based report generation flow.
  • If the scan ends without a finish_scan tool call, the runner:
    • creates the reports/ directory if it does not already exist,
    • captures the final agent text response,
    • writes it to reports/report_<scan_id>_fallback.md.

This ensures that scan findings are preserved even when the model fails to emit the expected lifecycle tool call.

Validation

  • ruff format
  • ruff check
  • mypy
  • bandit
  • All pre-commit hooks passed.

Before

Penetration test completed
Generating final report...
Agent stopped

Result: No report is generated.

After

Penetration test completed
Generating final report...
[WARNING] Scan scan-a1b2c3d4 ended without a formal lifecycle tool call.
[INFO] Wrote fallback report to reports/report_scan-a1b2c3d4_fallback.md
Agent stopped

Result: A fallback markdown report is generated from the final agent output.

Closes #489

@greptile-apps

greptile-apps Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a fallback report path when a scan ends without the expected lifecycle tool call.

  • Writes a markdown fallback report from the final agent output.
  • Stores the fallback report under the scan run directory.
  • Logs the lifecycle-miss path as a warning instead of an error.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
strix/core/runner.py Adds fallback report creation under the scan run directory when finish_scan is not called.

Reviews (2): Last reviewed commit: "fix(core): update fallback report path t..." | Re-trigger Greptile

Comment thread strix/core/runner.py Outdated
@bearsyankees

Copy link
Copy Markdown
Collaborator

@greptile

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]Agent stopped when generating final report

2 participants