Repository navigation
refactor(agent): WIP publish the agent through entry modules #1303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gewenyu99
merged 17 commits into
workbench/wizard-functional-a2b
from
posthog/functional-a3-entries
Sep 23, 2026
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
580c506
refactor(shared): move the skill menu out of the agent
gewenyu99 6484ce1
build(agent): publish the agent through entry modules
gewenyu99 9f0d4c4
refactor(shared): stop shared code from reaching upward
gewenyu99 49614fb
docs: describe the agent and shared surfaces
gewenyu99 67ece68
docs(agent): name what stays in the entry modules and what leaves
gewenyu99 3e2f1be
docs(agent): skill install leaves with Release B, not a separate stage
gewenyu99 c620d09
docs(agent): group the entry exports by when they leave
gewenyu99 889af71
test(agent): cover public prompt streaming entry
gewenyu99 2aee250
fix(agent): propagate terminal failures and cancel sibling work
gewenyu99 1443587
test(agent): probe terminal SDK fault propagation
gewenyu99 da08b1c
Merge workbench/wizard-functional-a2b into posthog/functional-a3-entries
gewenyu99 62c4387
fix(agent): label decided failures as errors and cancel open asks whe…
gewenyu99 200961f
Merge workbench/wizard-functional-a2b into posthog/functional-a3-entries
gewenyu99 f4b3417
Merge workbench/wizard-functional-a2b into posthog/functional-a3-entries
gewenyu99 38f57e8
fix(agent): report the scan summary when a run is cancelled before it…
gewenyu99 9eb5375
Merge workbench/wizard-functional-a2b into posthog/functional-a3-entries
gewenyu99 bfe4c8e
Merge workbench/wizard-functional-a2b into posthog/functional-a3-entries
gewenyu99 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| import type { RunConfig, RunInput } from '@agent/runner'; | ||
|
|
||
| const gatewayUrl = process.env.WIZARD_FAULT_GATEWAY_URL; | ||
| const installDir = process.env.WIZARD_FAULT_INSTALL_DIR; | ||
| const harness = process.env.WIZARD_FAULT_HARNESS; | ||
| if ( | ||
| !gatewayUrl || | ||
| !installDir || | ||
| !['anthropic', 'pi'].includes(harness ?? '') | ||
| ) { | ||
| throw new Error( | ||
| 'Expected WIZARD_FAULT_GATEWAY_URL, WIZARD_FAULT_INSTALL_DIR, and WIZARD_FAULT_HARNESS', | ||
| ); | ||
| } | ||
|
|
||
| const routedFetch = globalThis.fetch; | ||
| globalThis.fetch = (input, init) => { | ||
| const url = new URL(input instanceof Request ? input.url : String(input)); | ||
| if (url.hostname === 'internal-j.posthog.com') { | ||
| return Promise.resolve(new Response('{"status":1}', { status: 200 })); | ||
| } | ||
| if (url.hostname !== '127.0.0.1' && url.hostname !== 'localhost') { | ||
| return Promise.reject( | ||
| new Error('Fault probe blocked a non-loopback fetch'), | ||
| ); | ||
| } | ||
| return routedFetch(input, init); | ||
| }; | ||
|
|
||
| const { runAgent } = await import('@agent/runner'); | ||
| const { configureGatewayCredentialsForCI } = await import( | ||
| '@agent/gateway-session' | ||
| ); | ||
| const { DEFAULT_AGENT_MODEL, Harness, Sequence } = await import( | ||
| '@shared/constants' | ||
| ); | ||
| const { HostResolution } = await import('@shared/host-resolution'); | ||
| const { analytics } = await import('@utils/analytics'); | ||
|
|
||
| // This probe has no telemetry sink and uses only synthetic local credentials. | ||
| analytics.capture = () => {}; | ||
| analytics.captureException = () => {}; | ||
| analytics.wizardCapture = () => {}; | ||
| analytics.shutdown = async () => {}; | ||
|
|
||
| configureGatewayCredentialsForCI( | ||
| 'phe_synthetic_fault_probe', | ||
| 228144, | ||
| gatewayUrl, | ||
| ); | ||
|
|
||
| const config: RunConfig = { | ||
| programId: 'fault-probe', | ||
| run: { | ||
| integrationLabel: 'Fault probe', | ||
| spinnerMessage: 'Running fault probe', | ||
| successMessage: 'Fault probe completed', | ||
| estimatedDurationMinutes: 1, | ||
| reportFile: 'fault-probe.md', | ||
| docsUrl: 'https://posthog.com/docs', | ||
| customPrompt: () => 'Answer briefly without using tools.', | ||
| }, | ||
| composed: false, | ||
| binding: { | ||
| sequence: Sequence.linear, | ||
| harness: harness as Harness, | ||
| model: DEFAULT_AGENT_MODEL, | ||
| }, | ||
| switchboard: { | ||
| program: 'fault-probe', | ||
| flags: {}, | ||
| cliHarness: harness as Harness, | ||
| }, | ||
| skillsBaseUrl: 'http://127.0.0.1:1', | ||
| wizardFlags: {}, | ||
| wizardFlagPayloads: {}, | ||
| wizardMetadata: { run_id: 'fault-probe' }, | ||
| }; | ||
|
|
||
| const input: RunInput = { | ||
| installDir, | ||
| credentials: { | ||
| accessToken: 'phx_synthetic_fault_probe', | ||
| projectApiKey: 'phc_synthetic_fault_probe', | ||
| host: HostResolution.fromApiHost('http://127.0.0.1:1', { localMcp: true }), | ||
| projectId: 228144, | ||
| }, | ||
| project: null, | ||
| apiUser: null, | ||
| flags: { | ||
| ci: true, | ||
| signup: false, | ||
| debug: false, | ||
| e2eAsk: false, | ||
| localMcp: true, | ||
| captureAio: false, | ||
| benchmark: false, | ||
| yaraReport: false, | ||
| }, | ||
| host: { projectId: 228144, region: 'us' }, | ||
| }; | ||
|
|
||
| const result = await runAgent(config, input); | ||
| process.stdout.write( | ||
| `WIZARD_FAULT_RESULT ${JSON.stringify({ | ||
| harness, | ||
| outcome: result.outcome, | ||
| code: result.failure?.code, | ||
| message: result.failure?.message, | ||
| hasError: result.failure?.error instanceof Error, | ||
| outroKind: result.outro?.kind, | ||
| })}\n`, | ||
| ); | ||
| if (result.outcome === 'failed' || result.outcome === 'aborted') { | ||
| const { wizardAbort } = await import('@utils/wizard-abort'); | ||
| await wizardAbort(result.failure); | ||
| } else { | ||
| process.exitCode = 2; | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the potential issue: The known entry shortcut lets shared and environment code bypass their runtime import restrictions.
shared helper imports runAgent from @agent -> checks pass -> forbidden upward dependency goes unflaggedSuggested fix: Address caller restrictions and regression cases in planned C2's boundary-enforcement pass. This is an accepted follow-up, not a blocker for A3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C2d replaces this checker with per-layer TypeScript configs, and at the C3 head
skill-map.tsno longer imports the agent:wizard/src/shared/errors/skill-map.ts
Line 2 in 548ef5f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disregarding this one with no change, since the checker is only a sanity ledger and C2d replaces it with compiler-enforced layer configs, where
src/sharedcan resolve only@env,@sharedand@utils:wizard/src/shared/tsconfig.layer.json
Lines 7 to 16 in 548ef5f