Repository navigation
fix(mcp): fill env services from the plan when a client drops an empty array (SHIP-670) - #95
Merged
Merged
Conversation
…y array (SHIP-670) Kiro drops empty arrays from tool arguments, so an interpolated variable the plan lists with services [] reached create_application with no services and was refused. When an env item has no services, take them from the plan at the confirmed head_sha; refuse as before when the plan can't give them (unreadable or needs_action, branch moved, variable not listed, or a compose_filename the plan can't see). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hy a fill was skipped (SHIP-670) The fill gave up whenever compose_filename was set, but the create schema asks agents to pass it when the plan's compose_file is not the default, so an agent echoing the plan's own file still hit the refusal. It now reads the plan first and gives up only when compose_filename names a different file. When an item is still left without services, the refusal says why (the branch moved, the plan could not be read, the plan lists no such variable) and the reason is logged, names only. A client that drops [] can't follow "pass []", so it needs the next step instead. Tests now require every filled variable, check the build arg's services, and cover a plan request that fails and a plan body that isn't JSON.
…670) When core answers the plan with an action-required error, such as installing the GitHub app, the refusal said the plan could not be read. plan_application passes that answer through, so the refusal now points the agent at it too. Tests: the old "env item without services" case answered the new plan request from a server with no status, so it passed through a handler panic. It now gets a plan that doesn't list the variable and checks the reason and that no create is sent. A new test checks that items arriving with services, an explicit [] included, skip the plan and keep their own services.
akshaykalia
approved these changes
Nov 12, 2026
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.
SHIP-670. Kiro launch blocker, needed for tomorrow's demo.
In Kiro,
create_applicationon the hosted server fails for every env var the plan lists withservices: [], which is every variable a Compose file interpolates as${NAME}: "env[0].services is required". The agent sends[], but Kiro drops empty arrays from tool arguments, so the field arrives missing. Our side accepts[]: the hosted server passes arguments through unchanged, andjson.Unmarshalgives a non-nil empty slice.Fix
fillEnvServicesruns inexecuteCreatebeforecheckEnvItems. When any env item has noservices, it reads the plan and gives each such item the services the plan lists for its name and kind. Interpolated variables get[]back.It changes nothing, so
checkEnvItemsstill refuses the item, when:needs_action(the refusal then points the agent atplan_applicationand itsnext_step)head_shadiffers from the confirmed one (the branch moved)compose_filenamenames a different file than the plan'scompose_file. Passing the plan's own file still gets the fill, since the schema asks agents to passcompose_filenamewhen the plan's file isn't the default.When an item is refused this way, the refusal says why, for example "the branch has moved past head_sha: run plan_application again and confirm the new plan". A client that drops
[]can't follow "pass []", so it gets the step it can actually take. The reason is also logged, with names only, never values.The "no value reaches every service by accident" guarantee holds: services come from the plan of the commit the user confirmed, never from a guess. It costs one extra plan request, and only when an item is missing
services. Items that arrive withservicesare untouched.Tests
TestCreateApplicationFillsMissingEnvServicesFromPlan: an interpolated variable gets[], a scoped one gets[api], and a build arg gets[web], from the plan, both withoutcompose_filenameand with the plan's own compose file. Every filled variable must be present. It fails on main with Kiro's exact error.TestCreateApplicationRefusesEnvServicesThePlanCantGive: 8 refusal cases (the ones above, aneeds_actionanswered with HTTP 409, a plan request that fails with HTTP 500, and a plan body that isn't JSON). Each still errors with its reason, and none sends a create.TestCreateApplicationKeepsGivenEnvServices: items that arrive with services, an explicit[]included, keep them, and the plan is never requested.go test ./...andgo vet ./...pass.golangci-lintshows only the 7 issuesmainalready has, none in files this PR touches.docs/mcp.md: one sentence on thecreate_applicationrow.After merge
Release and deploy the hosted server, then I'll rerun the T6 create in Kiro with
GREETINGset.🤖 Generated with Claude Code