Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/cli/src/acp-integration/acpAgent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2497,6 +2497,7 @@ describe('QwenAgent MCP SSE/HTTP support', () => {
getSessionService: vi.fn(() => new SessionService('/tmp')),
hasSessionWriteOwnership: vi.fn().mockReturnValue(false),
getSessionRuntimeBaseDir: vi.fn().mockReturnValue('/runtime-a'),
getPlansDir: vi.fn().mockReturnValue('/home/test/.qwen/plans'),
setFileSystemService: vi.fn(),
getHookSystem: vi.fn().mockReturnValue(undefined),
getDisableAllHooks: vi.fn().mockReturnValue(true),
Expand All @@ -2515,6 +2516,7 @@ describe('QwenAgent MCP SSE/HTTP support', () => {
'/tmp/user-memory',
'/home/test/.qwen/skills',
'/tmp/qwen-extensions',
'/home/test/.qwen/plans',
...(process.platform === 'win32' ? [] : ['/tmp']),
];
}
Expand Down
3 changes: 3 additions & 0 deletions packages/cli/src/acp-integration/acpAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,9 @@ function buildAcpLocalReadRoots(config: Config): string[] {
getUserAutoMemoryRoot(),
...config.storage.getUserSkillsDirs(),
Storage.getUserExtensionsDir(),
// Saved plan files (see ReadFileTool.getDefaultPermission for why the
// plans dir must be readable without a confirmation prompt).
config.getPlansDir(),
...defaultAcpOnlyLocalReadRoots(),
...parseAcpLocalReadRootsEnv(),
];
Expand Down
19 changes: 19 additions & 0 deletions packages/core/src/tools/read-file.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ describe('ReadFileTool', () => {
getProjectDir: () => path.join(tempRootDir, '.project'),
getUserSkillsDirs: () => [path.join(os.homedir(), '.qwen', 'skills')],
},
getPlansDir: () => path.join(os.homedir(), '.qwen', 'plans'),
getTruncateToolOutputThreshold: () => 2500,
getTruncateToolOutputLines: () => 500,
getContentGeneratorConfig: () => ({
Expand Down Expand Up @@ -324,6 +325,24 @@ describe('ReadFileTool', () => {
expect(permission).toBe('allow');
});

it('should return allow for saved plan files under the plans directory', async () => {
const params: ReadFileToolParams = {
file_path: path.join(os.homedir(), '.qwen', 'plans', 'session-1.md'),
};
const invocation = tool.build(params);
const permission = await invocation.getDefaultPermission();
expect(permission).toBe('allow');
});

it('should still return ask for ~/.qwen files outside the plans directory', async () => {
const params: ReadFileToolParams = {
file_path: path.join(os.homedir(), '.qwen', 'settings.json'),
};
const invocation = tool.build(params);
const permission = await invocation.getDefaultPermission();
expect(permission).toBe('ask');
});

it('should return ask for paths directly under the OS temp directory', async () => {
const params: ReadFileToolParams = {
file_path: path.join(os.tmpdir(), 'pr-review-context.md'),
Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/tools/read-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ class ReadFileToolInvocation extends BaseToolInvocation<
Storage.getGlobalTempDir(),
...this.config.storage.getUserSkillsDirs(),
Storage.getUserExtensionsDir(),
// Approved plans are persisted here (default ~/.qwen/plans, outside
// the workspace) and after approval nothing re-injects the plan text,
// so the saved file is the model's only recovery route — reading it
// back must not stall on a confirmation prompt. The dir holds only
// session plan files, never credentials or settings.
this.config.getPlansDir(),
];

if (
Expand Down
Loading