mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-14 18:39:33 +01:00
fix: never read a remote fix-plan path from the local disk (release review, #722)
setRemoteWorkingDir() records the path for authority only, and today nothing else reads it for a remote session (loadFixPlanFromDisk's only callers are setWorkingDir and the local watcher). The watcher now remembers the remote mode and refuses both the local read and the local watch for it, so a future caller cannot import a same-named local twin. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9f7cba07ab
commit
ca0f891c2b
2 files changed
+42
-4
No files matched your search
@@ -203,6 +203,9 @@ export class RalphFixPlanWatcher extends EventEmitter {
|
||||
/** Path to the @fix_plan.md file being watched */
|
||||
private _fixPlanPath: string | null = null;
|
||||
|
||||
/** The path is on a REMOTE host (`setRemoteWorkingDir`): never read or watch it locally. */
|
||||
private _remote = false;
|
||||
|
||||
/** File watcher for @fix_plan.md */
|
||||
private _fixPlanWatcher: FSWatcher | null = null;
|
||||
|
||||
@@ -238,6 +241,7 @@ export class RalphFixPlanWatcher extends EventEmitter {
|
||||
* @param workingDir - The session's working directory
|
||||
*/
|
||||
setWorkingDir(workingDir: string): void {
|
||||
this._remote = false;
|
||||
this._workingDir = workingDir;
|
||||
this._fixPlanPath = join(workingDir, '@fix_plan.md');
|
||||
|
||||
@@ -258,16 +262,18 @@ export class RalphFixPlanWatcher extends EventEmitter {
|
||||
*/
|
||||
setRemoteWorkingDir(workingDir: string): void {
|
||||
this.stopWatchingFixPlan();
|
||||
this._remote = true;
|
||||
this._workingDir = workingDir;
|
||||
this._fixPlanPath = join(workingDir, '@fix_plan.md');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load @fix_plan.md from disk if it exists.
|
||||
* Called on initialization and when file changes are detected.
|
||||
* Called on initialization and when file changes are detected. A remote path is never read here:
|
||||
* the local disk would hold a missing path or an unrelated same-named file.
|
||||
*/
|
||||
async loadFixPlanFromDisk(): Promise<number> {
|
||||
if (!this._fixPlanPath) return 0;
|
||||
if (!this._fixPlanPath || this._remote) return 0;
|
||||
|
||||
try {
|
||||
if (!existsSync(this._fixPlanPath)) {
|
||||
@@ -295,7 +301,7 @@ export class RalphFixPlanWatcher extends EventEmitter {
|
||||
* Reloads todos when the file is modified.
|
||||
*/
|
||||
private startWatchingFixPlan(): void {
|
||||
if (!this._fixPlanPath || !this._workingDir) return;
|
||||
if (!this._fixPlanPath || !this._workingDir || this._remote) return;
|
||||
|
||||
// Stop existing watcher if any
|
||||
this.stopWatchingFixPlan();
|
||||
|
||||
Reference in new issue
Block a user