Repository navigation
Conversation
Consolidates the three agent-IO paths the handoff used to run separately (write-file, notebooks-create via MCP, and the passive file-watcher) into a single deterministic `publish_handoff` wizard tool. One call writes the report file, mirrors it into a shareable PostHog notebook via direct HTTP (no MCP round-trip, no JSON-encoding the agent has to get right), and sets the captured text on the store so the task-stream push carries handoff_text — the upload part #1045 introduced. The tool is registered into the wizard-tools server (and the pi facade) only when the runner supplies a handoff context (report path + store hooks), mirroring how the orchestrator queue context is threaded. The passive HandoffWatcher stays as a fallback (TODO: remove once all programs use the tool). Coordinated with PostHog/context-mill, which rewrites the integration-v2 report/notebook step descriptions to call publish_handoff. Generated-By: PostHog Code Task-Id: 42ae71e9-0c89-4553-97a6-53c62e784fbb
🧙 Wizard CIRun 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:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A run's handoff is produced across three separate agent-IO paths today: the agent
Writes the report file, the agent callsnotebooks-createvia MCP (hand-encoding a multi-page report as ProseMirror JSON, with several failure modes the skill spends paragraphs warning about), and a passiveHandoffWatcherreads the file back into the store so the task-stream push carrieshandoff_text. Three paths means three chances to drift, and three rounds of slow agent IO.Stacks on #1045, which introduced the
handoff_textupload to the PostHog session.Changes
publish_handoffwizard tool (src/lib/wizard-tools/handoff.ts) that in one deterministic, host-side call: atomically writes the report file, mirrors it into a shareable PostHog notebook via direct HTTP (using the run's already-provisionednotebook:writescope — no MCP round-trip), and sets the captured text on the store so the task-stream push carrieshandoff_text(the upload part feat(task-stream): publish the setup report as the session handoff doc #1045 introduced).HandoffToolsContextis built by the runners (which own theWizardStore+TaskStreamPush+ the program'sreportFile) and threaded throughrunAgent→ the sequence runner → the harness inputs, mirroring how the orchestrator context is threaded.HandoffWatcherfrom feat(task-stream): publish the setup report as the session handoff doc #1045 stays as a fallback with aTODO(remove)note; once every program's skill content callspublish_handoff, it (and the force-read inTaskStreamPush.shutdown) can be deleted.Coordinated with PostHog/context-mill: the integration-v2
reportstep now callspublish_handoffwith the full report markdown, and thenotebookstep becomes a no-op confirmation (the tool already created the notebook).Test plan
npx vitest run src/lib/wizard-tools/__tests__/handoff.test.ts— 12 new tests covering: blank-content rejection, oversize cap, notebook content shape, URL building, path-traversal rejection, file write + store hooks + notebook URL on success, blank rejection writes nothing, missing credentials still writes file + sets handoff_text (notebook skipped), notebook-upload failure still writes file + sets handoff_text, and the runnerbuildHandoffContextfactory. Existingtask-stream,wizard-tools,agent-interface, and orchestratorqueue-toolssuites still green (112 + 79 tests).pnpm typecheckintroduces zero new errors vs. the #1045 base.Created with PostHog Code