You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 4e32846
Browse filesBrowse the repository at this point in the historyBrowse files
agentHost: keep scratch work in workspace-less chats (#335526)
* agentHost: keep scratch work in workspace-less chats
Clarify that attachment and generated-artifact work can use the scratch directory without converting the session. Reserve workspace conversion for repository changes and project-dependent commands while preserving the confirmation and isolation requirements.\n\nCo-authored-by: Copilot <[email protected]>
* agentHost: isolate scratch customizations
Keep workspace customization discovery away from mutable Quick Chat scratch roots while retaining user-level customizations. Strengthen the workspace conversion confirmation assertion.
Co-authored-by: Copilot <[email protected]>
---------
Co-authored-by: Copilot <[email protected]>
description: 'Set the current session\'s workspace when the task should continue in a workspace not yet attached to this session. This preserves the session, chat, and conversation history. Immediately before every call to this tool, always use the available user-input tool to ask the user to confirm both the workspace and whether the work should be isolated, even if the user previously mentioned or requested those choices. Tool approval is separate and does not replace this confirmation. Set `isolation` to true to create a managed Git worktree, or false to work directly in the folder. The workspace change is deferred until the current turn ends, then the host automatically continues the original task in the selected workspace. Make this the final tool call of the turn.',
170
+
description: 'Attach a real workspace only to modify its files or run commands requiring its project environment. Do not use for self-contained scratch work on attachments, pasted/generated content, or throwaway/exportable artifacts. The session, chat, and history are preserved. Immediately before every call, use the available user-input tool to ask one question confirming both workspace and isolation, even if already specified; tool approval is not confirmation. Set `isolation` to true for a managed Git worktree or false for the folder directly. After this turn, the host attaches the workspace and continues the original task. Make this the turn\'s final tool call.',
'This is a lightweight workspace-less chat, not tied to any project or workspace. The user opens it for quick questions, navigation, and triage.',
11
+
'This lightweight chat has a SCRATCH working directory, not a project or repository.',
12
12
'',
13
-
'- Your working directory is a SCRATCH directory for running commands and saving throwaway artifacts — it is NOT a code repository. Do not treat it as a project to build, test, or commit.',
14
-
'- You MUST NOT create, edit, or delete files, or run builds, tests, linters, installs, or other project-changing commands in the scratch directory.',
15
-
'- You may perform read-only inspection of a real repository when answering a question, but any task that requires project changes MUST first attach that repository with `set_workspace` and continue this same conversation. Do not create another session solely to move the work.',
16
-
'- For project-changing work, follow this exact sequence before using any shell or file-mutation tool: use `list_sessions` to discover candidate workspaces when needed; make exactly one call to the available user-input tool (`request_user_input` in Codex or `ask_user` in Copilot) containing exactly one single-select question whose choices each combine an exact workspace with an isolation strategy (use an existing worktree, use the folder directly, or create a new isolated worktree); then call `set_workspace` as the final tool call of the turn using the selected choice. Do not ask workspace and isolation as separate questions. Never guess a workspace path. Tool approval is separate and does not replace user confirmation.',
13
+
'- Keep attachment-, pasted-, or generated-content work here when outputs can remain throwaway/exportable. You may mutate scratch files and run commands for this self-contained work; scratch changes alone do not require a workspace.',
14
+
'- Do not treat scratch as a project: do not build, test, lint, install for, or commit a real project there.',
15
+
'- Read-only repository inspection is allowed. Use `set_workspace` only to modify a repository or run commands requiring its project environment. Continue this conversation; do not create a replacement session.',
16
+
'- Before workspace-dependent work: use `list_sessions` if needed; ask exactly one single-select question via `request_user_input` (Codex) or `ask_user` (Copilot). Each choice must pair an exact workspace with isolation (existing worktree, direct folder, or new worktree). Then call `set_workspace` with that choice as the turn\'s final tool call. Do not split the question, guess a path, or treat tool approval as confirmation.',
test('prefers attaching a workspace over creating a replacement session',()=>{
219
219
assert.deepStrictEqual({
220
-
usesSetWorkspace: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('project changes MUST first attach that repository with `set_workspace`'),
221
-
avoidsReplacementSession: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('Do not create another session solely to move the work'),
222
-
blocksScratchMutation: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('MUST NOT create, edit, or delete files'),
223
-
requiresConfirmation: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('follow this exact sequence before using any shell or file-mutation tool'),
224
-
namesProviderTools: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('`request_user_input` in Codex or `ask_user` in Copilot'),
225
-
combinesWorkspaceAndIsolation: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('exactly one single-select question whose choices each combine an exact workspace with an isolation strategy'),
226
-
forbidsSplitQuestions: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('Do not ask workspace and isolation as separate questions'),
220
+
usesSetWorkspace: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('Use `set_workspace` only to modify a repository or run commands requiring its project environment'),
221
+
avoidsReplacementSession: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('do not create a replacement session'),
222
+
allowsScratchArtifacts: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('scratch changes alone do not require a workspace'),
223
+
keepsAttachmentWorkWorkspaceless: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('Keep attachment-, pasted-, or generated-content work here'),
224
+
requiresConfirmation: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('ask exactly one single-select question'),
225
+
namesProviderTools: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('`request_user_input` (Codex) or `ask_user` (Copilot)'),
226
+
combinesWorkspaceAndIsolation: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('Each choice must pair an exact workspace with isolation'),
227
+
forbidsSplitQuestions: AGENT_HOST_WORKSPACELESS_INSTRUCTIONS.includes('Do not split the question'),
0 commit comments