Skip to content

feat(sdk)!: expose native worker spawn attempts separately - #2679

Open
mldangelo-oai wants to merge 13 commits into
mainfrom
sdk/native-worker-spawn-observer
Open

mldangelo-oai wants to merge 13 commits into
mainfrom
sdk/native-worker-spawn-observer

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Expose native worker spawn attempts through a separate SDK observer. This is a parallel proposal to #2607. The reliable file-review timing signal requested in #956 remains open. Callers can continue to use onWorkerEvent to observe persisted worker sessions.

Changes

  • Add the opt-in onWorkerSpawn callback and export ScanWorkerSpawnEvent. Dispatch and subsequent failure share an attempt number; a completed call can supply the first notification when its start was missed.
  • Use one per-scan map to number attempts and suppress duplicate notifications. Observer exceptions and pending promises follow the existing nonblocking observer behavior.
  • Keep the observed-session ScanWorkerEvent interface, and document both callbacks in the SDK guide and package-consumer fixture. Maintainers can use the updated example on the published SDK callback guide.

Testing

Current head 4c614a43 merges current main. Relative to tested head 172024f5, only two upstream workflow installer pins changed. The product source, package inputs and dependency manifests are unchanged. The affected actionlint and zizmor checks passed on the new head; unchanged example-workflow and shell-script checks retain their earlier results with identical inputs and tools.

Validation previously run on 172024f5 used pnpm 11.25.0, Bun 1.4.4 and Node 22.13.0:

  • SDK build:ci and build:plugin passed. Canonical test:mcp passed: 2,004 passed, 38 skipped, zero failures.
  • Focused worker-progress and API-event tests passed: 55 tests.
  • The full SDK run with seed 12345, followed by types, format and the default-order test:ci run, passed. Each full run reported 13,267 passed, 176 skipped, one todo and zero failures across 345 files. The default run used seed 781026880 and produced JUnit and coverage reports.
  • pnpm pack and the two-argument package-content check passed for all 1,249 archive files. The one-argument installed-package checks passed on Linux with Node 22.13.0, 24.0.0, 24.22.3, 26.0.0 and 26.13.1; Node 22.13.0 also exercised Deep Scan retry.
  • CI-selection/source/release contracts, release-progress tests and MCP formatting passed.

These results are reused after comparing the consumed source, tools, dependencies and retained reports. They were not rerun for the main-branch merge. Source CI on 172024f5 also passed, including the Linux, macOS and Windows installed-package consumers and production audit. Its consumed merge 4c1eb9f9 has the same source tree as 172024f5.

The local audit:prod attempt returned HTTP 405 from the configured registry; that failure remains separate from the successful hosted audit. No registry configuration was changed. Hosted checks and audit for the new head remain required after publication.

Historical acceptance on a2c58356 used Codex 0.167.1 and a synthetic loopback provider. It covered native v1 dispatch and rejection, v2 parent-stream silence, hook denial, observer isolation, concurrent scans and the post-scan boundary; missing-start and duplicate-item coverage used replay. This was an earlier runtime acceptance run. The current dependency is Codex 0.171.0.

Earlier source CI consumed merge commit 36425c03, whose source tree equals e229aa1f. The initial Windows shard 3 job passed its main shard and then failed a separate UNC-path check at its timeout. Attempt 2 reran that job and the aggregate successfully. Other jobs retain their attempt 1 results. The later 172024f5 CI run passed the same UNC-path check.

Risk and rollout

Delivery is best effort. A v1 attempt can fail, and v2 can accept or reject a child without emitting the parent-stream item. The callback cannot confirm that file review started or veto dispatch. A phase-qualified signal that file review has started, with bounded delivery or ordering, remains open in #956.

This is a breaking type-level change for consumers that exhaustively switch on onObserverError source names: onWorkerSpawn is now a possible source. Existing worker-session callback payloads remain unchanged. No public CLI surface changes.

Public disclosure review

The available logs, artifacts and service outputs were inspected. One replaced Windows report and 24 original Code Quality SARIF outputs were unavailable, so their contents are not claimed reviewed. The separately available Code Scanning exports were inspected.

  • No customer, partner, prospect, or user identities, data, or identifying details are included.
  • No credentials, personal data, private source, scan findings, or nonpublic links or tickets are included.
  • I reviewed the branch name, title, description, commits, changes, comments, logs, screenshots, attachments, and links for public disclosure.

Build on the spawn observer in #2607. Preserve the observed-session callback, and parse native parent spawn items only when an SDK caller opts in.

BREAKING CHANGE: exhaustive onObserverError name handlers must handle onWorkerSpawn.

Co-authored-by: Aditya-linux <[email protected]>
@github-actions github-actions Bot added the breaking-change Breaking change called out in generated release notes label Nov 15, 2026
@mldangelo-oai
mldangelo-oai marked this pull request as ready for review November 15, 2026 15:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T00:19:07.598621Z 4c614a4 New commits
🔒 Security Review ✅ Completed 2026-11-23T00:19:28.196204Z 4c614a4 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change Breaking change called out in generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant