Repository navigation
fix(agent): deploy-app stops on a guessed app name, --new-app adds one on purpose (#57) - #368
Merged
Merged
Conversation
On a recorded walkthrough this cost the user their running app (BUGS.md #57). `stacker agent apps` printed the app as `hello`; `deploy-app hello` came back "no such service: hello" without naming anything that would work, so the only name left to try was the one visible in the compose - `app`. That went through, and the agent named the remote stack's directory, and therefore its compose project, after it: a second stack came up beside the running one, could not see or replace it, and died on `Bind for 0.0.0.0:3000 failed: port is already allocated` while the original container was left orphaned in a compose project nothing could reach any more. `deploy-app` now reads the deployment's apps before sending anything and stops on a name that is not among them, naming the ones that are and saying why it stopped: 'app' is not an app of this deployment. Apps here: hello. Deploying a name the deployment does not know would create a second stack on the server beside the running one, and the two would fight over the same ports - so this stops here. It fails open: an empty or unavailable snapshot is not evidence of a wrong name, so the check stays out of the way rather than blocking a deploy it cannot judge. This closes the way in, not the underlying design - the agent is still bound to a deployment and still takes its compose project name from the app code it is handed. #57 keeps both, with the fixes in order. Tests: 5, including the exact shape of the incident (apps = [hello], deploy `app` → refused), a known app passing, an empty list not blocking, every known app appearing in the refusal, and entries without a code being ignored. agent::tests 69 passed. rustfmt clean on the file; the one clippy note in it (`.args(&ssh_args)`, line 2557) is pre-existing and untouched. Co-Authored-By: Claude Opus 5 <[email protected]>
Correcting my own previous commit on this branch, which refused every name the deployment does not know. Vasili pointed out what that breaks: adding a service with `deploy-app <new-name>` is exactly how you add one, and a wall there is worse than the bug it guards. What is actually wrong is not the unknown name, it is arriving at it by guessing - which is what happened in #57, after `no such service: hello` named no alternative. So the check now asks instead of refusing: 'app' is not an app of this deployment. Apps here: hello. Deploying an unknown name adds a second stack on the server beside the running one; the two cannot replace each other and will fight over the same published ports. If you meant to update an existing app, use one of the names above - `stacker agent apps` lists them with their images. If you meant to add a new one, repeat the command with --new-app. With `--new-app` the deploy proceeds and prints which apps were already there, so adding a service stays one flag away and never happens by accident. Tests, 7 unit and 2 integration: the incident's exact shape still refused, a known app passing, an empty snapshot not blocking, every known app named in the refusal, both ways out named in the refusal, `--new-app` allowing the add, and - at the CLI level, where a unit test cannot reach - that the flag is wired and documented in `deploy-app --help`. Full library suite: 2362 passed, 0 failed, 6 ignored. rustfmt clean on all three files; clippy reports nothing in the new code. Co-Authored-By: Claude Opus 5 <[email protected]>
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.
What happened
On a recorded walkthrough,
deploy-apptook down a running app and left acontainer nothing in the product could reach (BUGS.md #57).
stacker agent appsprinted the app as hello.stacker agent deploy-app hello …answeredno such service: hello, andnamed no alternative - the compose on the server calls that service
app.app, so that was tried.project, after the app code it is handed. A second compose project came
up beside the running one, could not see or replace it, and failed with
Bind for 0.0.0.0:3000 failed: port is already allocated. The originalcontainer was now an orphan of a project nothing addresses - every platform
container operation is keyed by
app_code(
src/mcp/tools/monitoring.rs:721), so clearing it tookdocker rm -fover SSH, during a recording whose premise is not needing SSH.
What this changes
The problem is not the unknown name -
deploy-app <new-name>is how you adda service - it is arriving at one by guessing. So the command asks instead of
refusing:
--new-appproceeds and prints which apps were already there. The checkfails open: an empty or unavailable snapshot is not evidence of a wrong
name, so a deploy it cannot judge is never blocked.
Scope
This closes the way in, not the design. The agent is still bound to a
deployment and still derives its compose project name from the app code it is
handed; #57 keeps both, with the remaining fixes in order - accept the app
code the product prints, refuse a second compose project server-side, keep the
project name stable, resolve by heartbeat, and make timeout hints name a
deployment that can answer.
A naming question worth deciding separately, raised by the same incident:
whether updating an existing app should be
stacker agent update <app>withdeploy-appreserved for adding one. That is a product decision, not part ofthis diff.
Tests
7 unit, 2 integration:
app→ refused, withthe list and the reason
--new-appallows the adddocumented in
deploy-app --helpFull library suite: 2362 passed, 0 failed, 6 ignored. rustfmt clean on all
three files; clippy reports nothing in the new code (the pre-existing notes in
agent.rsare untouched).🤖 Generated with Claude Code