fix: keep new agent bootstrap in user scope#2784
Open
Eilen6316 wants to merge 1 commit intobytedance:mainfrom
Open
fix: keep new agent bootstrap in user scope#2784Eilen6316 wants to merge 1 commit intobytedance:mainfrom
Eilen6316 wants to merge 1 commit intobytedance:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the “New Agent” bootstrap flow so that a named custom agent is only persisted after the bootstrap/save sequence completes, and it is always persisted under the authenticated user’s scope (not the default user bucket).
Changes:
- Frontend no longer pre-creates an empty custom agent; instead it passes
agent_namein the initial bootstrap message context. - Gateway stamps the authenticated
user_idinto the run context so background tool execution can reliably persist user-scoped files. setup_agentnow prefersruntime.context["user_id"](when present) to avoid falling back todefaultwhen ContextVars aren’t available.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/core/i18n/locales/zh-CN.ts | Updates bootstrap copy to instruct designing SOUL.md before saving. |
| frontend/src/core/i18n/locales/en-US.ts | Updates bootstrap copy to reflect the revised save-first flow. |
| frontend/src/app/workspace/agents/new/page.tsx | Removes empty-agent pre-creation and forwards agent_name via message context. |
| backend/tests/test_setup_agent_tool.py | Adds regression coverage ensuring runtime user_id is used when ContextVar user is missing. |
| backend/tests/test_gateway_services.py | Adds test ensuring authenticated user_id overrides any client-supplied user_id in run context. |
| backend/packages/harness/deerflow/tools/builtins/setup_agent_tool.py | Uses runtime context user_id for user-scoped agent persistence. |
| backend/app/gateway/services.py | Injects authenticated user_id into run context before background execution. |
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.
Summary
Closes #2782
Tests