Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 439f4fd

Browse files
authored
fix(coderd/x/chatd): clarify the no-workspace tool error message (#29237)
The old message, "no workspace is associated with this chat," read like a general chat error and did not make clear that the *tool call itself* needed a workspace. Smaller/local models tend to misread vague tool errors as a hard stop, so the new wording says directly what is missing and what to do: "this tool requires a workspace and this chat does not have one." Fixes CODAGT-1029 > Generated by Coder Agents on behalf of @bpmct.
1 parent e868204 commit 439f4fd

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

coderd/x/chatd/chatd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ func (c *turnWorkspaceContext) loadWorkspaceAgentLocked(
623623
}
624624

625625
if !chatSnapshot.WorkspaceID.Valid {
626-
return chatSnapshot, database.WorkspaceAgent{}, xerrors.New("no workspace is associated with this chat. Use the create_workspace tool to create one")
626+
return chatSnapshot, database.WorkspaceAgent{}, xerrors.New("this tool requires a workspace and this chat does not have one. Use the create_workspace tool to create one")
627627
}
628628

629629
if chatSnapshot.AgentID.Valid {

coderd/x/chatd/store_chat_attachment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (p *Server) storeChatAttachment(
3535
data []byte,
3636
) (chattool.AttachmentMetadata, error) {
3737
if !chatSnapshot.WorkspaceID.Valid {
38-
return chattool.AttachmentMetadata{}, xerrors.New("no workspace is associated with this chat. Use the create_workspace tool to create one")
38+
return chattool.AttachmentMetadata{}, xerrors.New("this tool requires a workspace and this chat does not have one. Use the create_workspace tool to create one")
3939
}
4040

4141
storedName, mediaType, err := chatfiles.PrepareStoredFile(name, detectName, data)

coderd/x/chatd/store_chat_attachment_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func TestStoreChatAttachment_NoWorkspace(t *testing.T) {
159159
server := &Server{db: db}
160160

161161
attachment, err := server.storeChatAttachment(context.Background(), database.Chat{}, "build.log", "build.log", []byte("build output"))
162-
require.ErrorContains(t, err, "no workspace is associated")
162+
require.ErrorContains(t, err, "this tool requires a workspace")
163163
require.Equal(t, chattool.AttachmentMetadata{}, attachment)
164164
}
165165

0 commit comments

Comments
 (0)