Repository navigation
fix(review): drop the plan input cap and tell the model it has the whole plan - #147
Merged
Merged
Conversation
…ole plan The 400k-char cap from #141 still cut real plans: PR #135's 231-destroy plan (830k chars, destroy diffs print every attribute) reached the model as 28 of 231 changes. Every other "plan is truncated" review was from before #141 (80k cut). Haiku 5.5 has a 1M-token context, so there is no default input cap now; REVIEW_MAX_PLAN_CHARS can still opt into one. The prompt now states the plan is complete (with its change count and Plan: line) and explains Terraform's own elision markers so they are not reported as truncation. A max_tokens stopReason discards the answer. The PR comment says when its 60k plan excerpt is cut. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Terraform Plan🚧 Changes detected — Plan: 0 to add, 3 to change, 231 to destroy. Plan output
LLM ReviewRisk: 🔴 HIGH Plan destroys 231 IAM resources (team guardrail policies, CI deploy/team roles and their inline policies, ECS exec roles and attachments) for every team except cake-like keys that are missing from the for_each map, while updating 3 Lambda/IAM resources in place: this looks like an accidental for_each key removal and would break CI deploys and ECS task execution across all teams.
|
Alexanderamiri
added a commit
that referenced
this pull request
Oct 24, 2026
Follow-up to #147, which merged before this review fix was pushed. ## Why With no ceiling, a plan beyond Haiku 5.5's 1M-token context fails the review with a Bedrock ValidationException, which blocks the apply until a board override. The review of #147 recommended a ceiling well above any real plan. ## What changed - `REVIEW_MAX_PLAN_CHARS` defaults to 2,000,000 chars, about 500–800k tokens and 2.4× the largest real plan (#135, 830k chars). Real plans are still sent whole. Only a pathological plan falls back to the change-list mode (every change listed, diff cut at a resource boundary, with a notice). - The prompt's `(known after apply)` explanation is corrected: the value is derived from other resources too, so judge the expression, not a value. - `post-plan-comment.sh` removes its temp file. ## Checks Both test suites pass, with new tests for real-size plans sent whole and the fallback above the ceiling. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Reviews kept saying "Plan is truncated; the remaining changes ... could not be reviewed". Where the input was actually cut:
review-plan.pyRuled out:
plan-output.txtitself. The cut was silent to humans, though, so the comment now says when it is cut.run-plan.shwrites the full-no-coloroutput with no head/tail.terraform/platform/plan-output.txt, the full file.max_tokens. Converse is still called without inferenceConfig (no maxTokens set, on purpose), but astopReason: max_tokensanswer is now discarded instead of trusted.What changed
scripts/review-plan.py: no default input cap. The whole plan goes to Haiku 5.5, which has a 1M-token context.REVIEW_MAX_PLAN_CHARSstill turns on the existing notice + change-list mode if it is set.COMPLETE PLAN(change count + thePlan:line) and says not to call the plan truncated. It also explains that Terraform hides parts of every plan by design:# (N unchanged attributes/blocks/elements hidden),(sensitive value),(known after apply)and partialjsonencodediffs are not truncation.stopReason == "max_tokens"→ returns None. Platform CI records FAILED; the Lambda retries.scripts/post-plan-comment.sh: adds a notice when the plan is cut at 60k (GitHub's comment limit) and keeps the cut-off point configurable.docs/ci-workflow.md.Trade-off: a plan larger than the model's context now fails the review (FAILED, override available) instead of being cut.
Checks
python3 -m unittest discover -s scripts/tests: 38 OK. New tests: the complete-plan declaration, the elision markers, no default cap (2M-char plan), an 830k destroy plan sent whole, max_tokens discarded, and the comment cut notice.python3 -m unittest discover -s terraform/lambda-src/tests: 63 OK. New tests: COMPLETE PLAN reaches Bedrock, and a max_tokens answer is retried.terraform fmt -check -recursive terraform: OK.shellcheck scripts/post-plan-comment.sh: OK. No workflow changes.🤖 Generated with Claude Code