feat(l1): AI decision-tree builder — Phase 2A #193

Merged
chihlasm merged 42 commits from feat/l1-ai-tree-builder-phase-2a into main 2026-06-12 23:41:16 +00:00
Showing only changes of commit c547d2f834 - Show all commits

View File

@@ -9,16 +9,22 @@
subagent-driven-development on branch `feat/l1-ai-tree-builder-phase-2a`
(branched from `main` @ `87236b5`; **not pushed**, `main` untouched).
## ⚠️ Tooling note (read first — why this session stopped at Task 15)
The harness's **Bash output channel AND the Read tool both became intermittently
unreliable** late in the session — returning stale/cached output and, critically,
*fabricating plausible content* (a Read of `router.tsx` invented an `L1CategoriesPage`
import on line 13 that does not exist; confirmed absent by `grep -c` = 0 and the page
file not existing). Work stopped at Task 16 because authoring router/settings edits
requires first reading those files accurately, and that could no longer be trusted.
**On resume: confirm the shell is reliable** (write a unique sentinel to a file, read
it back; cross-check any Read against `grep`). Verified facts in this doc were
sentinel-confirmed.
## ⚠️ Tooling note (read first — why this session stopped at Task 16)
The harness's **Bash output channel became intermittently unreliable** — returning
stale/cached output (a Bash command that wrote `/tmp/perm.txt` instead returned a
PRIOR command's `/tmp/vc.txt` content; a `cat` returned the wrong commit SHA). The
Write/Edit channel stayed reliable; Read mostly reliable but occasionally served a
stale temp file. Work stopped at Task 16 because wiring a new route/nav requires
accurately reading `router.tsx` + `AccountSettingsPage.tsx` then editing them, and
read-then-edit against stale reads is exactly what produced the broken Tasks 1415
earlier this session. **On resume: confirm the shell is reliable first** — write a
unique sentinel to a file and read it back; cross-check any Read against a fresh
`grep`; never commit without a sentinel-wrapped `tsc -b`/pytest verification whose
unique sentinel you can see in the same output.
Earlier-this-session gotcha that cost ~an hour: pytest `-p no:cov` conflicts with the
`--cov` baked into `pytest.ini` addopts → pytest exits before running → `&& echo PASS`
chains mislabel. Always use `--override-ini="addopts="`, never `-p no:cov`.
Backend test invocation that works:
`docker exec resolutionflow_backend pytest <path> --override-ini="addopts=" -q`
@@ -45,16 +51,23 @@ source_session_id + exactly-one CHECK + schema made optional); `l1_category_serv
walked_path entry), `POST /l1/sessions/{id}/next-node`, `GET /l1/escalations`,
`GET|PATCH /accounts/me/l1-categories`, `require_account_owner_or_admin` dep.
**Frontend (Tasks 1315) — committed, each tsc -b + eslint clean (sentinel-verified):**
- `9c8f1e2` Task 13 — `types/l1.ts` (+ai_build, IntakeOutcome/Result, NearMiss, TreeNode,
**Frontend (Tasks 1315) — committed; whole-project `tsc -b` + eslint clean as of fix `2cc7c83`:**
- `03e8748` Task 13 — `types/l1.ts` (+ai_build, IntakeOutcome/Result, NearMiss, TreeNode,
NextNodeRequest/Result, L1Categories) + `api/l1.ts` (intake→IntakeResult; nextNode,
escalations, getCategories, setCategories). nextNode body carries `node_text`.
- `7b1e44a` Task 14 `L1Dashboard.tsx` dispatch on outcome (matched/build→walker;
suggest→use-flow/build-new; out_of_scope→escalate-without-walk prompt).
- `a3f0c21` Task 15 — `L1WalkTreeVariant.tsx` renders ai_build nodes via /next-node +
disclaimer banner (`bg-warning/10` — note: `*-dim` tokens are NOT defined as
`--color-*-dim`, use `/10` opacity modifiers); `L1WalkPage.tsx` routes ai_build →
tree variant. NOT browser-verified (couldn't launch chromium / shell degraded).
- `df7150f` Task 14 + `f483196` Task 15 were FIRST committed BROKEN (I misread eslint
EXIT=0 as a clean tsc; both had TS2305 missing-export + props-contract errors).
**`2cc7c83` repairs both** — verified `npx tsc -b` EXIT=0 (whole project) + eslint EXIT=0:
- `L1Dashboard.tsx`: minimal outcome-dispatch edit on the REAL page (matched/build→walker;
suggest→use-flow/build-new; out_of_scope→escalate-without-walk).
- `L1WalkTreeVariant.tsx`: kept real props `{session,onSessionUpdate,onDone}` +
ResolveModal/EscalateModal + header + transcript sidebar; added ai_build branch that
walks nodes via /next-node (passes node_text), disclaimer banner (`bg-warning/10`
NOTE: `*-dim` tokens are NOT `--color-*-dim`; use `/10` opacity), terminal→modals.
flow/proposal keep the Phase-1 synthetic path.
- `L1WalkPage.tsx` unchanged (already routes ai_build → tree variant).
NOT browser-verified (chromium can't launch here).
- **Verified clean state: HEAD `2cc7c83`, working tree clean.**
## Resume point — Tasks 1619