Repository navigation
cli: wait out a busy workspace in railgrid app sync - #1192
Merged
Merged
Conversation
`app sync` hydrates the workspace and then asks for sync-development. The hydrate has already scheduled App Studio's own background dev sync, which holds the workspace for a few seconds, so the explicit sync regularly lost with a 409 and the command failed even though dev did get the tree. The sync step now retries that conflict: a 409 carrying Retry-After (App Studio's busy-workspace answer) or, from a hub that predates it, the old "wait for or stop the active assistant run" wording. Each wait follows Retry-After (3 s without one), is capped at 15 s, and the waits total at most 60 s; progress goes to stderr. "resolve or stop the active assistant run", a run that really is active, still fails at once. hubAPIError now carries the Retry-After the hub sent on REST errors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
Author
|
/approve |
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cwilhit The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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
railgrid app syncmakes two calls:hydrate-workspace, thensync-development. The hydrate already schedules App Studio's own background dev sync, which holds the workspace for a few seconds. The CLI's explicit sync regularly loses that race with a 409, so the command reports a failure even though dev received the tree. On railgrid-dev this happened on most runs; a retry about 15 seconds later succeeded. #1191 fixes the server side: the 409 now names the real cause and carriesRetry-After: 5. This PR is the client side, and it doesn't depend on #1191.What
The sync step retries a busy-workspace 409:
Retry-After(App Studio's answer after app-studio: name the real cause of a busy-workspace 409 #1191);Retry-After(3 seconds without one);railgrid app: another workspace operation (usually the sync the hydrate started) is still running; retrying in 5s…hubAPIErrorgainsRetryAfter. It accepts both delay-seconds and an HTTP date, and is filled on REST errors fromdoWithHeaders.The skill's CLI reference describes the retry.
Testing
New
pkg/cli/cmd/app_sync_retry_test.go, against the fake hub, with an injected sleep:TestAppSyncWaitsOutABusyWorkspaceRetry-After: 5, then success: three sync calls, waits[5s 5s]TestAppSyncWaitsOutALegacyBusyAnswerTestAppSyncDoesNotRetryAnActiveAssistantRunTestAppSyncGivesUpOnAWorkspaceThatStaysBusyRetry-After: 30is capped to 15 seconds; four waits use up the 60-second budget, then the 409 is returnedTestWithRetryAftergo test ./pkg/cli/cmd/(the whole package, including the existingapp synctests): passes.golangci-lint: 0 issues.make verify-boilerplate: passes.🤖 Generated with Claude Code