-
Notifications
You must be signed in to change notification settings - Fork 3k
fix(memory): don't advance AutoMemory extract cursor when the agent makes zero tool calls #6398
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,6 +76,7 @@ describe('runAutoMemoryExtractionByAgent', () => { | |
| status: 'completed', | ||
| finalText: '', | ||
| filesTouched: ['/tmp/auto-memory/user/prefs.md'], | ||
| filesWritten: ['/tmp/auto-memory/user/prefs.md'], | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] All tests in this file set Consider adding a test like: it('derives touchedTopics from filesWritten, not filesTouched', async () => {
vi.mocked(runForkedAgent).mockResolvedValue({
status: 'completed',
finalText: '',
filesTouched: ['/tmp/auto-memory/user/prefs.md', '/tmp/auto-memory/user/readonly.md'],
filesWritten: ['/tmp/auto-memory/user/prefs.md'],
});
const result = await runAutoMemoryExtractionByAgent(mockConfig, '/tmp');
expect(result.touchedTopics).toEqual(['user']);
expect(result.hasToolActivity).toBe(true);
});This proves — qwen3.7-max via Qwen Code /review |
||
| }); | ||
|
|
||
| const result = await runAutoMemoryExtractionByAgent(mockConfig, '/tmp'); | ||
|
|
@@ -84,6 +85,7 @@ describe('runAutoMemoryExtractionByAgent', () => { | |
| touchedTopics: ['user'], | ||
| touchedProjectScope: true, | ||
| touchedUserScope: false, | ||
| hasToolActivity: true, | ||
| systemMessage: 'Managed auto-memory updated: user.md', | ||
| }); | ||
| expect(runForkedAgent).toHaveBeenCalledWith( | ||
|
|
@@ -108,13 +110,15 @@ describe('runAutoMemoryExtractionByAgent', () => { | |
| status: 'completed', | ||
| finalText: '', | ||
| filesTouched: [], | ||
| filesWritten: [], | ||
| }); | ||
|
|
||
| const result = await runAutoMemoryExtractionByAgent(mockConfig, '/tmp'); | ||
| expect(result).toEqual({ | ||
| touchedTopics: [], | ||
| touchedProjectScope: false, | ||
| touchedUserScope: false, | ||
| hasToolActivity: false, | ||
| systemMessage: undefined, | ||
| }); | ||
| }); | ||
|
|
@@ -176,6 +180,11 @@ describe('runAutoMemoryExtractionByAgent', () => { | |
| '/tmp/auto-memory/reference/api.md', | ||
| '/tmp/some/other/file.ts', | ||
| ], | ||
| filesWritten: [ | ||
| '/tmp/auto-memory/project/arch.md', | ||
| '/tmp/auto-memory/reference/api.md', | ||
| '/tmp/some/other/file.ts', | ||
| ], | ||
| }); | ||
|
|
||
| const result = await runAutoMemoryExtractionByAgent(mockConfig, '/tmp'); | ||
|
|
@@ -195,6 +204,10 @@ describe('runAutoMemoryExtractionByAgent', () => { | |
| '/tmp/user-memory/user/role.md', | ||
| '/tmp/user-memory/feedback/terse.md', | ||
| ], | ||
| filesWritten: [ | ||
| '/tmp/user-memory/user/role.md', | ||
| '/tmp/user-memory/feedback/terse.md', | ||
| ], | ||
| }); | ||
|
|
||
| const result = await runAutoMemoryExtractionByAgent(mockConfig, '/tmp'); | ||
|
|
@@ -230,6 +243,10 @@ describe('runAutoMemoryExtractionByAgent', () => { | |
| 'C:/Users/foo/.qwen/projects/proj/memory/project/release.md', | ||
| 'C:/Users/foo/.qwen/memories/user/role.md', | ||
| ], | ||
| filesWritten: [ | ||
| 'C:/Users/foo/.qwen/projects/proj/memory/project/release.md', | ||
| 'C:/Users/foo/.qwen/memories/user/role.md', | ||
| ], | ||
| }); | ||
|
|
||
| try { | ||
|
|
@@ -256,6 +273,10 @@ describe('runAutoMemoryExtractionByAgent', () => { | |
| '/tmp/auto-memory\\project\\arch.md', | ||
| '/tmp/user-memory\\user\\role.md', | ||
| ], | ||
| filesWritten: [ | ||
| '/tmp/auto-memory\\project\\arch.md', | ||
| '/tmp/user-memory\\user\\role.md', | ||
| ], | ||
| }); | ||
|
|
||
| const result = await runAutoMemoryExtractionByAgent(mockConfig, '/tmp'); | ||
|
|
@@ -294,6 +315,10 @@ describe('runAutoMemoryExtractionByAgent', () => { | |
| '/tmp/user-memory/user/role.md', | ||
| '/tmp/auto-memory/project/release.md', | ||
| ], | ||
| filesWritten: [ | ||
| '/tmp/user-memory/user/role.md', | ||
| '/tmp/auto-memory/project/release.md', | ||
| ], | ||
| }); | ||
|
|
||
| const result = await runAutoMemoryExtractionByAgent(mockConfig, '/tmp'); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Suggestion]
touchedTopics.length > 0is redundant withhasToolActivity. SincetouchedTopicsis derived fromfilesWritten(a strict subset offilesTouched— seeforkedAgent.tslines 568→582),touchedTopics.length > 0always implieshasToolActivityis alreadytrue. The left side of the||can never be the deciding factor.This could mislead future maintainers into thinking there are two independent paths to cursor advancement. Either simplify:
Or add a comment explaining the defensive intent:
— qwen3.7-max via Qwen Code /review