Skip to content

fix(mcp): don't call an update with no rebuild "updated" (SHIP-558) - #94

Merged
akshaykalia merged 6 commits into
mainfrom
feature/ship-558-update-reports-change
Nov 5, 2026
Merged

akshaykalia merged 6 commits into
mainfrom
feature/ship-558-update-reports-change

Conversation

@akshaykalia

@akshaykalia akshaykalia commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

SHIP-558. update_application answered updated for 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.

  • Core now sends rebuild_queued and build_in_progress (shipyardbuild/shipyard#4102). When no build was queued the tool answers not_rebuilt, or build_in_progress if an earlier build is unfinished, with the app in data as usual.
  • The name says what's known. A trial ending mid-request can save a change without a build, so unchanged would be wrong there. An expired trial otherwise gets a 409 from core, which passes through as needs_action.
  • An earlier build can still be unfinished, as after a timed-out update that's retried, and it can replace what's deployed. Orgs that don't cancel builds on a new one can have an older build land after a newer one, so the answer says so directly rather than sending agents to read build history. That also works for a stopped app with no RUNNING build, and for a token without envs:read. docs/mcp.md says the same.
  • get_environments can't say whether a build is coming: processing is false during a rebuild on an app that's still serving.
  • rebuild_environment, restart_environment, revive_environment, deploy_detached and update_branches now pass a refusal with a next_step through as needs_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, ParseAPIError kept only the message, so BusinessError now keeps the API error as its cause.
  • A core that doesn't send rebuild_queued leaves updated, so either side can ship first. not_rebuilt and build_in_progress appear once both are live.
  • Both statuses log under their own name instead of ok, so they can be counted. docs/mcp.md lists them.

Checked

  • go test ./..., go vet ./..., go build ./... on the last commit.
  • The new test for not_rebuilt failed before the fix.
  • TestRefusalWithNextStepReachesTheAgent failed for all five tools before the fix.
  • 12 core answers against a local stub, including core's 409 trial_ended body: only a false bool with an app gives not_rebuilt. A missing, null or wrong-type field stays updated, needs_action passes through and a 500 stays an error.
  • golangci-lint run ./pkg/mcp/...: 7 issues, all in stdio_test.go and errors.go, which this PR doesn't touch.

Not checked

  • Not deployed. This needs core's change on QA, then a real route change and a repeat of it through the hosted server.
  • That core finishes a request after the client gives up at 20s. The retry case in the text comes from reading the code.
  • build_in_progress uses core's any_builds_processing, the same signal as the app's processing. A build row stranded unfinished would keep answering build_in_progress. This comes from reading the code, not a live build.
  • The last commit, 6bcdc81, had no review pass.

Open

  • One bool can't separate "nothing changed" from "saved but not built" when a trial ends mid-request. Core adds no reason for now: an expired trial gets the 409, and no_change would overclaim while an earlier request's build runs.
  • The text names no next step, and the hosted server has no rebuild or restart tool.

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.
@akshaykalia
akshaykalia merged commit 80aa5fb into main Nov 5, 2026
6 checks passed
@akshaykalia
akshaykalia deleted the feature/ship-558-update-reports-change branch November 5, 2026 19:55
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