Milestone 8: Web AG-UI
Status: M8 accepted and merged. PR #27's final head 4f5ee1220d4298e7276671c6a7b30542fb28fd40 merged as 26a0c712bf00256eec0ee0e3a436fcda8cc46937 after exact-head independent agent review, resolved review threads, and passing required checks. The repository owner changed Protect main so approval is optional and last-push approval is disabled; Local CI, CodeQL, resolved review threads, strict checks, and no bypass remain in force. Copilot auto-review remains enabled, but no approval was submitted because its monthly quota was exhausted. Prompt 8 is archived after acceptance; M9 was not started. This report records work on codex/milestone-8-web-ag-ui, based on freshly fetched origin/main at d2cfa55b81b85f1d45687f26ffd8ce5d663a3173. M8 did not change the task scheduler, PostgreSQL domain-event authority, authorization services, or worker lifecycle.
M1–M7 prerequisites
Before implementation, origin/main, the open PR list, and docs/milestones/01.md through 07.md were refreshed. The reports record accepted M1–M7 deliverables and their implementation evidence. M7 PR #25 merged through protection at d992bc1266ed08add12f54d0921546b5dc73528b; prompt 7 was archived only after its acceptance evidence. M6 final PR #21 merged at a55924350aebf2112ff7906978548727de081e4a after independent no-findings review and required checks. The M7 report says M1–M5 acceptance is documented in their reports; M3's paid-provider compatibility probe remains explicitly optional and pending, M4 records a NO-GO for LangGraph, and M7 does not claim live vector or MCP activation. These are inherited decisions and do not authorize paid calls for M8.
The implementation checkout is /home/menes/Projects/harnessa_v1_m8, a separate clean clone created because /home/menes/Projects/harnessa_v1 is a bare repository and cannot serve as a worktree. It began at the fetched origin/main SHA above; the original bare checkout and its local data were preserved.
Implementation delivered in this draft
- Added the responsive Next.js workspace shell and
/workspace/{board,openspec,harness,evals,routing,events}routes. The shell uses@harnessa/ui-react,@harnessa/design-tokens, Tailwind CSS v4, generated OpenAPI types, Harnessa semantic tokens, and Lucide icons. - Added the ten-column task board with independent task stage, run status, specification readiness/revision, server-derived transition buttons, an accessible details button separated from its keyboard drag handle, optimistic
If-Matchversions, idempotency keys, stale-write refresh, and visible authorization/conflict errors. - Added a task inspector for run activity, authorized command capabilities, specification interviews/questions, artifact editing, safe Markdown preview, and lazy-loaded Monaco editing/diff display. Answer and run-command retries reuse their idempotency key. Artifact
PUTretries with the same expected revision and content return the already-current artifact revision without creating a second revision. - Added project-scoped routing budget, usage, and request-ledger views. Harness Studio reads the last 50 tasks' authorized run status. Evals show specification readiness without representing task/run status as an evaluation result. The backend has no general Harness Studio revision/promotion or verifier-evaluation API; those controls/results remain unavailable and are labelled as such.
- Added
TaskCapabilitiesReadand the authorized task-interview read endpoint, then regenerated TypeScript schemas from the local API OpenAPI document. - Added an
ag-ui-protocol==1.0.0adapter using official Python event classes andEventEncoder. It projects run start/finish/error, step start/finish, assistant text start/content/end, redacted tool start/args/end/result, safe task state snapshots, run-progress state deltas, and namespaced custom events. ACP assistant text is persisted only after bounded credential-pattern screening; tool names are allowlisted, IDs are opaque, and tool arguments/results are never stored. The TypeScript client validates known AG-UI event types, skips malformed/unknown events, displays summaries rather than raw protocol frames, and bounds its visible history to 200 events. - Added a project-authenticated durable SSE replay/tail over PostgreSQL events: ordered project sequence IDs, bounded replay batches, three-second retry advice, one-second heartbeats, duplicate suppression, disconnect without worker cancellation, reauthorization on each poll, 410 cursor-expiry recovery from the authorized task snapshot, and access-revocation notification. A single workspace-level subscription refreshes the board and open inspector after persisted events; opening another route does not start a worker.
- Added safe Markdown sanitization and a focused malicious-markup test. No terminal transport was found or added.
AG-UI compatibility boundary
AG-UI is a UI event protocol and client package; it is not the durable event store or replay authority. The server encodes official Python event models. The browser consumes the official @ag-ui/core event union and uses @ag-ui/client's isRecognizedEvent guard. Harnessa retains durable ordering, authorization, cursor retention, idempotency, scheduling, and recovery.
The resume envelope is GET /projects/{project_id}/events/stream?after=<project_sequence> with Accept: text/event-stream. Each persisted frame has id: <project_sequence> and one standard encoded AG-UI event as its data: value. The browser stores the last accepted project sequence in tab-scoped sessionStorage; retry: 3000 is server advice. On 410 event_cursor_expired, the client reloads authorized task snapshots, sets the supplied oldest-available boundary, and reconnects. Closing the HTTP reader only releases the subscription. The explicit authenticated cancel command is separate.
Python protocol dependency: ag-ui-protocol 1.0.0. Browser protocol packages: @ag-ui/core and @ag-ui/client 1.0.3. The installed versions are pinned in pyproject.toml/uv.lock and apps/web/package.json/pnpm-lock.yaml. Implementation was checked against the official Python event models, Python EventEncoder guide, and TypeScript event types. Local typecheck/tests confirm the locked SDK APIs. The encoder emits standard JSON SSE event data; durable project sequence IDs and replay are Harnessa's envelope and authority. Durable ACP updates are written as new DomainEvent rows using the existing project sequence, fenced run lease, and run/task state checks. Each message is buffered to 8192 characters and the UI event collector is capped at 512 records per ACP session. The shared credential-pattern filter is best-effort screening, not a general secret detector; tool arguments and results remain omitted. Message content is emitted when the ACP message completes, rather than token-by-token. AG-UI still does not provide durable replay.
Evidence
Local checks
| Check | Result |
|---|---|
pnpm lint |
Passed; ESLint and Ruff clean. |
pnpm typecheck |
Passed; mypy checked 42 API files, generated contracts and both design systems passed. |
pnpm test:api |
155 passed, 1 skipped, 4 Starlette deprecation warnings. |
pnpm test:integration |
52 passed against disposable local harnessa_m8_ci_test PostgreSQL and Redis DB 6. Event-stream cases assert strictly increasing replay IDs and cover heartbeat, expired cursor, expiry during a live tail, grant revocation, and disconnect/reconnect without creating or cancelling the fixture's existing RUNNING run. No worker process or provider was launched. |
pnpm test:web |
Root Vitest 27 passed at 85.6% statement and 92.43% line coverage; cloud portal 2 passed; Marketing build and artifact checks passed. |
Full pnpm test |
Passed: 155 API tests, 52 integration tests, root Vitest 27, cloud portal 2, Marketing build/artifact checks; API coverage 85.13%, aggregate statement coverage 85.44%. |
| Workspace and Markdown tests | 16 workspace tests cover all six routes, authorized actions, conflicts, focus restoration, retained dnd-kit screen-reader instructions on the drag handle, hidden durable cursor values, replay duplicates, expired-cursor snapshot recovery, denied/error states, and artifact/answer/cancel states. Malicious Markdown sanitization tests pass. |
pnpm build:web |
Passed on the final workspace shell and route source. |
| Post-review targeted checks | Passed: 16 workspace tests, pnpm typecheck:web, pnpm lint:web, pnpm lint:api, pnpm build:web, and seven task-route integration tests. The integration tests exercise durable ACP step/message/tool event writes through PostgreSQL sequence/outbox records and official AG-UI projection. The integration run used a disposable harnessa_m8_review_test PostgreSQL database and Redis logical DB 7, then dropped the database; no worker or provider was started. |
| Strict offline docs build | uv run --offline --with-requirements requirements-docs.txt mkdocs build --strict --site-dir /tmp/harnessa-m8-docs-site passed. |
git diff --check |
Passed after the final source and report updates. |
All API/database checks were offline and used only disposable M8 databases. No paid provider call, external model call, production deployment, or live MCP/vector request was run. No provider was configured for these acceptance fixtures.
Browser Harness
Browser Harness used local Chrome 156.0.8078.47 on http://localhost:3017; the local FastAPI app ran at http://127.0.0.1:8010. Browser sessions used separate persistent incognito contexts and three temporary local-only accounts: operator, viewer, and outsider. The API used dedicated databases harnessa_m8_ui_20261023_test and harnessa_m8_ci_test, plus Redis database 6 inside existing local test containers. The containers were not stopped; no unrelated database or Redis logical database was flushed or reused for M8. Credentials and secret values are not recorded here.
Observed in the rendered browser:
- All six workspace routes rendered; the board showed all ten named columns and separate task stage, run status, and specification status.
- At a 375 × 812 viewport,
document.documentElement.scrollWidthwas 375. The board's inner width was 343 CSS pixels and its ten-column content was 2708 pixels wide, with scrolling contained inside the board. - In an operator session, keyboard Enter opened the task inspector; keyboard Enter on the authorized “Move to Ready” button changed the fixture task from
SPECIFYINGv4 toREADYv5. A separate viewer session received the same stage and version over its project event stream. The viewer had no transition capabilities. An outsider's project-task request returned HTTP 403. - In the inspector, Escape closed the dialog and returned focus to the originating task button. The event route showed “Live events connected” and safe event summaries without raw AG-UI frame payloads. That browser run used the pre-review UI revision, which still displayed the resume cursor and per-event sequence; the post-review cursor suppression is verified by the focused workspace tests below, because the follow-up Browser Harness connection was unavailable.
Browser Harness did not inject malformed stream frames or render hostile artifact Markdown in a live project. Those cases are covered by the web parser/component tests and API projection tests. Answer, artifact-edit, and cancel UI states are covered by the workspace tests; no real provider-backed run was started. A local integration fixture with an existing RUNNING run was disconnected and reconnected through the event reader; the run remained RUNNING and the run count stayed at one. This verifies the reader boundary, not a live external worker process.
After the independent review fixes, the Browser Harness rerun was unavailable: its local Chrome check reported zero active CDP browser connections (cdp_disconnected). The updated drag-handle description and cursor-free Events rendering were verified in the focused workspace tests; the earlier M8 rendered-browser evidence above remains from the actual Browser Harness run.
Independent exact-head review
The review comment on PR #27 first examined head 9011067ed1b0ea8ae3387564a386cb94324eda6f. It identified one P1 and three P2 findings. The P2 findings were verified and fixed in bf1e31bbd472326049890e71417a9a533977895a: capability targets now mirror backend transition guards, artifact reads have explicit denied/empty/error/retry states, and failed optimistic transitions reconcile from the server or roll back. The P1 finding concerned the absence of durable sources for standard step/text/tool events. The subsequent exact-head review of 0beb64f1f5a88735d2a18700e90eeced2ea4140d confirmed that source-event gap was closed and found three further issues: cancellation could leave AG-UI events open, final event persistence errors could be swallowed, and event writes locked rows in an order that could deadlock with scheduler completion/recovery. Commit 4ac2585f46a1858d2ad00099591bd1c35f87a4e6 permitted fenced terminal closures during cancellation, omitted partial assistant text on cancellation, projected run.cancelled to AG-UI RUN_FINISHED with a cancellation outcome, propagated persistence errors after cleanup, and locked lease → task → run in scheduler order. A fresh exact-head review of that commit found three additional lifecycle gaps: interrupted tool calls could remain open, the event cap did not reserve closure capacity, and pause requests rejected closure events. The current source closes outstanding tool envelopes, reserves bounded room for message/tool/step endings, and permits only fenced terminal/redacted tool closure events for paused or cancelled runs. The independent exact-head review of b384b8b648014ead3cc16c8c9f99c657c24a6e03 found three P2 issues: the drag handle replaced dnd-kit's screen-reader instructions, the Events route rendered durable cursor values, and replay tests did not assert ordering. The source and tests now preserve both description IDs, suppress cursor/sequence values in the Events UI, and assert strictly increasing SSE IDs for replay and reconnect. Focused workspace tests (16), web typecheck, web lint, API lint, and the task-route integration tests passed after these changes; the integration tests used a disposable PostgreSQL database and Redis logical database 7, both cleaned up afterward. The review of 6a187e8fbe50cf0659d24f093792ebdaa1d98073 confirmed those code/test findings were resolved and found that the Browser Harness report attributed the post-fix UI to an earlier run. The report now records the original UI accurately and distinguishes the later component-test evidence. Hosted Local CI on that head rejected the adjacent-sequence assertions under Ruff rule RUF007; the assertions now use itertools.pairwise(). The two source-event review threads were verified stale against the current implementation and resolved: persist_acp_ui_event appends normalized step/message/tool events through record_domain_event under the fenced lease, project_domain_event maps them to official standard AG-UI models, and a PostgreSQL integration test verifies the event rows, outbox rows, project-sequence order, and projected event families. A read-only independent source audit of exact head 6836bfa2a9b1f1f64103dc8fccaf151be7bf5d34 found no actionable product-code findings. It traced ACP event normalization through fenced persistence, ordered domain/outbox writes, standard AG-UI projection, and replay. Its coverage limitation is that this integration test starts with normalized events; event normalization and SSE replay are covered by separate tests. Two stale P1 review threads were answered and resolved. Hosted Local CI, CodeQL, and strict documentation build all pass on 6836bfa2a9b1f1f64103dc8fccaf151be7bf5d34 (Local CI pull request run 39893299332, push run 39893291873; CodeQL 39893299259; documentation build 39893299266, with deployment skipped). These results are before this documentation-only refresh and must be refreshed for its resulting head. Prior comments were submitted as COMMENT by the connected repository owner account and do not count as independent GitHub approval.
Current versions and configuration
- Source base:
origin/maind2cfa55b81b85f1d45687f26ffd8ce5d663a3173. - Initial automated acceptance-test revision:
62b6dc1(test: verify durable AG-UI event stream acceptance). The post-review UI fixes are at5e7d328(fix: address milestone 8 review findings); replay assertion lint correction is atf79279a(fix: use pairwise for replay ordering checks); PostgreSQL-to-AG-UI projection integration evidence is at69323f2(test: verify durable AG-UI event projection). Later report revisions remain on the same PR branch. - Local toolchain: Node.js 24.22.1, pnpm 10.34.7, Python 3.12,
ag-ui-protocol1.0.0. - Web: Next.js 16.4.2, React 19.3.1, Tailwind CSS 4.3.3, TypeScript 6.0.3,
@ag-ui/core/@ag-ui/client1.0.3,@dnd-kit/core6.3.1,@monaco-editor/react4.7.0,react-markdown10.1.0,remark-gfm4.0.1,rehype-sanitize6.0.0. - Local-only app/API ports: web 3017, API 8010, PostgreSQL test container port 56438 with dedicated
harnessa_m8_ui_20261023_testandharnessa_m8_ci_testdatabases, and Redis test container port 56439 database 6. Bootstrap, database password, and account credential values are excluded from this report. - No paid or external provider credential was configured or used.
Acceptance gaps and delivery gate
Local acceptance evidence covers the requested two-role browser transition, unauthorized outsider access, keyboard inspector and transition controls, focus restoration, responsive layout, event replay/heartbeat/expiry/revocation, safe parsing/rendering, and a disconnected/reconnected reader that does not alter an existing RUNNING run. Real-browser injection of malformed frames, hostile artifact Markdown, answer/artifact/cancel mutations, and a live worker process were not run; those UI and safety states are covered by component/API tests, and no provider-backed worker was started. The evals route cannot show verifier outcomes until a project-scoped evaluation API exists. The previous hosted run at 297cb59b9bdc28926defa97bb3a752a16abcf60d failed the API coverage threshold narrowly at 84.95%; new integration coverage raises local API coverage to 85.13% and aggregate statements to 85.44%. Hosted checks passed on implementation head 6836bfa2a9b1f1f64103dc8fccaf151be7bf5d34, report-refresh head 83451029c25047b2648eaa45d781db8746733132, and final PR head 4f5ee1220d4298e7276671c6a7b30542fb28fd40. On the final head, Local CI push 39897038601 and pull request 39897042276, CodeQL 39897042278, and strict documentation build 39897042316 all succeeded; documentation deployment was skipped. The independent read-only agent review of exact head 4f5ee1220d4298e7276671c6a7b30542fb28fd40 found no actionable findings. The local mkdocs executable was unavailable in this checkout, so hosted strict documentation builds are the documentation build evidence. Review threads were resolved. No GitHub approval was submitted: Copilot auto-review was enabled, but the reviewer picker reported “Copilot Monthly limit reached.” The ruleset change made approval optional at the user's direction; no paid provider call or capacity purchase was made. Protect main remains active, required checks and thread resolution remain enabled, and bypass is disabled.
Before implementation, no PR was open and fetched origin/main matched the source SHA above. PR #27 merged through the active Protect main ruleset at 26a0c712bf00256eec0ee0e3a436fcda8cc46937. The user directed that AI-agent approval be preferred but not mandatory. The ruleset now requires strict Local CI, CodeQL, and resolved review threads; required_approving_review_count=0 and require_last_push_approval=false. The Copilot code-review rule requests review on pushes and excludes drafts. bypass_actors is empty and current_user_can_bypass is never. The final PR head's checks passed. Prompt 8 was archived only after the protected merge and acceptance evidence.
M8 acceptance and merge are complete. M9 remains the next milestone and was not started in this run.
Rollback and recovery
- Code rollback after a future merge:
git revert <M8-merge-sha>and send that revert through the same protectedmainworkflow. - This implementation adds no database migration. If discarding the local acceptance environment, stop the local API/web processes and drop only
harnessa_m8_ui_20261023_testandharnessa_m8_ci_testfrom the existing PostgreSQL test container (connect with its configured test role and runDROP DATABASE harnessa_m8_ui_20261023_test;andDROP DATABASE harnessa_m8_ci_test;). Do not drop or flush the shared test container or Redis database outside the M8-owned database. - Expired browser cursor: reload the authorized project task snapshot, resume from the server-supplied oldest-available boundary, and reconnect with
?after=<cursor>. Disconnecting the event reader does not cancel or retry a worker run.
Next prerequisites before M9
Before starting M9, refresh Git and GitHub state from origin/main and re-read its prompt and prerequisites. Keep Protect main required checks and thread resolution enabled; Copilot review is configured to run automatically on pushes but approval is optional.