Repository navigation
fix(mcp): don't call an update with no rebuild "updated" (SHIP-558) - #94
Merged
Merged
Conversation
update_application answered "updated" for a request that matched the app's config, which reads as a build on its way. A stopped app stays stopped then, and new commits aren't picked up. Core now says whether it queued a build, and the tool answers not_rebuilt when it didn't. A core too old to say leaves "updated".
not_rebuilt is only true of the request that got it. The text told agents not to wait for a build, but a timed-out update that's retried gets it while the first request's build runs. It also read as a no-op for a change saved on an expired trial. Point at get_build_history, since get_environments shows processing false during a rebuild on an app that's still serving.
Core now refuses an update on an expired trial with next_step trial_ended before writing anything (shipyard#4102), so that request answers needs_action, not not_rebuilt, and nothing is saved. needsActionNote already covers it.
"May still be running" collided with build history, where RUNNING is the deployed end state, so a healthy app could read as a build on its way. Say "in progress" and define RUNNING. An older build that was replaced can look unfinished forever, because it's cancelled without reporting a status. Only a build newer than the latest RUNNING one can still be in progress, so say that too.
…s (SHIP-558) Core now refuses environment writes on an expired trial with a 409 carrying next_step (shipyard#4102). Only update_application read it. rebuild, restart, revive, deploy_detached and update_branches gave the agent the error text, with no link to act on. They now pass the answer through as needs_action. For rebuild, restart and revive, ParseAPIError kept only the message, so BusinessError now keeps the API error as its cause.
… (SHIP-558) The text told agents only a build newer than the latest RUNNING one can be in progress. That's false for orgs that don't cancel builds on a new one, where an older build can finish and replace a newer deploy. It also gave no anchor for a stopped app with no RUNNING build, and sent tokens without envs:read to a tool they don't have. Core now sends build_in_progress, so the answer says it directly: not_rebuilt when no build is unfinished, build_in_progress when an earlier one is. Neither needs get_build_history. Both statuses now log under their own name instead of ok, so they can be counted.
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-558.
update_applicationansweredupdatedfor a request that matched the app's config. No build follows then, so a stopped app stays stopped and new commits aren't picked up, but the answer reads as a build on its way.rebuild_queuedandbuild_in_progress(shipyardbuild/shipyard#4102). When no build was queued the tool answersnot_rebuilt, orbuild_in_progressif an earlier build is unfinished, with the app indataas usual.unchangedwould be wrong there. An expired trial otherwise gets a 409 from core, which passes through asneeds_action.RUNNINGbuild, and for a token withoutenvs:read.docs/mcp.mdsays the same.get_environmentscan't say whether a build is coming:processingis false during a rebuild on an app that's still serving.rebuild_environment,restart_environment,revive_environment,deploy_detachedandupdate_branchesnow pass a refusal with anext_stepthrough asneeds_action, so an agent gets the link as well as the message. Core answers these with a 409 on an expired trial (shipyardbuild/shipyard#4102). For the first three,ParseAPIErrorkept only the message, soBusinessErrornow keeps the API error as its cause.rebuild_queuedleavesupdated, so either side can ship first.not_rebuiltandbuild_in_progressappear once both are live.ok, so they can be counted.docs/mcp.mdlists them.Checked
go test ./...,go vet ./...,go build ./...on the last commit.not_rebuiltfailed before the fix.TestRefusalWithNextStepReachesTheAgentfailed for all five tools before the fix.trial_endedbody: only a false bool with an app givesnot_rebuilt. A missing, null or wrong-type field staysupdated,needs_actionpasses through and a 500 stays an error.golangci-lint run ./pkg/mcp/...: 7 issues, all instdio_test.goanderrors.go, which this PR doesn't touch.Not checked
build_in_progressuses core'sany_builds_processing, the same signal as the app'sprocessing. A build row stranded unfinished would keep answeringbuild_in_progress. This comes from reading the code, not a live build.6bcdc81, had no review pass.Open
reasonfor now: an expired trial gets the 409, andno_changewould overclaim while an earlier request's build runs.