Skip to content

feat(wizard-program): headless runProgram and runAgent harness - #4190

Draft
gewenyu99 wants to merge 5 commits into
mainfrom
posthog/wizard-harness
Draft

gewenyu99 wants to merge 5 commits into
mainfrom
posthog/wizard-harness

Conversation

@gewenyu99

@gewenyu99 gewenyu99 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The wizard carried its own headless harness for running one program through runProgram, or one agent through runAgent. The workbench owns the fixture apps and the assertions, so the harness belongs here, importing the callable API from a wizard checkout.

Change

  • services/wizard-program/ runs one program (pnpm wizard-program) or one agent on a local quack skill (pnpm wizard-agent) against the wizard checkout in WIZARD_REPO.
  • The scripts start tsx with --tsconfig "$WIZARD_REPO/tsconfig.json", so the wizard's path aliases (@programs, @agent, @shared/*) resolve against that checkout. Each alias must resolve inside WIZARD_REPO, and each module must export the names the route calls.
  • --check loads every module a run needs, prints where each one resolved, and exits before it reads credentials or makes a request.
  • harness.test.ts pins the shared env contract and runs in Checks.
  • A README section, Headless wizard runs.

PostHog/wizard#1308 removes the wizard-side routes.

Checks

  • tsc --noEmit passes.
  • pnpm test:wizard-program: 6 of 6 pass.
  • pnpm wizard-program --check and pnpm wizard-agent --check against refactor(programs): B4 runner context — programs stop calling getUI() wizard#1357 at cbbe9fa2, whose runProgram takes a run host and whose runAgent mints its own gateway token, under a preload that makes any TCP connection, DNS lookup or fetch throw: both exit 0 with nothing blocked. A control fetch under the same preload was blocked.
  • No live run. Nothing ran against PostHog or a gateway.

Created with PostHog Desktop

Run one wizard program through runProgram, or one agent through runAgent,
against the wizard checkout in WIZARD_REPO. The package scripts start tsx
with the checkout's tsconfig, so the wizard's path aliases resolve there.
--check loads the modules a run needs and exits before any env read or
request.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
runProgram is now host-only: it takes the run definition in input.run and
the program-level settings in input.program, and drops integration
effects and framework config. The program route builds both from the
program's ProgramConfig, as the wizard's legacy adapter does: it calls
run(session) on a session from buildSession, after it installs the
headless UI that --ci installs. posthog-integration still detects its
framework here, now onto the session that run(session) reads.

Generated-By: PostHog Desktop
Task-Id: d14e92bb-6ee1-49b5-8502-39cb80079589
The program route builds a ProgramRunHost from the headless UI, the way
the wizard's legacy adapter does, and passes it to the program's run. Its
program settings drop the audit and event-plan fields runProgram no longer
takes.

The agent route binds its run the way agentic detection does, with a
switchboard context, and passes no inference auth. The runner mints its
own gateway token from the personal key, so the harness no longer reads
WIZARD_CI_GATEWAY_TOKEN_FILE or loads @shared/ci-gateway-auth.

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

The agent route minted its gateway token under e2e-agent, an id the
gateway may refuse. Agentic detection passes its caller's real program
id, so the route now defaults to posthog-integration. PROGRAM overrides
it, as it does for the program route.

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.

1 participant