mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-15 14:23:02 -07:00
fix(watcher): obfuscate status file name to prevent main agent discovery
This commit is contained in:
@@ -38,7 +38,7 @@ export const WatcherAgent = (
|
||||
context: AgentLoopContext,
|
||||
): LocalAgentDefinition<typeof WatcherReportSchema> => {
|
||||
const projectTempDir = context.config.storage.getProjectTempDir();
|
||||
const statusFilePath = path.join(projectTempDir, 'watcher_status.md');
|
||||
const statusFilePath = path.join(projectTempDir, '.sys_state_cache.log');
|
||||
|
||||
return {
|
||||
name: 'watcher',
|
||||
|
||||
@@ -327,7 +327,7 @@ export class GeminiClient {
|
||||
// Clean up Watcher status file
|
||||
try {
|
||||
const projectTempDir = this.config.storage.getProjectTempDir();
|
||||
const statusFilePath = path.join(projectTempDir, 'watcher_status.md');
|
||||
const statusFilePath = path.join(projectTempDir, '.sys_state_cache.log');
|
||||
if (fs.existsSync(statusFilePath)) {
|
||||
fs.unlinkSync(statusFilePath);
|
||||
}
|
||||
@@ -1346,7 +1346,7 @@ export class GeminiClient {
|
||||
const interval = this.config.getExperimentalWatcherInterval();
|
||||
|
||||
const projectTempDir = this.config.storage.getProjectTempDir();
|
||||
const statusFilePath = path.join(projectTempDir, 'watcher_status.md');
|
||||
const statusFilePath = path.join(projectTempDir, '.sys_state_cache.log');
|
||||
|
||||
// Ensure the file exists before the subagent tries to read it
|
||||
if (!fs.existsSync(statusFilePath)) {
|
||||
@@ -1416,7 +1416,10 @@ export class GeminiClient {
|
||||
|
||||
// Internally write the status report to avoid requiring user permission
|
||||
const projectTempDir = this.config.storage.getProjectTempDir();
|
||||
const statusFilePath = path.join(projectTempDir, 'watcher_status.md');
|
||||
const statusFilePath = path.join(
|
||||
projectTempDir,
|
||||
'.sys_state_cache.log',
|
||||
);
|
||||
debugLogger.log(
|
||||
`[Watcher] Writing status report to ${statusFilePath}`,
|
||||
);
|
||||
|
||||
@@ -50,7 +50,7 @@ describe('GeminiClient Watcher Integration', () => {
|
||||
afterEach(() => {
|
||||
vi.unstubAllEnvs();
|
||||
const projectTempDir = config.storage.getProjectTempDir();
|
||||
const statusFilePath = path.join(projectTempDir, 'watcher_status.md');
|
||||
const statusFilePath = path.join(projectTempDir, '.sys_state_cache.log');
|
||||
if (fs.existsSync(statusFilePath)) {
|
||||
fs.unlinkSync(statusFilePath);
|
||||
}
|
||||
@@ -261,7 +261,7 @@ describe('GeminiClient Watcher Integration', () => {
|
||||
|
||||
// Verify the status file exists (written by GeminiClient internally)
|
||||
const projectTempDir = config.storage.getProjectTempDir();
|
||||
const statusFilePath = path.join(projectTempDir, 'watcher_status.md');
|
||||
const statusFilePath = path.join(projectTempDir, '.sys_state_cache.log');
|
||||
expect(fs.existsSync(statusFilePath)).toBe(true);
|
||||
const content = fs.readFileSync(statusFilePath, 'utf-8');
|
||||
expect(content).toContain('# Watcher Memory State');
|
||||
@@ -353,7 +353,7 @@ I hope this status update is helpful!
|
||||
}
|
||||
|
||||
const projectTempDir = config.storage.getProjectTempDir();
|
||||
const statusFilePath = path.join(projectTempDir, 'watcher_status.md');
|
||||
const statusFilePath = path.join(projectTempDir, '.sys_state_cache.log');
|
||||
expect(fs.existsSync(statusFilePath)).toBe(true);
|
||||
const content = fs.readFileSync(statusFilePath, 'utf-8');
|
||||
expect(content).toContain('Messy test direction');
|
||||
|
||||
Reference in New Issue
Block a user