Repository navigation
fix(telemetry): preserve usage coverage and operation outcomes - #1841
Conversation
alandelong-oai
left a comment
There was a problem hiding this comment.
Reviewed cfcc8b6ebc97 against the pinned base across all 98 changed files, including API/CLI lifecycle, native consent and protected worker receipts, compressed session collection, completeness propagation, publication, embeddings, tests and documentation. Two issues need attention: native Zstandard readers can drop valid later frames while marking usage complete, and new parameterized tests emit duplicate JUnit identities that fail the repository report comparator. Details and controls are inline.
Validation: ordered portable checks, plugin/SDK builds, SDK/MCP types, generated contracts and changed-file formatting passed. Focused runs passed 443 SDK cost/publication cases, 37 API/CLI cases, 109 Python cases and 21 MCP cases; seven targeted coordinator scenarios and eight workbench transport cases also passed. The broader runs also had 220 SDK, 47 API/CLI, 78 Python and three MCP failures, including established ownership/Git-fixture restrictions; they are not counted as passing suites. The decoder and JUnit findings were reproduced independently with passing controls. Native Windows/macOS, live model/hosted execution and a complete integration matrix were not run.
alandelong-oai
left a comment
There was a problem hiding this comment.
Owner-level merge-safety re-review of e17472650193 against dd42caa7a22aa. The merge integration preserves the intended behavior, but three material issues still need attention:
- The built npm tarball fails the package validator because the new telemetry deliverables are missing from its exact allowlists; new finding inline.
- The existing Zstandard completeness finding still reproduces in both collectors: valid concatenated frames lose later usage while reporting complete coverage, and truncated tails are accepted.
- The existing duplicate JUnit identity finding still reproduces with the current Linux test-quality runner. The four tests pass, but report comparison rejects their duplicate names.
Current-head validation: frozen dependency installs, ordered portable checks, SDK/plugin builds, types, and formatting passed. Separate focused runs passed 132 cost cases, 167 portable SDK cases, 40 Python cases, 27 MCP cases, and two portable executor groups; seven coordinator scenarios and 13 journal assertions also passed. The broader SDK runs had 220 and 222 failures, and the API/CLI/lifecycle run had 93 passes and 33 failures, including output-ancestry and Git-fixture restrictions; those suites are not counted as passing. Both decoder defects were reproduced with single-frame/fallback controls. pnpm pack succeeded, then the actual package validator failed as described inline. Windows/macOS, live hosted/model execution, and a complete green integration matrix were not verified.
alandelong-oai
left a comment
There was a problem hiding this comment.
Thanks for the updates. The earlier Zstandard frame/truncation, JUnit identity, and package inventory findings are addressed. The telemetry paths retain known usage across failures and cancellation while keeping incomplete coverage explicit and native consent/exporter ownership intact.
Owner-level merge-safety review: no new blocking findings. Builds, type/format/source checks, focused SDK/Python/MCP tests (including 181 cases on CI-pinned Bun 1.3.14), Node 24 reader checks, the pinned JUnit comparison, and the actual npm inventory passed. Full suites and installed-package smoke remain limited by the existing sandbox ownership/repository fixtures.
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. |
There was a problem hiding this comment.
💡 Codex Review
codex-security/sdk/typescript/src/cost.ts
Lines 476 to 478 in 822ad17
When a worker receipt explicitly reports cache_write_input_tokens: 0 and an equal-total native rollout omits that field, this condition replaces the known receipt solely because its numeric value is zero. The replacement carries cache_write_input_tokens_reported: false, turning a measured zero into an unknown value and unnecessarily widening the saved cost estimate. Only treat the receipt as defaulted when its cache_write_input_tokens_reported flag is actually false.
ℹ️ 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".
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".
alandelong-oai
left a comment
There was a problem hiding this comment.
Owner-level merge-safety re-review of 822ad171cb74: two existing findings remain material:
- Publication cancellation: once a dispatched mutation has an indeterminate outcome, aborting must preserve that uncertainty in telemetry. The same precedence appears in the Linear wrapper.
- Explicitly measured zero cache writes: confirmed on the new native worker-receipt path. An equal-total rollout without cache-write data replaces a known zero with unknown usage and widens the estimate. Preserve the worker receipt's provenance while retaining the existing fallback for SDK-defaulted zeroes.
The earlier frame/truncation, JUnit identity, and package-inventory findings remain addressed. Current validation includes the ordered portable checks, SDK/plugin builds, types/formatting, 219 SDK cases, 113 Python cases, four persisted reconciliation probes, and the fresh 707-entry package inventory. Targeted API/CLI/completion tests remain limited by existing sandbox ownership fixtures; full suites, installed-package smoke, Windows/macOS, and live services were not verified. The decompression probe confirmed backpressure between compressed chunks; it did not establish the newly reported unbounded-input failure.
zcrab-oai
left a comment
There was a problem hiding this comment.
Owner-level merge-safety review of 822ad171cb7464354b8f9e3d4ee0eb760466e546 across all 104 changed files. Three new P2 findings are inline: session-event replay can lose already-read usage, and two existing integration fixtures were missed by the contract changes. Existing findings are not duplicated.
Validation: Ruff lint/format, SDK/plugin builds, SDK/MCP types, formatting, and package inventory passed. The source-check tests passed 9/9 after suppressing an environment-injected Node warning; the original run had four stderr-comparison failures. The real Node compressed-log check confirmed the usage loss with passing intact-file and observer-disabled controls.
Broader local runs were not green: accounting/publication 439 passed, 25 failed; API/CLI 167 passed, 192 failed; Python 116 passed, 132 failed, two skipped; MCP 29 passed, two failed. Filesystem ancestry and Git fixture restrictions blocked substantial integration coverage, including installed-package smoke. The fresh tarball contains 707 entries and 152 plugin files. No protections were relaxed. Full local integration validation and approval remain pending.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88945f2707
ℹ️ 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".
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".
# Conflicts: # plugins/codex-security/mcp-app/src/deep-scan/worker-runner.ts # sdk/typescript/tests-ts/cli-skill-native-config.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3861acd8ab
ℹ️ 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".
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".
|
Codex Review: Didn't find any major issues. Another round soon, please! 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". |
alandelong-oai
left a comment
There was a problem hiding this comment.
Thanks for the fixes. The archive and deadline controls passed on the preceding head, and the new acceptance failure/cancellation tests pass here. One remaining case is documented inline: a native failure followed by cancellation calls fail-scan but emits a canceled operation receipt; the cancellation-first control is correct.
Current builds, types, formatting, portable checks and three focused coordinator cases pass. The receipt reproducer covers emitted telemetry; local owner checks prevented journal persistence. No live-model or platform run is claimed.
# Conflicts: # plugins/codex-security/scripts/workbench_scan_usage.py # plugins/codex-security/tests/test_workbench_scan_usage.py # sdk/typescript/src/api.ts # sdk/typescript/src/cost.ts # sdk/typescript/tests-ts/api-usage.test.ts # sdk/typescript/tests-ts/api.test.ts
|
@codex review Please review the updated head 5adf638 against main, including the verified budget reader, worker finalization and native failure-versus-cancellation receipt. Local checks passed for 354 cost and compressed-usage cases, both real-emitter cancellation orderings, 10 usage-merge cases, both TypeScript projects, and the source compatibility checks. The hosted lifecycle fixture will verify the updated partial-usage assertion on its real Linux runner. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5adf638d88
ℹ️ 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".
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".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 535cf1f530
ℹ️ 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".
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".
|
Codex Review: Didn't find any major issues. What shall we delve into next? 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". |
alandelong-oai
left a comment
There was a problem hiding this comment.
Thanks for the fixes. Native failure precedence, startup cancellation and deadlines after child launch now retain the correct operation outcome. Eight focused launcher controls pass, as do current builds, type checks, formatting and portable checks.
The preceding integration passed 354 cost/compressed-log cases, 16 Python usage controls and both native-event orderings; those sources are unchanged here. Twelve completion/journal fixtures remain blocked by local trusted-owner checks. The launcher controls observe calls to the real telemetry emitter, not persisted receipts; no full platform run is claimed.
# Conflicts: # sdk/typescript/src/api.ts # sdk/typescript/src/cli.ts
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e99e154abc
ℹ️ 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".
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".
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
alandelong-oai
left a comment
There was a problem hiding this comment.
Thanks for the fix. Warning-only partial usage now retains its reason through terminal serialization. Eight paired SDK accounting/Python SQLite controls confirm that failure and cancellation update the stored outcome while preserving partial coverage. The current 25 cost/coverage cases, 2 measurement cases, builds, type checks, formatting and portable checks pass.
The preceding large-finding integration passed 11 focused cases; two SDK validation cases stopped at the local trusted-owner guard. Earlier broader results retain their original tested heads. The terminal controls use synthetic database rows; full scans and native permissions were not exercised.
Summary
Usage accounting could omit compressed worker logs and failed scans, turn missing cache-write measurements into zero, and leave consumers showing totals that were no longer complete. Stored-credential skill commands could also lose ambient analytics consent. This preserves the available measurements and consent settings, makes incomplete coverage explicit, and adds operation outcomes that support meaningful success and cost denominators.
Changes
onMeasurementupdates and partial/unavailable displays throughout component and bulk results, including transitions from previously complete totals. Preserve complete-onlyonUsageandonCostcallbacks and pricing uncertainty. Refresh headless partial subtotals and coverage-only recovery while coalescing paired complete CLI updates. Component scans preserve the caller's measurement callback alongside saved receipts and component events; either observer can fail without interrupting the scan.The release archive includes the four new runtime modules and the telemetry guide. Installed-package fixtures verify canceled outcomes for caller abort and client close, and the exact Deep worker permission profile protecting its scan-bound receipt store.
Testing
Merged
mainatfe9d77e1c3d9intoacddb8d627e2. This refresh changes only the Dockerfile's two Node image references. Every other tracked file is byte-identical tof67b37c37282.git diff --checkpassed; no runtime tests were rerun for this container-only merge. The source checks below remain attributed to their recorded pre-refresh heads; fresh hosted CI must qualify the new head.At
f67b37c37282, the combined component, validation, and patch-usage modules passed 94 tests (36,867 assertions, no failures). Six component controls cover caller-only and combined observers, synchronous throws and rejected promises from either observer, successful completion, and persisted measurements. Nine actual SDK subprocess controls cover valid/invalid responses, completion followed by unsuccessful child exit or cancellation, and missing/null usage. The new failures reproduce before the fixes and pass after them; original errors, canceled outcomes, partial native usage, and nonzero cache fields remain covered.SDK/MCP type checks, full SDK formatting, SDK build, and
git diff --checkpassed.The validation component at
130ad9c2a1dc9db2d2461e200ab6839d567971ffpassed 178 tests across validation, cost, and operation-telemetry modules before composition; its validation implementation/tests and the collector inputs are unchanged in the combined head. Main integration at80b4a2028269cd5781d1fb04738bebdd6f999f95includesmainat5f521759e7c6ff8c3fbd5e81fd1a3567ac801b59and passed 68 workflow/report, 30 native-configuration, and 6 package-smoke-timeout tests. These results remain attributed to their recorded heads.Local checks use Linux, Node 22.23.3, Bun 1.3.14, seed
12345, controlled umask022, and source-matched existing dependencies and plugin/native artifacts. Full seeded/default-order SDK completion and exact-head hosted CI remain pending. The superseded4a8956d8full seeded run was stopped after 1,605 observed passes, 24 skips, and no observed failures; it produced no terminal summary, and queued types/format/default-order phases did not start. Earlier superseded full runs and the unexplained Windows scan-history abort remain historical limitations. No fresh native build, installed-package smoke pass, or cross-platform pass is claimed.Two review dispositions remain open. Four existing tracker controls contradict the reported duplicate metadata event from compressed-only sessions, and their relevant source/dependency closure is unchanged here. An archive unreadable before its session identity is decoded cannot be proven unrelated: optional tracking reports the collection error, while a requested cost limit remains enforced. These callback and usage-handoff repairs change neither reader behavior.
Risk and rollout
SDK callbacks and receipt fields are additive; existing complete-only usage/cost callbacks retain their semantics. The public CLI gains no flags. Partial measurements are explicitly labeled, and unknown prices or remote mutation outcomes remain unknown. Truncated compressed streams are collection errors. Coverage describes discovered evidence from tracked scan threads; it cannot establish the absence of descendants whose native metadata is unavailable. Optional owner evidence recorded during the scan is part of its tracked session and budget; automatic owner reports add no model calls. Standalone owner suggestions, finding comparisons, and severity-review helpers are outside these scan/component subtotals.
Operation receipts are local to the state directory; this does not configure a remote collector. Scan publication uses existing receipts, and embedding observations are optional. Routine telemetry contains numeric accounting, bounded categories, and correlation IDs. Existing diagnostic text and native analytics/OTel controls are preserved.
Terminal usage remains a timestamped SDK snapshot; saved accounting may reconcile later native evidence without backfilling that receipt.
Authentication/bootstrap commands and stored-account CLI app-server startup use OTel configuration from their selected native home or existing explicit runtime configuration. They do not automatically copy ambient/profile exporters when stored authentication selects another home: the pinned helper commands cannot load a separate private profile. The change avoids copying inherited exporter headers into arguments or temporarily rewriting shared settings. Main scan and Deep Scan runtime configuration retain their existing OTel support.
The journal uses existing output-path protections. Policy and workflow failures before path validation remain observable through callbacks without creating journal files. Tests cover failed observers, asynchronous warning-stream failures, repeated/resumed observations, cached-result reuse, sealed artifact protection, and Git metadata path protection.
Public disclosure review