Repository navigation
fix(sandbox): resolve an existing sandbox's spec with a default fallback - #965
Merged
Merged
Conversation
Runtime-api advertises only the current agent-server image, so after an image bump every sandbox created on the previous image has no sandbox spec. #903 handled that for conversation start. The other callers that look up an existing sandbox's spec each handled the missing spec in their own way: the conversation router fell back with a generic warning, the file-read endpoint returned an empty string, the post-resume git identity restore raised and was swallowed, and archive path resolution raised for conversations without a pinned workspace path. All of them read only working_dir from the spec, which the default spec shares. - Add resolve_existing_sandbox_spec() next to resolve_sandbox_spec(): the sandbox's own spec when it is still advertised, otherwise the default spec plus a warning naming the image, the sandbox and the pick. - Use it in _start_app_conversation, _get_agent_server_context, read_conversation_file, _restore_git_user_settings_after_resume and _resolve_archive_path. - Cover the helper and each caller on a sandbox whose image is no longer advertised. Refs #902
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
tofarr
requested changes
Oct 22, 2026
…cService Make the existing-sandbox spec lookup a method on SandboxSpecService, next to get_default_sandbox_spec, instead of a module-level helper that takes the service as an argument. The warning now comes from the spec service's own logger, so callers no longer pass one in. Caller tests mock the new method; the tests for a sandbox whose image is no longer advertised use a PresetSandboxSpecService, so they still run the real fallback through each caller.
Contributor
|
🚀 Released in 1.78.0. |
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.
HUMAN:
AGENT:
Why
Runtime-api advertises only the current agent-server image, so after an image bump every sandbox created on the previous image has no sandbox spec. #903 fixed conversation start by falling back to the default spec. Four other places look up an existing sandbox's spec, and each handled the missing spec in its own way:
_get_agent_server_contextread_conversation_file'', so PLAN.md came back blank_restore_git_user_settings_after_resume_resolve_archive_pathAll five callers read exactly one field from the spec,
working_dir, which the default spec shares for the stock images.Summary
SandboxSpecService.resolve_existing_sandbox_spec(), next toget_default_sandbox_spec(): the sandbox's own spec when it is still advertised, otherwise the default spec plus a warning naming the image, the sandbox and the spec it picked. The docstring confines it toworking_dir._start_app_conversation,_get_agent_server_context,read_conversation_file,_restore_git_user_settings_after_resumeand_resolve_archive_path, replacing the five ad-hoc checks.Issue Number
Refs #902, the second of the three PRs planned there (Linear OHE-3675). The grouping change is the third PR, opened separately.
How to Test
New tests, all of which fail on
main:test_resolve_existing_sandbox_spec_returns_the_sandbox_specandtest_resolve_existing_sandbox_spec_falls_back_to_the_defaultTestReadConversationFile::test_reads_from_sandbox_whose_image_is_no_longer_advertisedtest_restore_git_identity_in_sandbox_whose_image_is_no_longer_advertisedTestArchiveConversationWorkspace::test_resolve_archive_path_legacy_unadvertised_imageOn a deployment after an agent-server bump: pick a sandbox still on the previous image and start a conversation in it with an explicit
sandbox_id.GET /api/v1/app-conversations/{id}/file?file_path=/workspace/project/PLAN.mdreturns the file instead of an empty body, and after pausing and resuming the sandboxgit config --global user.nameinside it is set again. The app-server logsSandbox spec <old image> not found for sandbox <id>; using default spec <current image> (working_dir=/workspace/project).Video/Screenshots
None (backend only).
Type
Notes
working_diris still not persisted on the sandbox row. If that is added later, this method is the one place that changes.working_dir. A custom warm config with a differentworking_dirwould make that path empty; the stock configs all use/workspace/project._get_agent_server_contextlogs the warning on every hooks/skills/files request for an old-image sandbox, as it already did with the generic message.Enterprise server image for this PR: