-
Notifications
You must be signed in to change notification settings - Fork 2
feat(pi): publish observed harness state from the injected extension #323
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
schickling-assistant
merged 8 commits into
schickling/hs-04-roster
from
schickling/hs-05-pi
Aug 24, 2026
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3fa0adf
feat(pi): produce observed harness state from pi's own turn events
schickling 6ae9741
fix(pi): settle-edge idle, terminal-record precedence, and runtime-id…
schickling 6a5639a
fix(pi): a fresh channel is a new session
schickling 55f7d56
fix(pi): fail-open channel stdin and a wrapper-minted session token
schickling fafa411
fix(pi): stash every channel variable and export the ownership claim
schickling 1f34a89
fix(pi): written ownership claim, and the successor channel waits out…
schickling 82eb391
fix(pi): hoist the exit-await above its use, and smoke-execute the sh…
schickling e0d4676
fix(pi): post-claim launch failures end the record honestly
schickling 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // Runtime smoke of the shipped pi extension: drives the channel-open path far enough that a | ||
| // use-before-declaration (TDZ), a broken import, or a top-level throw fails the check — the | ||
| // classes a type-only gate is provably blind to. The channel binary is `true`, so the open | ||
| // times out its hello and resolves empty; any thrown error fails the smoke. | ||
| import assert from "node:assert"; | ||
|
|
||
| process.env.ST2_PI_CHANNEL_BIN = process.env.SMOKE_TRUE_BIN ?? "/bin/true"; | ||
| process.env.ST2_PI_CHANNEL_CATALOG = "/tmp/st2-smoke-catalog"; | ||
| process.env.ST2_PI_CHANNEL_IDENTITY = "smoke.worker"; | ||
| process.env.ST2_PI_CHANNEL_RUNTIME_ID = "smoke.worker"; | ||
| process.env.ST2_PI_CHANNEL_SESSION = "smoke-session"; | ||
| process.env.ST2_PI_CHANNEL_SEQ = "1"; | ||
|
|
||
| const mod = await import("./smoke-out/pi-channel.mjs"); | ||
| assert.strictEqual(typeof mod.default, "function", "extension exports its entry point"); | ||
|
|
||
| const handlers = new Map(); | ||
| const pi = { | ||
| on: (name, handler) => handlers.set(name, handler), | ||
| }; | ||
| mod.default(pi); | ||
| for (const name of ["session_start", "session_shutdown", "agent_start", "agent_settled"]) { | ||
| assert.ok(handlers.has(name), `extension registers ${name}`); | ||
| } | ||
|
|
||
| const ctx = { | ||
| isIdle: () => true, | ||
| ui: { notify: () => {} }, | ||
| }; | ||
| // Two session starts in a row: the second exercises the predecessor close-and-await path — the | ||
| // exact region the TDZ regression lived in. | ||
| await handlers.get("session_start")({}, ctx); | ||
| await handlers.get("session_start")({}, ctx); | ||
| await handlers.get("agent_start")({}, ctx); | ||
| await handlers.get("agent_settled")({}, ctx); | ||
| await handlers.get("session_shutdown")({ reason: "smoke" }, ctx); | ||
| console.log("pi extension smoke: ok"); | ||
| process.exit(0); |
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.
Uh oh!
There was an error while loading. Please reload this page.