mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-02 05:29:42 +02:00
fix: prevent false completion detection when phrase appears in prompt
The tracker was incorrectly marking Ralph loops as complete when the completion phrase appeared in the prompt text itself (e.g., when user types the /ralph-loop command with the completion phrase in quotes). Now it only marks completion when the loop is already active, and records the expected phrase without triggering completion otherwise. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -231,9 +231,19 @@ export class InnerLoopTracker extends EventEmitter {
|
||||
* Handle a detected completion phrase
|
||||
*/
|
||||
private handleCompletionPhrase(phrase: string): void {
|
||||
const wasActive = this._loopState.active;
|
||||
// Only mark as completed if the loop was actually active
|
||||
// This prevents false positives when the completion phrase appears in the prompt itself
|
||||
if (!this._loopState.active) {
|
||||
// Just record the expected completion phrase without marking as complete
|
||||
if (!this._loopState.completionPhrase) {
|
||||
this._loopState.completionPhrase = phrase;
|
||||
this._loopState.lastActivity = Date.now();
|
||||
this.emit('loopUpdate', this.loopState);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// If we see a completion phrase, mark loop as completed
|
||||
// Loop was active, this is a real completion
|
||||
this._loopState.completionPhrase = phrase;
|
||||
this._loopState.active = false;
|
||||
this._loopState.lastActivity = Date.now();
|
||||
|
||||
Reference in New Issue
Block a user