Skip to content

fix: prevent AI solver from ignoring changed/expanded requirements#1566

Open
konard wants to merge 4 commits into
mainfrom
issue-1565-3f094bcfa678
Open

fix: prevent AI solver from ignoring changed/expanded requirements#1566
konard wants to merge 4 commits into
mainfrom
issue-1565-3f094bcfa678

Conversation

@konard

@konard konard commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1565

  • Root cause identified: When users expand scope via PR comments (e.g., "sync ALL features, not just temperature"), the AI solver acknowledges the requirement but then silently narrows scope back to the original issue title. This happened 3 times in agent#244 ($15+ wasted, user had to repeat themselves 3x).
  • Fix 1: Include latest reviewer comment verbatim in the continue-mode prompt (solve.feedback.lib.mjs) so requirements are embedded directly in context, not discovered through tool use
  • Fix 2: Add "Scope management" instructions to all prompt variants (claude, opencode, codex, agent) that explicitly forbid silent scope narrowing when a reviewer expands requirements

Root Cause

The AI model has a built-in tendency toward minimal changes that conflicts with explicit user instructions that expand scope. Key evidence from logs:

AI (after reading "sync ALL features, not only temperature"):
"The scope of this PR is the --temperature option, so I'll create proper integration tests for the temperature feature in rust/tests/"

The AI correctly understood 5 requirements from the user's comment, then decided to only implement 1 of them.

Changes

File Change
src/solve.feedback.lib.mjs Include latest reviewer comment verbatim in prompt with "MUST address" framing
src/claude.prompts.lib.mjs Add "Scope management" section to system prompt
src/opencode.prompts.lib.mjs Add "Scope management" section to system prompt
src/codex.prompts.lib.mjs Add "Scope management" section to system prompt
src/agent.prompts.lib.mjs Add "Scope management" section to system prompt
docs/case-studies/issue-1565/README.md Full case study with timeline, root cause, evidence
docs/case-studies/issue-1565/improvements.md Detailed improvement proposals with code
CHANGELOG.md Version 1.50.0 release notes
package.json Bump to 1.50.0

Test plan

  • eslint passes on all modified source files
  • Pre-existing test suite passes (1 pre-existing failure unrelated to changes)
  • Verified feedback module correctly includes latest reviewer comment body in prompt
  • Scope management instructions added consistently to all 4 prompt variants

How to verify the fix works

After this change, when a reviewer posts a comment on a PR and the AI solver restarts:

  1. The reviewer's comment body will appear directly in the user prompt (not just "New comments: 1")
  2. The system prompt will instruct the AI not to narrow scope when the user has expanded it
  3. If the AI believes scope is too large, it must comment asking for confirmation instead of silently reducing

🤖 Generated with Claude Code

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #1565
@konard konard self-assigned this Apr 10, 2026
…1565)

Root cause: When users expand scope via PR comments (e.g., "sync ALL
features, not just temperature"), the AI solver would acknowledge the
requirement but then silently narrow scope back to the original issue
title. This happened 3 times in agent#244 before compliance.

Two fixes:
1. Include latest reviewer comment verbatim in the continue-mode prompt
   (solve.feedback.lib.mjs) so requirements are impossible to miss
2. Add "Scope management" instructions to all prompt variants that
   explicitly forbid silent scope narrowing

Case study with full timeline and root cause analysis included.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] AI solver refuses to comply with changed requirements fix: prevent AI solver from ignoring changed/expanded requirements Apr 10, 2026
@konard
konard marked this pull request as ready for review April 10, 2026 21:43
@konard

konard commented Apr 10, 2026

Copy link
Copy Markdown
Contributor Author

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $3.641992

📊 Context and tokens usage:

  • Context window: 112.4K / 1M (11%) input tokens, 19.4K / 128K (15%) output tokens

Total: (101.8K + 5.0M cached) input tokens, 19.4K output tokens, $3.641992 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Model: Claude Opus 4.6 (claude-opus-4-6)

📎 Log file uploaded as Gist (2177KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Apr 10, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Auto-restart triggered (iteration 1)

Reason: CI failures detected

Starting new session to address the issues.


Auto-restart-until-mergeable mode is active. Will continue until PR becomes mergeable.

Revert manual version change in package.json and manual CHANGELOG entry.
Add proper changeset file so the release workflow manages versioning
automatically. Fixes failing "Check for Changesets" and "Check for
Manual Version Changes" CI checks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard

konard commented Apr 10, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Auto-restart-until-mergeable Log (iteration 1)

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost: $0.683837

📊 Context and tokens usage:

  • Context window: 43.9K / 1M (4%) input tokens, 4.0K / 128K (3%) output tokens

Total: (33.8K + 744.6K cached) input tokens, 4.0K output tokens, $0.683837 cost

🤖 Models used:

  • Tool: Anthropic Claude Code
  • Requested: opus
  • Model: Claude Opus 4.6 (claude-opus-4-6)

📎 Log file uploaded as Gist (3928KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard

konard commented Apr 10, 2026

Copy link
Copy Markdown
Contributor Author

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

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.

AI solver refuses to comply with changed requirements

1 participant