Repository navigation
fix(sandbox): THREAD_SANDBOX_START resolves the repository before creating a chat - #8436
Merged
Merged
Conversation
pedrofrxncx
enabled auto-merge (squash)
November 10, 2026 19:10
decocms Bot
pushed a commit
that referenced
this pull request
Nov 10, 2026
PR: #8436 fix(sandbox): THREAD_SANDBOX_START resolves the repository before creating a chat Bump type: patch - decocms (apps/api/package.json): 4.568.0 -> 4.568.1 Deploy-Scope: server
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 is this contribution about?
Without a
threadId,THREAD_SANDBOX_START(#8434) created the chat first and only then looked uprepository. An unknown or ambiguous repository (deco sandbox new --repo owner/typo) failed after the chat existed, which left an empty "New chat" in the organization's chat list.The repository is now resolved, along with the default-agent rule and the user check, before the chat is created, so every refusal comes first and leaves nothing behind. Behavior for valid input is unchanged.
How did you verify your code works?
apps/api/src/tools/sandbox/thread-start.test.ts: new case "refuses an unlinked repository before creating a chat". It asserts the create is never called. It fails on main (create called once) and passes with this change. The existing cases (creates on the default agent, refuses a repository for a project, rejectsthreadId+virtualMcpId) still pass.tsc --noEmit(api),oxlint,knipclean.new --repo,exec(exit code, stderr, argv quoting),chat(agent wrote a file,execread it back), and the tool withoutthreadIdall worked. Only the unknown-repository case left an orphan chat. The test chats were deleted afterwards.How to Test
deco sandbox new --org <slug> --repo <owner>/does-not-exist→ fails and lists the linked repositories.deco tools call COLLECTION_THREADS_LIST --org <slug> -d '{"limit":3}'→ no new empty chat.Review Checklist
Summary by cubic
Fixes
THREAD_SANDBOX_STARTleaving an empty "New chat" behind when the supplied repository doesn't exist or is ambiguous. The repository, user ID, and default-agent rule are now resolved before the chat is created, so every refusal happens first and nothing is saved. Behavior for valid input is unchanged. A new test asserts the chat create is never called for an unlinked repository.Written for commit 5bf0ede. Summary will update on new commits.