Skip to content

fix: sanitize LLM-sourced quality gate commands#29

Merged
mark-dingwall merged 1 commit into
mainfrom
fix/quality-gate-backtick-sanitization
Apr 15, 2026
Merged

fix: sanitize LLM-sourced quality gate commands#29
mark-dingwall merged 1 commit into
mainfrom
fix/quality-gate-backtick-sanitization

Conversation

@mark-dingwall

Copy link
Copy Markdown
Owner

Summary

  • LLM responses wrapped in inline backticks (`command`) stored verbatim in project config. Shell interpreted backticks as command substitution → exit 127 on every quality gate run.
  • LLM-sourced commands were never invalidated on failure, leaving a permanent stuck state.

Three-layer fix

  • sanitizeLLMResponse() strips inline backticks and leading $ prompts.
  • ensureQualityConfig() retroactively sanitizes existing poisoned configs.
  • quality-gate-runner flags failed LLM commands as llm-failed for re-detection.

Test plan

  • New tests/quality-detection.test.js cases for sanitizer + config repair.
  • tests/quality-gate.test.js updated to exercise failure → re-detection path.

🤖 Generated with Claude Code

LLM responses wrapped in inline backticks (`command`) were stored verbatim
in project config. Shell interpreted backticks as command substitution,
causing exit 127 on every quality gate run. Additionally, LLM-sourced
commands were never invalidated on failure, creating a permanent stuck state.

Three-layer fix:
- sanitizeLLMResponse() strips inline backticks and leading $ prompts
- ensureQualityConfig() retroactively sanitizes existing poisoned configs
- quality-gate-runner flags failed LLM commands as llm-failed for re-detection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mark-dingwall mark-dingwall merged commit 65f5e79 into main Apr 15, 2026
7 checks passed
@mark-dingwall mark-dingwall deleted the fix/quality-gate-backtick-sanitization branch April 16, 2026 06:02
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.

1 participant