feat: gate decision-type validation, force-advance, and frontend fixes

Gate (tht-gate.js):
- Pre-validate decision types against workflow.yaml before showing reviewer widget
- Reject decisions emitted by later phases (min-phase check)
- Copy top-level `kind` into artifact when model forgets it (prevents loop)
- Force-advance on reviewer_decide/schema_linking when advance:true — skip
  redundant reviewer_confirm gate

Backend:
- Emit agent_end on clean Pi exit (code 0 + bridge idle) instead of marking failed

Frontend:
- Strip <think> tags from transcript and activity panel
- Fix mermaid render with offscreen container + cleanup
- Graceful mermaid error: show source code instead of red error, fall back to table

Workflow:
- F2 now emits table_promoted and table_excluded (early schema linking decisions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-07-19 14:14:44 +02:00
co-authored by Claude Opus 4.6
parent 9fbca06f7c
commit 6ee5bda7f0
9 changed files with 114 additions and 16 deletions
+8
View File
@@ -122,6 +122,14 @@ export class PiProcessManager {
child.on("exit", (code) => {
console.error(`[pi:${sessionId}] exited code=${code ?? "?"} mapped=${this.runtimes.get(sessionId) === runtime}`);
if (this.runtimes.get(sessionId) === runtime) {
// Clean exit (code 0) while the bridge is idle means the model completed its
// turn and Pi shut down normally (e.g. after session finalization). Just clean
// up — no failure events.
if (code === 0 && runtime.bridge.turnState() === "idle") {
this.runtimes.delete(sessionId);
runtime.bridge.emitClientEvent({ type: "system_event", event: "agent_end" });
return;
}
runtime.bridge.markFailed();
this.runtimes.delete(sessionId);
runtime.bridge.emitClientEvent({