fix(sdk): report observed worker sessions without status markers - #962
mldangelo-oai wants to merge 6 commits into
Conversation
Add a bounded onWorkerEvent observer with shared scan-local worker numbers and dispatch deduplication. Keep marker-derived phase status compatible and document its best-effort delivery. Requires the corresponding Codex runtime event release before shipping.
|
@codex review Please review head |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
Worker dispatch status depends on assistant text markers, so SDK callers can miss successful delegation. Add
onWorkerEventto report persisted worker sessions discovered by the existing SDK session tracker, independently of model text. This works with the currently bundled Codex 0.154.0 and requires no runtime changes or dependency updates.Refs #956. This provides session observation; phase counts, failed-dispatch reporting, and a pre-review control gate remain outside this callback's contract.
Changes
ScanWorkerEventand addScanOptions.onWorkerEvent, emitting only{ kind: "observed", worker: number }once per discovered session per run.onObserverErrorwithout stopping the scan.onWorkerStatusbehavior and explicitly document its dispatch variant as best-effort model reporting. No public CLI changes.Testing
2454836527): 3,083 passed, 57 skipped, zero failures. Seed12345also passed (3,082 passed, 57 skipped) before adding the final cancelled-follow-up case.DiffTarget.refsscan created two real delegated sessions and delivered both observations before the mock model was allowed to complete. Verified matching session worker numbers, absent status markers, non-fatal throwing observers, sealed complete artifacts, and no observation for a capacity failure that created no session.The integration uses a localhost mock model, synthetic credentials, and a harmless temporary repository. Local execution coverage is macOS arm64; Linux and Windows remain CI coverage.
Risk and rollout
This is an optional SDK observer backed by the same session discovery used for cost tracking. It is compatible with the existing dependency pins. Saved workers can be reported again on resume, and missing notifications do not establish that delegation was skipped. The event does not mean a worker just started or file review has begun, does not report failed spawn attempts or planned counts, and cannot gate dispatch. Observation ends before
postScanPrompt;maxCostUsdandAbortSignalremain the cost/cancellation controls.Public disclosure review