fffiloni commited on
Commit
65b4e25
Β·
verified Β·
1 Parent(s): 06d28a5

Upload 6 files

Browse files
Files changed (3) hide show
  1. CHANGELOG.md +53 -0
  2. README.md +31 -2
  3. app.py +2 -0
CHANGELOG.md CHANGED
@@ -1,5 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # Changelog
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ## v114 β€” Premium vector activity feed icons
4
 
5
  - Replaced text-coded activity markers such as `PI`, `API`, and `GPU` with inline SVG icons rendered by a dedicated `renderEventIcon(...)` helper.
 
1
+
2
+
3
+ ## v121 latency/display cleanup
4
+
5
+ - Reduced perceived latency when re-opening already inspected runs by reusing cached progress/detail payloads immediately and avoiding duplicate polling starts.
6
+ - Added DOM render signatures for run documents, Agent recovery and Gradio endpoint panels to prevent flicker during polling.
7
+ - Preserved heavy hydration in the background for full reports/artifacts while keeping the central panels responsive.
8
+
9
+
10
+ ## v120 β€” Agent recovery UI for blockage protocol
11
+
12
+ - Added an **Agent recovery** card to the Active Run panel so the v118/v119 core recovery protocol is visible to users.
13
+ - The card summarizes Pi diagnosis decisions, selected action, logs quality/failure category/confidence, evidence, next step, and the diagnose β†’ decide β†’ act β†’ revalidate ladder.
14
+ - Exposed `repair/REPAIR_DECISION.json` and `repair/BLOCKAGE.json` through the backend bundle, progress payload, and Run traces dock.
15
+ - Kept the existing unified `agent_trace.jsonl` as the canonical raw/redacted narrative across initial build, diagnosis, and repair.
16
+ - Added regression tests for the recovery panel, decision/blockage artifact links, progress payload exposure, and docs.
17
+
18
  # Changelog
19
 
20
+ ## v119 β€” unified agentic Pi traces
21
+
22
+ - Added a run-level `traces/raw/agent_trace.jsonl` and `traces/redacted/agent_trace.jsonl` journal that ties together the initial Pi build, Pi blockage diagnosis, repair decision, and optional repair patch into one auditable agent narrative.
23
+ - Kept specialized logs (`logs/pi_output.txt`, `logs/pi_diagnosis_output.txt`, `logs/pi_repair_output.txt`) as detailed artifacts, but made the curated `Pi RAW` / `Pi redacted` dock point to the unified trace when available.
24
+ - Diagnosis and repair phases now add explicit trace records for command start/end, output artifacts, repair decisions, and repair plan/summary artifacts so they no longer look like disconnected conversations.
25
+
26
+
27
+ ## v118 β€” Pi diagnosis blockage protocol
28
+
29
+ - Added a Pi **blockage diagnosis** step before any code repair. Failures now produce `repair/INCIDENT_BRIEF.md`, `repair/PI_DIAGNOSIS_GOAL.md`, `repair/REPAIR_DECISION.json`, and `logs/pi_diagnosis_output.txt`.
30
+ - Pi/Qwen now chooses a bounded action instead of being asked to patch immediately: `wait_for_logs`, `inspect_more_logs`, `factory_rebuild_same_code`, `patch_code`, `request_manual_hardware`, or `declare_technical_blocker`.
31
+ - Added Factory guardrails: no code patch on empty/no-reason logs, no patch for auth/quota/hardware blockers, and strict one-action budgets for wait, same-code rebuild, and patch repair.
32
+ - Added same-code factory rebuild recovery for HF build/runtime flakes where logs are empty or non-actionable.
33
+ - Patch repair now runs only after Pi diagnosis chooses `patch_code` and the Factory validates the decision.
34
+ - Added blockage artifacts and timeline events: `failure_detected`, `failure_diagnosis`, `pi_diagnosis`, `repair_decision`, `wait_for_logs`, `factory_rebuild`, `technical_blocker`, and `manual_hardware_required`.
35
+ - Updated tests to protect the diagnosis-before-patch contract and the failure timeline mapping.
36
+
37
+ ## v117 β€” Structured repair mode and repair timeline
38
+
39
+ - Reworked Pi repair from a loose log-based retry into a structured repair method.
40
+ - Added failure classification before repair (`dependency_error`, `import_error`, `gradio_api_mismatch`, `cuda_oom`, `model_loading_error`, `hf_auth_error`, `space_boot_timeout`, `wrong_output_type`, `zero_gpu_duration_error`, or `unknown_runtime_error`).
41
+ - The worker now writes `repair/REPAIR_BRIEF.md`, requests `REPAIR_PLAN.md` before patching, and stores `REPAIR_SUMMARY.md` after patching.
42
+ - Added strict repair constraints: patch the current workspace, do not rebuild unnecessarily, preserve real inference, do not fake outputs, keep the health endpoint, and preserve the validation contract.
43
+ - Added repair sanity checks before redeploying a patched workspace.
44
+ - Added repair-specific events: `repair_diagnosis`, `repair_plan`, `repair_patch`, `repair_upload`, and `repair_validation`.
45
+ - Updated the progress timeline so repair phases are visible and terminal failures always have a red failure point.
46
+ - Added a Repair document shortcut in the Active Run traces dock when repair artifacts exist.
47
+
48
+
49
+ ## v116 β€” Compact Run Explorer and billing note relocation
50
+
51
+ - Reworked the Run Explorer from large cards into a compact premium navigation list with one primary line, one context line, status pill, relative time and a discreet delete action.
52
+ - Kept build and validation rows distinct while making the business entity more prominent than the raw run ID.
53
+ - Moved the Inference Providers / paid credits / restricted A100-H200 fallback note out of New Build and into Billing & compute.
54
+ - Added regression tests for the compact list and billing-note placement.
55
+
56
  ## v114 β€” Premium vector activity feed icons
57
 
58
  - Replaced text-coded activity markers such as `PI`, `API`, and `GPU` with inline SVG icons rendered by a dedicated `renderEventIcon(...)` helper.
README.md CHANGED
@@ -46,7 +46,7 @@ The UI is organized into three main areas:
46
 
47
  - **Run storage** β€” check or create the signed-in user's private Bucket.
48
  - **New Build** β€” starts from `Tongyi-MAI/Z-Image-Turbo` by default, fast pre-scans the model card, then launches a private Space build only after an acceptable scan verdict.
49
- - **Billing & compute** β€” show payment readiness when available and link to HF Billing, Jobs pricing, and Inference Providers pricing.
50
 
51
  ### Center workspace
52
 
@@ -55,7 +55,7 @@ Two tabs share the main detail area:
55
  - **Active Run** β€” build progress, run actions, Space/Settings/Job/Artifacts links, manual hardware guidance, inference latency, a vector-icon latest-events feed, and curated trace documents.
56
  - **Space Test** β€” validation run details, actionnable Gradio endpoint picker, endpoint params, validation status, latency, point-based progress, and validation actions.
57
 
58
- Selecting a build run opens `Active Run`. Selecting a validation run opens `Space Test`.
59
 
60
  ### Right column
61
 
@@ -63,6 +63,13 @@ Selecting a build run opens `Active Run`. Selecting a validation run opens `Spac
63
  - **Run Stats** β€” aggregate metrics across indexed runs: totals, success/pass rates, validation latency median/p95, and issue counts.
64
 
65
 
 
 
 
 
 
 
 
66
  ## Model pre-scan
67
 
68
  New builds are gated by a fast model-card pre-scan. The scan is metadata-only and does not download model weights. It checks:
@@ -102,7 +109,9 @@ runs/<run_id>/generated/
102
  runs/<run_id>/tests/
103
  runs/<run_id>/artifacts/
104
  runs/<run_id>/traces/raw/
 
105
  runs/<run_id>/traces/redacted/
 
106
  runs/<run_id>/logs/
107
  ```
108
 
@@ -154,6 +163,11 @@ The validation job:
154
  - Hardware assignment is best-effort and can fall back to manual user action.
155
  - Raw and redacted Pi traces are kept separate.
156
 
 
 
 
 
 
157
  ## Non-goals and limits
158
 
159
  The app does not guarantee that every model card becomes a working Space. Some models require multi-GPU execution, Docker, unavailable CUDA extensions, external services, accepted licenses, very large hardware, or manual fixes.
@@ -182,3 +196,18 @@ See:
182
 
183
 
184
  Default example model: `Tongyi-MAI/Z-Image-Turbo`. It is treated as a known-good Diffusers text-to-image model for the fast pre-scan calibration and public-preview smoke tests.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  - **Run storage** β€” check or create the signed-in user's private Bucket.
48
  - **New Build** β€” starts from `Tongyi-MAI/Z-Image-Turbo` by default, fast pre-scans the model card, then launches a private Space build only after an acceptable scan verdict.
49
+ - **Billing & compute** β€” show payment readiness, link to HF Billing, and centralize the compute-cost note for Jobs, Inference Providers, and safe hardware fallbacks.
50
 
51
  ### Center workspace
52
 
 
55
  - **Active Run** β€” build progress, run actions, Space/Settings/Job/Artifacts links, manual hardware guidance, inference latency, a vector-icon latest-events feed, and curated trace documents.
56
  - **Space Test** β€” validation run details, actionnable Gradio endpoint picker, endpoint params, validation status, latency, point-based progress, and validation actions.
57
 
58
+ Selecting a build run opens `Active Run`. Selecting a validation run opens `Space Test`. The Runs Explorer is intentionally compact: each row prioritizes the model or Space, status, relative freshness, and a secondary context line while keeping the raw run ID available in the row.
59
 
60
  ### Right column
61
 
 
63
  - **Run Stats** β€” aggregate metrics across indexed runs: totals, success/pass rates, validation latency median/p95, and issue counts.
64
 
65
 
66
+
67
+ ### Agent recovery visibility
68
+
69
+ When a build or runtime blockage appears, the Active Run panel shows an **Agent recovery** card. It summarizes Pi's diagnosis decision, the selected recovery action (`wait_for_logs`, `factory_rebuild_same_code`, `patch_code`, manual hardware, or blocker), key evidence, and the next step. This makes the blockage protocol visible without turning the UI into a raw log viewer.
70
+
71
+ The Run traces dock also links to the unified `agent_trace.jsonl`, the diagnosis `REPAIR_DECISION.json`, repair artifacts, and blockage details when they exist.
72
+
73
  ## Model pre-scan
74
 
75
  New builds are gated by a fast model-card pre-scan. The scan is metadata-only and does not download model weights. It checks:
 
109
  runs/<run_id>/tests/
110
  runs/<run_id>/artifacts/
111
  runs/<run_id>/traces/raw/
112
+ runs/<run_id>/traces/raw/agent_trace.jsonl
113
  runs/<run_id>/traces/redacted/
114
+ runs/<run_id>/traces/redacted/agent_trace.jsonl
115
  runs/<run_id>/logs/
116
  ```
117
 
 
163
  - Hardware assignment is best-effort and can fall back to manual user action.
164
  - Raw and redacted Pi traces are kept separate.
165
 
166
+ ### Unified agent trace
167
+
168
+ Pi can be invoked more than once during a run: the initial build, a blockage diagnosis pass, and an optional structured repair patch. The Factory now writes a canonical run-level agent journal to `traces/raw/agent_trace.jsonl` and `traces/redacted/agent_trace.jsonl` so those phases read as one auditable agentic loop instead of separate conversations. Specialized stdout logs remain available under `logs/`, but the Active Run `Pi RAW` / `Pi redacted` buttons prefer the unified trace when it exists.
169
+
170
+
171
  ## Non-goals and limits
172
 
173
  The app does not guarantee that every model card becomes a working Space. Some models require multi-GPU execution, Docker, unavailable CUDA extensions, external services, accepted licenses, very large hardware, or manual fixes.
 
196
 
197
 
198
  Default example model: `Tongyi-MAI/Z-Image-Turbo`. It is treated as a known-good Diffusers text-to-image model for the fast pre-scan calibration and public-preview smoke tests.
199
+
200
+ ### Pi diagnosis and structured recovery
201
+
202
+ When the generated Space fails live validation, the factory now enters a diagnosis-first blockage protocol instead of asking Pi to patch immediately. The worker collects HF build/runtime logs, Space status and validation errors, writes `repair/INCIDENT_BRIEF.md`, then asks Pi/Qwen Coder to choose one bounded action in `repair/REPAIR_DECISION.json`: wait for delayed logs, inspect again, force a same-code factory rebuild, patch code, request manual hardware, or declare a technical blocker.
203
+
204
+ A code repair is allowed only when Pi selects `patch_code` and the Factory accepts the decision. Empty/no-reason HF failures are routed through wait/rebuild/blocker paths rather than speculative code edits. Patch repair still writes `REPAIR_BRIEF.md`, `REPAIR_PLAN.md`, and `REPAIR_SUMMARY.md`, uploads once, then revalidates the live Space with the normal API checks.
205
+
206
+ Repair mode is intentionally strict: it must preserve the original model and real-inference contract, avoid fake/static outputs, keep a cheap health endpoint, and report blockers instead of hiding runtime errors.
207
+
208
+ ## v121 latency/display cleanup
209
+
210
+ - Reduced perceived latency when re-opening already inspected runs by reusing cached progress/detail payloads immediately and avoiding duplicate polling starts.
211
+ - Added DOM render signatures for run documents, Agent recovery and Gradio endpoint panels to prevent flicker during polling.
212
+ - Preserved heavy hydration in the background for full reports/artifacts while keeping the central panels responsive.
213
+
app.py CHANGED
@@ -597,6 +597,8 @@ def register_custom_routes(fastapi_app: FastAPI) -> None:
597
  "api_schema": bundle.get("api_schema") or {},
598
  "hardware_strategy": bundle.get("hardware_strategy") or {},
599
  "technical_blockers": bundle.get("technical_blockers") or {},
 
 
600
  "run_documents": bundle.get("run_documents") or [],
601
  "events": events[-20:],
602
  "view": view,
 
597
  "api_schema": bundle.get("api_schema") or {},
598
  "hardware_strategy": bundle.get("hardware_strategy") or {},
599
  "technical_blockers": bundle.get("technical_blockers") or {},
600
+ "repair_decision": bundle.get("repair_decision") or {},
601
+ "blockage": bundle.get("blockage") or {},
602
  "run_documents": bundle.get("run_documents") or [],
603
  "events": events[-20:],
604
  "view": view,