Skip to content

refactor(agent): WIP functional runner contracts - #1293

Merged
gewenyu99 merged 13 commits into
mainfrom
posthog/functional-a1-min
Sep 23, 2026
Merged

gewenyu99 merged 13 commits into
mainfrom
posthog/functional-a1-min

Conversation

@gewenyu99

@gewenyu99 gewenyu99 commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Make runAgent callable through typed input, result, progress, and interaction contracts while preserving existing runner output and cleanup ordering.

flowchart TB
  subgraph host["run-agent-legacy · temporary adapter"]
    direction LR
    rpa["<div style='width:180px'>runProgramAgent</div>"]:::temp
    reducer["<div style='width:180px'>createUiReducer</div>"]:::new
    interaction["<div style='width:180px'>uiInteraction</div>"]:::new
  end

  subgraph agent["agent · runAgent boundary"]
    direction TB
    subgraph runner["<div style='width:180px'>runner</div>"]
      direction LR
      run["<div style='width:180px'>runAgent</div>"]:::new
      collector["<div style='width:180px'>createProgressCollector</div>"]:::new
    end
    subgraph sequence["<div style='width:180px'>sequence</div>"]
      direction LR
      linear["<div style='width:180px'>runLinearProgram</div>"]
      orchestrator["<div style='width:180px'>runOrchestrator</div>"]
      askbridge["<div style='width:180px'>createAskBridge</div>"]:::new
    end
    subgraph harness["<div style='width:180px'>harness</div>"]
      direction LR
      anthropic["<div style='width:180px'>anthropicBackend</div>"]
      pi["<div style='width:180px'>piBackend</div>"]
    end
  end

  subgraph tools["wizard-tools MCP"]
    ask["<div style='width:180px'>wizard_ask</div>"]
  end

  rpa -->|"config, input, options"| run
  run --> linear
  run --> orchestrator
  linear --> anthropic
  orchestrator --> pi
  anthropic -->|tool call| ask
  pi -->|tool call| ask

  run -. RunResult .-> rpa
  harness -. emit .-> runner
  runner -. onProgress .-> host
  tools -. askBridge .-> sequence
  sequence -.->|"interaction.ask"| host

  classDef new fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
  classDef temp fill:#fef3c7,stroke:#b45309,color:#78350f,stroke-dasharray:5 3
  style agent fill:transparent,stroke:#1d4ed8,stroke-width:2px
  style host stroke:#b45309,stroke-dasharray:5 3
Loading

Flow is top down. Solid is a call, dotted is a callback or an event, and each dotted edge lands on the tier that owns the receiver.

Style Meaning Nodes
Blue boundary The agent, everything runAgent owns. Never reads a session, a UI, or a store. runner, sequence, harness
Blue node New in this PR runAgent contract, createProgressCollector, createAskBridge, createUiReducer, uiInteraction
Plain node Unchanged behavior, new plumbing only runLinearProgram, runOrchestrator, anthropicBackend, piBackend, wizard_ask
Dashed amber Temporary. run-agent-legacy rebuilds today's session-driven behavior on top of the contract, and programs replace it in Release B. runProgramAgent

Important stuff for review

Label Files
Agent module runner/index.ts
sequence/linear.ts
orchestrator-runner.ts
harness/anthropic/index.ts
harness/pi/index.ts
harness/pi/task.ts
agent-interface.ts
Invocation seam of agent run-agent-legacy.ts
runner/shared/types.ts
run-wizard.ts
run-non-interactive.ts
posthog-integration/index.ts
Agent tools progress.ts
progress-collector.ts
runner/shared/ask.ts
wizard-ask-bridge.ts
wizard-tools/mcp.ts
harness/pi/tools.ts
Plumbing ui/agent-progress.ts
ui/wizard-ui.ts
ui/tui/ink-ui.ts
ui/tui/store.ts

Progress is optional and best effort. Questions await the injected answerer, preserving existing timeout and cancellation behavior.


Created with PostHog Desktop

…on contracts

runAgent(config, input, {onProgress?, interaction?, signal?}) returns a
RunResult and never rejects. RunConfig and RunInput replace the session
reads, AgentProgress replaces the getUI() calls, an optional AgentInteraction
replaces the getUI() answerer, and every former wizardAbort returns as a
failure with the same fields. An unexpected throw returns as outcome
'crashed' with the original error attached.

Gates, authenticate, token refresh, flag fetch, binding resolution and the
exit move to src/lib/programs/run-agent-legacy.ts, which maps each progress
event to one WizardUI call so every existing caller keeps its output.
authenticate moves to programs unchanged. The allowlist architecture test is
removed; import enforcement lands with the A2 move.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci ai-observability
  • /wizard-ci basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci replay-vision
  • /wizard-ci revenue
  • /wizard-ci self-driving
  • /wizard-ci warehouse
  • /wizard-ci warehouse-seeded

Test an individual app:

  • /wizard-ci ai-observability/anthropic
  • /wizard-ci ai-observability/google-adk
  • /wizard-ci ai-observability/groq
Show more apps
  • /wizard-ci ai-observability/manual-capture
  • /wizard-ci ai-observability/openai
  • /wizard-ci ai-observability/openai-agents
  • /wizard-ci ai-observability/opentelemetry
  • /wizard-ci ai-observability/vercel-ai
  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/flutter
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci replay-vision/javascript-node
  • /wizard-ci replay-vision/next-js
  • /wizard-ci replay-vision/react-vite
  • /wizard-ci revenue/stripe
  • /wizard-ci self-driving/astro
  • /wizard-ci self-driving/fastapi
  • /wizard-ci self-driving/nuxt
  • /wizard-ci self-driving/react-router
  • /wizard-ci self-driving/sveltekit
  • /wizard-ci warehouse/monorepo-env
  • /wizard-ci warehouse/multi-source-next
  • /wizard-ci warehouse/stripe-node
  • /wizard-ci warehouse/zero-source
  • /wizard-ci warehouse-seeded/next-stripe
  • /wizard-ci warehouse-seeded/next-stripe-declined

Test against a Context Mill branch:

  • /wizard-ci all context-mill:my-branch

Add context-mill:<branch> to any command above to pin the Context Mill branch. It defaults to main.

Results will be posted here when complete.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
…the cut

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
@gewenyu99 gewenyu99 changed the title refactor(agent): WIP make runAgent a function with progress and interaction contracts refactor(agent): make runAgent a function with progress and interaction contracts Sep 21, 2026
@gewenyu99
gewenyu99 marked this pull request as ready for review September 21, 2026 22:23
@gewenyu99
gewenyu99 requested a review from a team as a code owner September 21, 2026 22:23
@gewenyu99
gewenyu99 marked this pull request as draft September 21, 2026 22:23
Comment thread src/lib/agent/runner/harness/anthropic/index.ts
@veria-ai

veria-ai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 1 · PR risk: 0/10

Restore detection progress, isolate progress observers, and preserve
completion and cleanup ordering. Type run outcomes and share status
history handling; cover harness, sequence, and adapter boundaries.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
@gewenyu99 gewenyu99 changed the title refactor(agent): make runAgent a function with progress and interaction contracts refactor(agent): WIP functional runner contracts Sep 21, 2026
Track pending requests in the ask bridge and pass its accessor to both
Anthropic harness paths. This restores the permission guard against
Write/Edit calls racing an unanswered wizard_ask request.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
Cover delayed answers across both sequences and harness bindings, plus
completion when questions are disabled. Production behavior is unchanged.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
@gewenyu99

gewenyu99 commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

Self-review

Current head: c001f467. Current Build & Test run. The Mermaid diagram and Important stuff for review file map are in the PR description.

Open for review

Run cancellation scope. The incomplete cancellation surface was removed because it never reached active harness execution. The callable currently accepts onProgress and interaction. The fuller plan includes end-to-end run cancellation in A1′; whether to implement it in this PR or defer it remains an open scope decision. This is separate from question cancellation, whose existing behavior is preserved.

Architecture ledger. The note on known-violations.json is a migration-ledger note, not a new finding. Original self-review note:

You can ignore this, truing this as a build/test time ledger for my own agent while I have to move heaven and earth lol

Verification

Coverage Result and revision
Full local build/test 189 files / 3,150 tests passed on dbfbfff6, plus typecheck and scoped lint.
Question waiting and disabled questions 195 focused tests passed on d2142164, plus typecheck, ESLint, and Prettier. This follow-up only changes tests.
Live Pi / orchestrator 7/7 required steps completed, 1 skipped, exit 0, 26 TUI frames. Run on b0a4c1e9, before the pending-question guard fix.
Live Anthropic / linear / claude-sonnet-5 9/9 completed, exit 0, 35 TUI frames. Includes the dbfbfff6 pending-question guard fix.
Generated applications Both successful live runs passed separate CRUD/error-response checks and real SDK delivery of three lifecycle events to a local receiver.

Live fixtures asked no questions, so deterministic regressions cover delayed answers and the question/write race. The recorder freezes skillsComplete=false at its first outro; later frames preserve the follow-up flow. MCP/keep-skills follow-up choices are simulated store actions. The initial Anthropic attempt inherited an incompatible OpenAI model and was rejected by the gateway; the explicit Sonnet rerun passed.

Evidence index: workbench/wizard-functional-evidence/a1-live-ci-review.md. The documentation commits after d2142164 do not change executable code.

Addressed history

Completed fixes and superseded progress updates are preserved below. The cancellation scope decision above remains open.

stale 1: initial baseline verification and headless run log

Original update: 2026-09-21T22:14:19Z.

Verified locally on ebee145, not waiting on CI.

Check Result
pnpm typecheck, pnpm lint pass, 0 errors
pnpm build:ci + vitest run 184 files, 3112 tests pass, no golden regenerated
headless --ci, fresh express-todo copy, project 228144 exit 0, PostHog set up: 7/7 steps completed (1 skipped as not required)
Headless run log, 133 lines
┌  Welcome to the PostHog setup wizard
│  Running posthog-integration in CI mode
│  Using provided API key (CI mode - OAuth bypassed)
│  Scanning the repo for projects...
│  Continuing with . (Node.js).
│  Task-queue orchestrator enabled.
◌  Planning the integration...
◇  Seeding the independent setup tasks.
◌  Seeding the independent setup tasks.
◇  Seeding the independent setup tasks.
◌  Seeding the independent setup tasks.
◇  Queuing identity and error instrumentation after setup.
◌  Queuing identity and error instrumentation after setup.
◇  Queuing event instrumentation after identity work.
◌  Queuing event instrumentation after identity work.
◇  Queuing review and dashboard work in parallel.
◌  Queuing review and dashboard work in parallel.
◇  Queuing the final report after review and insights.
◌  Queuing the final report after review and insights.
●  Planned the integration
◌  [0/8] Add PostHog SDK
◌  [0/8] Add PostHog SDK · Initialize PostHog
◇  Reading the framework requirements and installation workflow before inspecting the project.
◌  Reading the framework requirements and installation workflow before inspecting the project.
◇  I’m reviewing the integration rules and project handoff before locating the JavaScript entry point.
◌  I’m reviewing the integration rules and project handoff before locating the JavaScript entry point.
◇  Inspecting the project manifest and package-manager configuration to select the required SDK packages.
◌  Inspecting the project manifest and package-manager configuration to select the required SDK packages.
◇  I’m identifying the server structure, startup path, existing environment conventions, and any CSP.
◌  I’m identifying the server structure, startup path, existing environment conventions, and any CSP.
◇  Confirming current dependencies before adding the Node server SDK.
◌  Confirming current dependencies before adding the Node server SDK.
◇  I’m inspecting the application entry point and manifest to place one reusable server client without changing unrelated behavior.
◌  I’m inspecting the application entry point and manifest to place one reusable server client without changing unrelated behavior.
◇  Installing the official `posthog-node` server SDK with npm so its resolved version is recorded.
◌  Installing the official `posthog-node` server SDK with npm so its resolved version is recorded.
│  Allowing bash command: npm install posthog-node
◇  Verifying that npm recorded the resolved PostHog dependency in the manifest and lockfile.
◌  Verifying that npm recorded the resolved PostHog dependency in the manifest and lockfile.
◇  I’m checking the Node SDK reference for the supported singleton pattern and development-time configuration guard.
◌  I’m checking the Node SDK reference for the supported singleton pattern and development-time configuration guard.
◇  Recording the completed SDK installation handoff for the next workflow step.
◌  Recording the completed SDK installation handoff for the next workflow step.
◌  [1/8] Initialize PostHog
◇  I’m configuring the supplied environment values and adding a guarded, process-wide PostHog Node client at the Express startup boundary.
◌  I’m configuring the supplied environment values and adding a guarded, process-wide PostHog Node client at the Express startup boundary.
◇  I’m verifying the resulting singleton, startup import, environment documentation, and configured key presence without running the app.
◌  I’m verifying the resulting singleton, startup import, environment documentation, and configured key presence without running the app.
◇  I’m removing an unused startup binding while retaining the module-load initialization and exported singleton.
◌  I’m removing an unused startup binding while retaining the module-load initialization and exported singleton.
◇  PostHog initialization is complete and ready for downstream route instrumentation.
◌  PostHog initialization is complete and ready for downstream route instrumentation.
◇  I’m publishing the initialization handoff and completing this task.
◌  I’m publishing the initialization handoff and completing this task.
◌  [2/8] Add user identity
◌  [2/8] Add user identity · Track uncaught errors
◇  I’m reading the integration rules and identification workflow before inspecting the Express app.
◌  I’m reading the integration rules and identification workflow before inspecting the Express app.
◇  Reading the integration rules and error-tracking workflow before configuring the app-wide handler.
◌  Reading the integration rules and error-tracking workflow before configuring the app-wide handler.
◇  Inspecting the Node error-tracking reference and the Express entry point to attach one centralized error handler.
◌  Inspecting the Node error-tracking reference and the Express entry point to attach one centralized error handler.
◇  I’m locating the authentication and request boundaries so identity can be bound once per Express request.
◌  I’m locating the authentication and request boundaries so identity can be bound once per Express request.
◇  I confirmed this is a server-only Express todo API with no authentication, session, login, registration, or user model.
◌  I confirmed this is a server-only Express todo API with no authentication, session, login, registration, or user model.
◇  Checking the installed SDK’s Express helper placement requirements, then I’ll add it once at the application entry point.
◌  Checking the installed SDK’s Express helper placement requirements, then I’ll add it once at the application entry point.
◇  I’m closing the identification task as not applicable because the API has no user identity boundary to instrument.
◌  I’m closing the identification task as not applicable because the API has no user identity boundary to instrument.
◇  Adding the SDK’s centralized Express error middleware after all routes so framework-handled exceptions are reported.
◌  Adding the SDK’s centralized Express error middleware after all routes so framework-handled exceptions are reported.
◌  [2/8] Track uncaught errors
◌  [2/8] Track uncaught errors · Instrument key events
◇  Verifying the single app-entry integration is guarded for missing configuration and placed after the routes.
◌  Verifying the single app-entry integration is guarded for missing configuration and placed after the routes.
◇  Finalizing the completed centralized Express error-tracking handoff.
◌  Finalizing the completed centralized Express error-tracking handoff.
◇  Reviewing the integration rules and capture workflow before selecting route actions to instrument.
◌  Reviewing the integration rules and capture workflow before selecting route actions to instrument.
◌  [3/8] Instrument key events
◇  Inspecting the API routes and existing analytics naming to capture only meaningful todo actions.
◌  Inspecting the API routes and existing analytics naming to capture only meaningful todo actions.
◇  Recording the concise event plan for the three data-changing todo routes before adding personless server captures.
◌  Recording the concise event plan for the three data-changing todo routes before adding personless server captures.
◇  Adding guarded personless captures after each successful mutation without sending todo titles or other user-entered data.
◌  Adding guarded personless captures after each successful mutation without sending todo titles or other user-entered data.
◇  Verifying the final route instrumentation and event-plan contract without running tests or builds.
◌  Verifying the final route instrumentation and event-plan contract without running tests or builds.
◌  [4/8] Review integration
◌  [4/8] Review integration · Build analytics insights
◇  I’m loading the verification rules, upstream changeset handoffs, package-manager details, and configured environment-key status before reviewing or running commands.
◌  I’m loading the verification rules, upstream changeset handoffs, package-manager details, and configured environment-key status before reviewing or running commands.
◇  Reviewing the dashboard workflow and project event contract before creating the requested analytics artifacts.
◌  Reviewing the dashboard workflow and project event contract before creating the requested analytics artifacts.
◇  Loading the platform’s dashboard and query guidance, then inspecting the creation tools required for verified artifact payloads.
◌  Loading the platform’s dashboard and query guidance, then inspecting the creation tools required for verified artifact payloads.
◇  I’m reviewing the product-analytics and error-tracking rules, then reading each inspectable changeset file once to assess minimality, unrelated changes, local patterns, and framework-example shape.
◌  I’m reviewing the product-analytics and error-tracking rules, then reading each inspectable changeset file once to assess minimality, unrelated changes, local patterns, and framework-example shape.
◇  Inspecting existing dashboard resources and exact schemas so the new starter dashboard can be created without duplicate or malformed artifacts.
◌  Inspecting existing dashboard resources and exact schemas so the new starter dashboard can be created without duplicate or malformed artifacts.
◇  Checking for an existing wizard dashboard and reusable event insights before creating only the missing starter artifacts.
◌  Checking for an existing wizard dashboard and reusable event insights before creating only the missing starter artifacts.
◇  Inspecting saved-insight lookup fields before searching for reusable wizard views tied to the instrumented events.
◌  Inspecting saved-insight lookup fields before searching for reusable wizard views tied to the instrumented events.
◇  I found no project-defined build, typecheck, or lint scripts. I’m installing from the npm lockfile now; after that I’ll make only any runtime-critical review fix and validate the available syntax/load path without starting the server or running tests.
◌  I found no project-defined build, typecheck, or lint scripts. I’m installing from the npm lockfile now; after that I’ll make only any runtime-critical review fix and validate the available syntax/load path without starting the server or running tests.
│  Allowing bash command: npm install
◇  Searching the project for an exact dashboard and existing wizard insights before creating the requested starter views.
◌  Searching the project for an exact dashboard and existing wizard insights before creating the requested starter views.
◇  Verifying the newest matching dashboard’s tile set to confirm it covers this application’s three captured lifecycle events.
◌  Verifying the newest matching dashboard’s tile set to confirm it covers this application’s three captured lifecycle events.
◇  Inspecting the dashboard retrieval schema before checking the candidate’s attached insights and event coverage.
◌  Inspecting the dashboard retrieval schema before checking the candidate’s attached insights and event coverage.
◇  Retrieving the candidate dashboard to validate that its existing insights match the newly instrumented event contract.
◌  Retrieving the candidate dashboard to validate that its existing insights match the newly instrumented event contract.
◇  Checking the dashboard’s insight execution capability to confirm the starter tiles are operational after their reuse.
◌  Checking the dashboard’s insight execution capability to confirm the starter tiles are operational after their reuse.
◇  The install is clean. Review found one runtime-critical initialization defect: the configured `.env` file is never loaded by the app, so a normal start can leave the SDK uninitialized; I’m fixing that in the existing singleton without changing the analytics contract.
◌  The install is clean. Review found one runtime-critical initialization defect: the configured `.env` file is never loaded by the app, so a normal start can leave the SDK uninitialized; I’m fixing that in the existing singleton without changing the analytics contract.
◇  Inspecting the dashboard tile execution schema before validating the existing starter analytics views.
◌  Inspecting the dashboard tile execution schema before validating the existing starter analytics views.
◇  I’m applying the targeted initialization fix now, preserving external environment precedence and keeping a missing `.env` non-fatal as required.
◌  I’m applying the targeted initialization fix now, preserving external environment precedence and keeping a missing `.env` non-fatal as required.
◇  Running the four reused lifecycle tiles to validate that the starter dashboard’s saved queries execute successfully.
◌  Running the four reused lifecycle tiles to validate that the starter dashboard’s saved queries execute successfully.
◇  Publishing the completed dashboard handoff with its verified URL and insight inventory for the final report.
◌  Publishing the completed dashboard handoff with its verified URL and insight inventory for the final report.
◌  [5/8] Review integration
◇  Verification and review are complete: npm install is clean, no build/typecheck/lint scripts exist, and all four review dimensions pass after one initialization fix. I’m publishing the handoff and closing the task.
◌  Verification and review are complete: npm install is clean, no build/typecheck/lint scripts exist, and all four review dimensions pass after one initialization fix. I’m publishing the handoff and closing the task.
◌  [6/8] Report integration
◇  Gathering the recorded run outputs and report-specific instructions before composing the final setup handoff.
◌  Gathering the recorded run outputs and report-specific instructions before composing the final setup handoff.
◇  Loading the current PostHog notebook workflow guidance before creating the shareable report copy.
◌  Loading the current PostHog notebook workflow guidance before creating the shareable report copy.
◇  Publishing the recorded setup report first, then creating its identical in-app notebook copy.
◌  Publishing the recorded setup report first, then creating its identical in-app notebook copy.
◇  Recording completion details for the workflow handoff.
◌  Recording completion details for the workflow handoff.
└  PostHog set up: 7/7 steps completed (1 skipped as not required).
EXIT=0
stale 2: runner contract fixes and earlier validation

Original update: 2026-09-21T22:57:21Z.

Review fixes in b0a4c1e9:

  • Restore detection progress through the shared UI reducer; distinguish the host runProgramAgent adapter from functional runAgent.
  • Use enum/discriminated outcomes, shared bounded status history, and detached observer payloads.
  • Drain active sibling tasks before cleanup, clean queue artifacts on seed failures, and preserve completion/outro/analytics/scan-flush order.
  • Add regression coverage across both harnesses, both sequences, and host adapters.

Validation: typecheck, full build/test (188 files, 3,138 tests), lint (zero errors; 482 existing warnings), and CI build pass. No golden files regenerated. Live Pi/orchestrator Express CI snapshots are running; results will follow.

Open scope decision: this draft removes the incomplete cancellation surface, which never reached active harness execution. The fuller plan includes end-to-end cancellation in A1′; keeping it deferred versus implementing it here remains pending. The current callable options are onProgress and interaction.

stale 3: interim Pi live-run report

Original update: 2026-09-21T23:02:47Z.

Live CI snapshot run completed on b0a4c1e9: real Pi/orchestrator gateway run against a fresh Express Todo copy, project 228144 (US), exit 0; 7/7 required steps completed, one identification step skipped, no failed tasks or unanswered questions. Captured 26 TUI frames through the success outro and follow-up screens.

Reviewed the generated diff and separately exercised CRUD/error responses plus real SDK delivery of three lifecycle events to a local receiver; all passed. Created dashboard and setup notebook.

Evidence is retained locally at workbench/wizard-functional-evidence/a1-review-live-express-todo/ (gallery, screenshots, redacted logs/result, app diff, runtime checks). Recorder caveat: its first-outro write freezes skillsComplete=false; later frames and exit log preserve the follow-up evidence. MCP/keep-skills outcomes are simulated store choices.

A follow-up is underway for the confirmed pending-question Write/Edit guard regression; this live run predates that fix.

stale 4: pending-question Write/Edit guard fixed

Original update: 2026-09-21T23:07:39Z.

Confirmed and fixed the pending-question write guard in dbfbfff6.

The shared ask bridge now exposes pending state synchronously, before invoking the answerer. Both Anthropic execution paths pass that accessor to initializeAgent, restoring the existing Write/Edit permission denial. Requests clear independently, so rejecting a second concurrent question cannot release the first question’s guard.

Regression coverage checks the actual harness initialization callback and permission predicate for answer, cancellation, rejection, timeout, overlapping requests, and absent answerer. Typecheck and scoped lint pass; full build/test passes 189 files / 3,150 tests.

Production change is 11 added lines across two files. The PR remains draft. The completed Pi/orchestrator live snapshot evidence is above; an explicit Anthropic/Sonnet linear run is underway.

stale 5: completed live verification and earlier CI status

Original update: 2026-09-21T23:15:36Z.

Final verification on dbfbfff6: GitHub Build & Test is green, and both signed commits are verified.

Live gateway run Result TUI frames
Pi / orchestrator 7/7 required steps completed, 1 skipped 26
Anthropic / linear / claude-sonnet-5 9/9 completed 35

Both runs exited 0, reached runPhase=completed, and had no unanswered asks. Both generated apps passed separate CRUD/error-response checks and real SDK event delivery to a local test receiver. Fresh fixture copies, existing key/token files, project 228144 (US); no gateway token minting.

The initial Anthropic attempt inherited an incompatible OpenAI model from the feature-flag binding; its gateway rejection is preserved. The successful rerun explicitly selected Sonnet. The recorder’s first-outro snapshot freezes skillsComplete=false; later terminal frames capture the follow-up flow. MCP/keep-skills follow-up choices are simulated store actions.

The Anthropic live run includes the pending-question fix; deterministic regressions cover the question/write race because this fixture needed no questions. Complete evidence index: workbench/wizard-functional-evidence/a1-live-ci-review.md, with galleries, PNGs, redacted logs, app diffs, and runtime checks. No further source changes since dbfbfff6.

stale 6: question-wait behavior confirmed and regression-tested

Original update: 2026-09-21T23:41:22Z.

Confirmed existing question-wait behavior against the pre-refactor implementation. No additional production change was needed: the asking agent awaits its answer, independent orchestrator tasks may continue, and disabled questions do not block. Existing timeout behavior is preserved.

Added regression coverage in d214216 for delayed answers across both sequence arms and harness bindings, plus disabled questions. These standalone runner tests use the real sequences and ask bridge with a fake harness. The existing harness/tool permission tests also pass.

Validation: 195 tests across five focused files passed, plus typecheck, scoped ESLint, and Prettier. This follow-up changes only tests. The PR remains draft.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
Keep the diagram as native Mermaid in the PR description.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
@gewenyu99

Copy link
Copy Markdown
Collaborator Author

/wizard-ci basic-integration/next-js

@wizard-ci-bot

wizard-ci-bot Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

🧙 Wizard CI Results

Trigger ID: b6c5097
Workflow: View run

App Confidence PR YARA
basic-integration/next-js/15-app-router-saas 5/5 #4073 (logs) ✓
basic-integration/next-js/15-app-router-todo 5/5 #4071 (logs) ✓
basic-integration/next-js/15-pages-router-saas 5/5 #4074 (logs) ✓
basic-integration/next-js/15-pages-router-todo 5/5 #4072 (logs) ✓

Configuration

Setting Value
Wizard ref posthog/functional-a1-min
Context Mill ref main
PostHog ref master

Search for trigger ID b6c5097 in wizard-workbench PRs.

@gewenyu99

Copy link
Copy Markdown
Collaborator Author

/wizard-ci ai-observability

@wizard-ci-bot

wizard-ci-bot Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

🧙 Wizard CI Results

Trigger ID: 69eeefc
Workflow: View run

App Confidence PR YARA
ai-observability/anthropic/node-weather 3/5 #4079 (logs) ✓
ai-observability/anthropic/python-weather 5/5 #4076 (logs) ✓
ai-observability/google-adk/node-weather 5/5 #4077 (logs) ✓
ai-observability/groq/node-chat 4/5 #4078 (logs) ✓
ai-observability/manual-capture/node-http-chat 5/5 #4075 (logs) ✓
ai-observability/openai-agents/python-travel-triage 5/5 #4080 (logs) ✓
ai-observability/openai/node-weather 4/5 #4081 (logs) ✓
ai-observability/openai/python-docs-rag N/A Failed (logs) ✓
ai-observability/openai/python-weather N/A Failed (logs) ✓
ai-observability/opentelemetry/go-weather N/A Failed (logs) ✓
ai-observability/vercel-ai/nextjs-support-chat 4/5 #4082 (logs) ✓

Configuration

Setting Value
Wizard ref posthog/functional-a1-min
Context Mill ref main
PostHog ref master

Search for trigger ID 69eeefc in wizard-workbench PRs.

@gewenyu99

Copy link
Copy Markdown
Collaborator Author

☝️ those actually passed but GitHub hella flaky

@gewenyu99
gewenyu99 added this pull request to stack #1304 September 22, 2026 19:57
await Promise.race(running.values());
} finally {
// No queue or skill cleanup may run while a sibling still uses them.
await Promise.allSettled(running.values());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to cancel sibling tasks when the first RunTaskFatal is recorded

robot says we can be waiting up to 20min if a task like wizard_ask is still running. we should call interaction.cancelAsk?.() or create a util cancelAll() function that clears stuff before Promise.allSettled

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in #1303: the first fatal now calls onFatal, which aborts the run controller so running task sessions and open asks cancel before the drain joins them:

.catch((error: unknown) => {
if (!failure) {
failure = { error };
try {
opts.onFatal?.();
} catch (abortError) {
try {
logToFile(
'[executor] fatal cancellation failed:',
abortError,
);
} catch {
// Reporting cancellation failure cannot replace the fatal.
}
}
}
})

Brings in the eight main fixes since beccc79 (#1275, #1280, #1284, #1294,
#1295, #1301, #1302, #1305). One conflict: agentic detection keeps main's
two-attempt retry loop from #1305 and adds A1's progress emitter to the
agent it initializes.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
…hutdown to the host

`AgentInteraction.ask` and `taskNotice` now take `{ signal }`, as §4.3 of the
plan specifies. The ask bridge and the seeded-task offer each own one
AbortController per request, and a timeout aborts only that request.
`cancelAsk` and `cancelTaskNotice` are gone. The host adapter dismisses the
overlay when the signal aborts, catches and logs anything the dismissal
throws, and detaches once the request settles.

The agent no longer calls `analytics.shutdown('success')`. The legacy
adapter, the only `runAgent` caller at this layer, sends it after a
non-composed run succeeds. Failure and abort still shut down through
wizardAbort. A long-lived host can now decide when terminal analytics go
out, instead of the first run deciding for it.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
…ush fails

After a non-composed success the legacy adapter awaits
analytics.shutdown('success'). posthog-core can reject that on its flush
timeout, and the rejection turned a finished run into a TUI error outro and
exit 1, or into a headless wizardAbort. The adapter now logs the failure and
moves on. There is still exactly one terminal shutdown, because the first
status latches.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
Brings in #1235 and the 2.77.0 release. One conflict: the seed prompt keeps
A1's emitter and takes main's excluded-types note. #1235's orchestrator code
read the session and ProgramConfig, which the agent no longer sees, so the
program's excludedTaskTypes mapping now arrives on RunConfig, and the drained
queue's outcomes go back through a recordTaskOutcomes hook that the legacy
adapter writes to frameworkContext for the e2e harness.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
Brings in #1319. No conflicts.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
@gewenyu99
gewenyu99 marked this pull request as ready for review September 23, 2026 21:15
@gewenyu99
gewenyu99 merged commit cef3b99 into main Sep 23, 2026
18 checks passed
@gewenyu99
gewenyu99 deleted the posthog/functional-a1-min branch September 23, 2026 21:21
gewenyu99 added a commit that referenced this pull request Sep 24, 2026
Release A landed on main as squash commits (#1293, #1297, #1299, #1303).
B1 already carries that content through the A3 branch, so the merge
keeps B1's tree and adds #1334, the one change main has beyond A3, with
B1 import paths.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants