Skip to content

Commit 6a0a91c

Browse files
author
YZLLM
committed
fix(gorunurluk): acilista faz gostergeleri 'bosta' mesajiyla celisiyordu
Kullanici ekrani (YZLLM "tutarsiz davraniyor"): tamamlanmis Faz 17 projesi yeniden acilinca acilis mesaji dogru "Hazirim, bekleyen bir isim yok" (bosta) derken header + sol menu + ActivityBar seridi Faz 17'yi "calisiyor/aktif" (mavi) gosteriyordu. KOK (2 Explore + 1 Plan + 3 mufettis, kod:satir kanitli): boot'ta index.ts KOSULSUZ emitPhaseChanged(current_phase, "running") yayiyordu; faz durumu persist edilmez (types.ts yalniz current_phase sayisi), iterasyon sonu "complete" transient restart'ta kaybolur. Uc gorsel gosterge stale "running"'e duserken composeOpenStatus dogru "bosta" diyordu -> drift. FIX (tek-kaynak): boot faz-durumu artik durum-MESAJIYLA AYNI karardan uretilir (composeOpenStatus phaseStatus dondurur) -> drift mimari olarak imkansiz. - open-status.ts: composeOpenStatus dogru phaseStatus uretir (waiting/running/ idle/complete). Fallback TERMINAL-FARKINDA: currentPhase===17 ? "complete" : "idle" (pipeline daima 17'de biter -> 17 idle = tamamlandi ✅; Faz 0/1-intent- dolu idle = notr, yanlis-yesil YOK). - PhaseStatus'a yeni "idle" uyesi (types.ts + events.ts): faz tamamlanmadi ama is de beklemiyor -> notr render (mavi/yesil degil). - index.ts: gatherOpenStatusInput() helper (boot emit + emitOpenStatusSummary ayni girdiyi kullanir); boot emit (~2086) hesaplanmis statuyu yayar. KONUM degismez (D2_WAITING askq re-emit'inden ONCE kalmali; phase_changed reducer'i pendingAskq'yi temizler). - Frontend: AppHeader STATUS_LABEL idle:"bosta"; PhaseSidebar phaseBadge current- faz idle→⏹️ (Faz 0 standalone rozeti dahil, MAHKEME MEDIUM fix); App.css .idle notr. ActivityBar degismez ("idle" zaten 💤 bosta dalina duser). MAHKEME (3 mufettis): tutarlilik 1-17 fazlar dogrulandi. MEDIUM: Faz 0 standalone rozeti phaseStatus'e bakmiyordu (header duzelince yeni celiski) -> idle-farkinda yapildi. MEDIUM (kabul+belge): iki resume dalinda (interrupted Faz 1, foreign Faz 6 unpark) acilista kisa bir gecici statu farki olur AMA bunlar DOGRU gecici durum (o an proje gercekten idle/waiting'di, sonra resume "running" yapar; eski "hep running" YANLISTI) ve kendini duzeltir; boot-akisi reorder riski yuksek oldugu icin dogru-gecici olarak birakildi. Aktif-kosan mid-pipeline acilis hala "running" (regresyon yok). npm run check yesil (open-status phaseStatus esleme + canli vaka Faz 17→complete birim-testli). README zaten seridin "bosta" gosterdigini anlatiyor (fix onu dogru delivering ediyor, degisiklik gerekmez).
1 parent 7b88366 commit 6a0a91c

8 files changed

Lines changed: 101 additions & 13 deletions

File tree

‎orchestrator/src/index.ts‎

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ import { getCachedProjectMap, clearProjectMapCache } from "./onboarding/project-
222222
import { runOnboarding, onboardingSucceeded } from "./onboarding/onboard-existing.js";
223223
import { maybeRunEdd } from "./edd/engine.js";
224224
import { readEddProgress, summarizeProgress } from "./edd/progress.js";
225-
import { composeOpenStatus, formatOpenStatus } from "./open-status.js";
225+
import { composeOpenStatus, formatOpenStatus, type OpenStatusInput } from "./open-status.js";
226226
import { attachEddCodegenNote } from "./edd/codegen-note.js";
227227
import { runMultiAgentSelection } from "./module-parallel/select.js";
228228
import { reviewMergedModules, formatReview } from "./module-parallel/review.js";
@@ -1928,9 +1928,14 @@ async function handleOpenProject(path: string, integrate = false): Promise<void>
19281928
* mesajı basar. Eski LLM boot-narrator'ın (runBootStatusCheck) yerini alır: o kuyrukta iş varken susuyordu
19291929
* (her-zaman garantisi yoktu) + token yakıyordu + prompt-kırılgandı. ASLA throw etmez (caller yutar).
19301930
*/
1931-
async function emitOpenStatusSummary(): Promise<void> {
1931+
/**
1932+
* SAF-değil: açılış durum SNAPSHOT'unu (state + kuyruk + EDD) topla → composeOpenStatus girdisi. Boot'ta İKİ
1933+
* yerde kullanılır: (1) faz-durumu emit'i (index.ts:2076 idle/aktif statü) ve (2) durum-özeti mesajı — İKİSİ AYNI
1934+
* girdiden composeOpenStatus çağırır → mesaj ile faz-göstergesi ARASINDA drift imkansız. state yoksa null.
1935+
*/
1936+
async function gatherOpenStatusInput(): Promise<OpenStatusInput | null> {
19321937
const st = runtime.state;
1933-
if (!st) return;
1938+
if (!st) return null;
19341939
const root = st.project_root;
19351940
const tasks = await readTasks(root).catch(() => []);
19361941
const running =
@@ -1944,7 +1949,7 @@ async function emitOpenStatusSummary(): Promise<void> {
19441949
eddDone = e.done; eddTotal = e.total; eddPending = e.pending;
19451950
} catch { /* edd yoksa 0 kalır */ }
19461951
}
1947-
const status = composeOpenStatus({
1952+
return {
19481953
currentPhase: st.current_phase,
19491954
intentEmpty: !st.intent_summary || st.intent_summary.trim() === "",
19501955
isForeign,
@@ -1953,8 +1958,13 @@ async function emitOpenStatusSummary(): Promise<void> {
19531958
runningTaskText: running?.text ?? null,
19541959
pendingTaskCount: pendingCount,
19551960
eddDone, eddTotal, eddPending,
1956-
});
1957-
emitChatMessage("assistant", formatOpenStatus(status));
1961+
};
1962+
}
1963+
1964+
async function emitOpenStatusSummary(): Promise<void> {
1965+
const input = await gatherOpenStatusInput();
1966+
if (!input) return;
1967+
emitChatMessage("assistant", formatOpenStatus(composeOpenStatus(input)));
19581968
}
19591969

19601970
async function handleOpenProjectInner(path: string, integrate = false): Promise<void> {
@@ -2073,7 +2083,20 @@ async function handleOpenProjectInner(path: string, integrate = false): Promise<
20732083
session_id: runtime.state.session_id,
20742084
current_phase: runtime.state.current_phase,
20752085
});
2076-
emitPhaseChanged(runtime.state.current_phase, runtime.state.current_phase, "running");
2086+
// AÇILIŞ DURUM TUTARSIZLIĞI FIX'i (YZLLM 2026-07-22): eskiden KOŞULSUZ "running" yayılıyordu → tamamlanmış Faz 17
2087+
// idle projesi açılınca header/sidebar/şerit "çalışıyor" gösterip durum-mesajının "boşta"sıyla çelişiyordu (faz
2088+
// durumu persist edilmez). Artık faz-durumu, mesajla AYNI kaynaktan (composeOpenStatus) üretilir → drift imkansız.
2089+
// KONUM KRİTİK: bu emit, aşağıdaki D2_WAITING debug askq re-emit'inden ÖNCE kalmalı — phase_changed reducer'ı
2090+
// pendingAskq'yı temizler (App.tsx), sonraya taşınırsa yeni askq silinir. Resume dalları SONRA kendi phase_changed'ini
2091+
// yayıp override eder → yalnız idle yollar bu hesaplanmış statüyü nihai taşır. state okunamazsa "running" (defansif).
2092+
{
2093+
const _oi = await gatherOpenStatusInput();
2094+
emitPhaseChanged(
2095+
runtime.state.current_phase,
2096+
runtime.state.current_phase,
2097+
_oi ? composeOpenStatus(_oi).phaseStatus : "running",
2098+
);
2099+
}
20772100
// Mahkeme H1 (boot yarışı): kapsam emit'ini buraya koy — runtime.state loadOrInit ile POPULATE edildikten SONRA
20782101
// deterministik koşar. Eski tek emit (handleListPhases) ayrı IPC mesajı + open_project'in await penceresinde
20792102
// yarışıp null/bayat okuyabiliyordu → yeniden açılan onaylı-kapsamlı projede PhaseSidebar dimming'i bayat kalırdı.

‎orchestrator/src/open-status.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,14 @@ export interface OpenStatusInput {
4747
eddPending: number;
4848
}
4949

50+
import type { PhaseStatus } from "./types.js";
51+
5052
export interface OpenStatus {
5153
durum: string;
5254
action: string;
55+
/** Açılışta faz-göstergesine (header/sidebar/şerit) yayılacak faz durumu — MESAJLA AYNI KARARDAN üretilir
56+
* (drift imkansız). running=aktif/sürüyor, waiting=kullanıcı cevabı, idle=taze/iş-bekliyor, complete=tamamlandı. */
57+
phaseStatus: PhaseStatus;
5358
}
5459

5560
function phaseName(p: number): string {
@@ -62,38 +67,44 @@ export function composeOpenStatus(i: OpenStatusInput): OpenStatus {
6267
return {
6368
durum: "Bir hata için çözüm seçimi bekliyor.",
6469
action: "Chat'te açılan soruyu yanıtla; ardından düzeltmeye geçerim.",
70+
phaseStatus: "waiting",
6571
};
6672
}
6773
if (i.pendingUiReview) {
6874
return {
6975
durum: `UI incelemesi bekliyor (Faz 6, ${phaseName(6)}).`,
7076
action: "Açılan uygulamayı incele; beğendiysen onayla, beğenmediysen değişikliği yaz.",
77+
phaseStatus: "waiting",
7178
};
7279
}
7380
// Mid-pipeline (2..16): faz otomatik kaldığı yerden sürer — kullanıcının bir şey yapmasına gerek yok.
7481
if (i.currentPhase >= 2 && i.currentPhase <= 16) {
7582
return {
7683
durum: `Faz ${i.currentPhase} (${phaseName(i.currentPhase)}) kaldığı yerden otomatik sürüyor.`,
7784
action: "Bir şey yapmana gerek yok — otomatik ilerliyor. Yeni bir hedef için yazman yeterli.",
85+
phaseStatus: "running",
7886
};
7987
}
8088
if (i.runningTaskText) {
8189
const t = i.runningTaskText.trim().slice(0, 80);
8290
return {
8391
durum: `Önceki iş kaldığı yerden sürüyor: "${t}".`,
8492
action: "Bitmesini bekleyebilirsin; yeni bir hedef için yazman yeterli.",
93+
phaseStatus: "running",
8594
};
8695
}
8796
if (i.pendingTaskCount > 0) {
8897
return {
8998
durum: `İş kuyruğunda ${i.pendingTaskCount} iş bekliyor.`,
9099
action: "Sıradaki iş birazdan otomatik başlar; yeni hedef eklemek için yazabilirsin.",
100+
phaseStatus: "running",
91101
};
92102
}
93103
if (i.isForeign && i.eddPending > 0) {
94104
return {
95105
durum: `Proje analizi (EDD) arka planda sürüyor: ${i.eddDone}/${i.eddTotal} birim.`,
96106
action: "Analiz bitince projeyi tam kavrarım; şimdiden yeni bir hedef yazabilirsin.",
107+
phaseStatus: "running",
97108
};
98109
}
99110
if (i.currentPhase === 1 && i.intentEmpty) {
@@ -102,11 +113,15 @@ export function composeOpenStatus(i: OpenStatusInput): OpenStatus {
102113
? "Proje analizi tamam; yeni bir iş bekliyorum."
103114
: "Yeni bir iş bekliyorum.",
104115
action: "Ne yapmak istediğini yaz — hedefi verince başlarım.",
116+
phaseStatus: "idle", // taze/iş-bekliyor — nötr (Faz 1'i "tamamlandı ✅" göstermez)
105117
};
106118
}
107119
return {
108120
durum: "Hazırım, bekleyen bir işim yok.",
109121
action: "Ne yapmak istediğini yaz.",
122+
// TERMINAL-FARKINDA: pipeline daima Faz 17'de biter → 17 idle = tamamlandı (✅); Faz 0/1-intent-dolu idle = nötr
123+
// (blanket "complete" olsa Faz 1'i yanlış ✅ gösterirdi). Mesaj her durumda "Hazırım boşta" → statüyle drift yok.
124+
phaseStatus: i.currentPhase === 17 ? "complete" : "idle",
110125
};
111126
}
112127

‎orchestrator/src/types.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,9 @@ export type MechanicalRunner = (state: State) => Promise<MechResult>;
684684
export type TranslationDir = "tr-to-en" | "en-to-tr";
685685

686686
// Faz durumu — UI faz indicator için.
687-
export type PhaseStatus = "running" | "waiting" | "complete" | "error";
687+
// "idle" (YZLLM 2026-07-22): faz tamamlanmadı AMA iş de beklemiyor (açılışta boşta) → nötr render (mavi/yeşil değil).
688+
// Açılış tutarsızlığı fix'i: boot'ta koşulsuz "running" yerine open-status'un idle/aktif kararıyla aynı statü yayılır.
689+
export type PhaseStatus = "running" | "waiting" | "complete" | "error" | "idle";
688690

689691
// Orchestrator IPC mesajları (Tauri ↔ Node).
690692
export interface IncomingMessage {

‎orchestrator/test/open-status.test.ts‎

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,36 @@ describe("composeOpenStatus — öncelik sırası", () => {
6969
});
7070

7171
it("formatOpenStatus: 📍 Durum + Yapman gereken iki satır", () => {
72-
const t = formatOpenStatus({ durum: "D", action: "A" });
72+
const t = formatOpenStatus({ durum: "D", action: "A", phaseStatus: "idle" });
7373
expect(t).toBe("📍 **Durum:** D\n**Yapman gereken:** A");
7474
});
7575
});
76+
77+
// AÇILIŞ TUTARSIZLIĞI FIX'i (YZLLM 2026-07-22): faz-durumu emit'i mesajla AYNI karardan üretilir → drift imkansız.
78+
// Boot'ta composeOpenStatus(input).phaseStatus, phase_changed'e yayılır. Bu testler o eşlemeyi kilitler.
79+
describe("composeOpenStatus — phaseStatus (boot faz-durumu, mesajla tek kaynak)", () => {
80+
it("pendingDiagnostic / pendingUiReview → waiting", () => {
81+
expect(composeOpenStatus({ ...base, pendingDiagnostic: true }).phaseStatus).toBe("waiting");
82+
expect(composeOpenStatus({ ...base, pendingUiReview: true }).phaseStatus).toBe("waiting");
83+
});
84+
it("mid-pipeline (2-16) / koşan iş / bekleyen kuyruk / EDD → running", () => {
85+
expect(composeOpenStatus({ ...base, currentPhase: 8, intentEmpty: false }).phaseStatus).toBe("running");
86+
expect(composeOpenStatus({ ...base, runningTaskText: "x" }).phaseStatus).toBe("running");
87+
expect(composeOpenStatus({ ...base, pendingTaskCount: 2 }).phaseStatus).toBe("running");
88+
expect(composeOpenStatus({ ...base, isForeign: true, eddPending: 3 }).phaseStatus).toBe("running");
89+
});
90+
it("Faz 1 + intent boş (taze) → idle (nötr; 'yeni iş bekliyorum'la tutarlı, Faz 1'i yanlış ✅ göstermez)", () => {
91+
expect(composeOpenStatus(base).phaseStatus).toBe("idle");
92+
});
93+
it("CANLI VAKA: Faz 17 tamamlanmış + kuyruk boş + pending yok → complete (Faz 17 ✅ + 'Hazırım boşta')", () => {
94+
const s = composeOpenStatus({ ...base, currentPhase: 17, intentEmpty: false });
95+
expect(s.durum).toContain("Hazırım");
96+
expect(s.phaseStatus).toBe("complete");
97+
});
98+
it("DEJENERE: Faz 1 intent-DOLU idle (fallback) → complete DEĞİL idle (Faz 1 yanlış-yeşil önlenir)", () => {
99+
expect(composeOpenStatus({ ...base, currentPhase: 1, intentEmpty: false }).phaseStatus).toBe("idle");
100+
});
101+
it("DEJENERE: Faz 0 (debug) idle (fallback) → idle (nötr, tamamlandı değil)", () => {
102+
expect(composeOpenStatus({ ...base, currentPhase: 0, intentEmpty: false }).phaseStatus).toBe("idle");
103+
});
104+
});

‎src/App.css‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@ select:focus {
355355
background: rgba(248, 81, 73, 0.12);
356356
}
357357

358+
/* idle (YZLLM 2026-07-22): açılışta taze/iş-bekleyen faz — nötr (mavi/yeşil DEĞİL), base ile aynı; açıklık için explicit. */
359+
.app-phase-indicator.idle {
360+
color: var(--fg-dim);
361+
background: var(--bg-elev);
362+
}
363+
358364
/* v15.7 (2026-05-27): Faz badge'i ErrorDrawer toggle olarak tıklanabilir. */
359365
.app-phase-indicator.clickable {
360366
border: none;

‎src/components/AppHeader.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const STATUS_LABEL: Record<PhaseStatus, string> = {
3131
waiting: "yanıt bekleniyor",
3232
complete: "tamamlandı",
3333
error: "hata",
34+
idle: "boşta", // taze/iş-bekliyor — açılışta tamamlanmamış ama iş de beklemeyen faz (nötr)
3435
};
3536

3637
export function AppHeader({

‎src/components/PhaseSidebar.tsx‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ export function phaseBadge(
5353
if (id === currentPhase) {
5454
// CURRENT faz: TAMAMLANDIYSA ✅ (özellikle SON faz — pipeline bitince currentPhase ilerlemez → aksi halde
5555
// Faz 17 sonsuza dek ▶️ mavi kalırdı; YZLLM 2026-07-14 "iterasyon bitti ama faz 17 yeşil olmamış" bug'ı).
56-
// running/waiting → ▶️ (hâlâ çalışıyor/park).
57-
return currentPhaseStatus === "complete" ? "✅" : "▶️";
56+
// idle (açılışta taze/iş-bekliyor, YZLLM 2026-07-22) → nötr ⏹️ (çalışmıyor da tamamlanmadı da). running/waiting → ▶️.
57+
if (currentPhaseStatus === "complete") return "✅";
58+
if (currentPhaseStatus === "idle") return "⏹️";
59+
return "▶️";
5860
}
5961
const reached = currentPhase === (0 as PhaseId) ? maxPhase : currentPhase;
6062
if (id < reached) return "✅"; // tamamlandı (yeşil kalır)
@@ -123,7 +125,16 @@ export function PhaseSidebar({
123125
title="Faz 0 — Hata Ayıklama (Debug Triage). Pipeline dışı, standalone. Yaşadığın hatayı chat'e yaz; debug akışı otomatik başlar."
124126
>
125127
<span className="phase-badge" aria-hidden>
126-
{isCurrent0 ? "▶️" : "🐛"}
128+
{/* MAHKEME MEDIUM (2026-07-22): Faz 0 current iken de phaseStatus'e bak — açılışta idle olan bir debug
129+
projesinde header "boşta" derken bu rozet sabit "▶️" (aktif) gösterip YENİ çelişki üretiyordu.
130+
idle → ⏹️ (nötr), complete → ✅ (Faz 0'da olmaz ama tutarlı), aksi (running/waiting) → ▶️. */}
131+
{isCurrent0
132+
? phaseStatus === "complete"
133+
? "✅"
134+
: phaseStatus === "idle"
135+
? "⏹️"
136+
: "▶️"
137+
: "🐛"}
127138
</span>
128139
<div className="phase-text">
129140
<div className="phase-label">Faz 0</div>

‎src/types/events.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ export interface NeededPhasesEvent {
3939
data: { phases: number[] | null };
4040
}
4141

42-
export type PhaseStatus = "running" | "waiting" | "complete" | "error";
42+
// "idle" = faz tamamlanmadı ama iş de beklemiyor (açılışta boşta) → nötr render. Backend types.ts ile birebir ayna.
43+
export type PhaseStatus = "running" | "waiting" | "complete" | "error" | "idle";
4344

4445
/** Orchestrator → UI event'leri.
4546
* UnknownEvent union'a dahil DEĞİL — discriminated narrowing'i bozar.

0 commit comments

Comments
 (0)