Skip to content

refactor(sdk): reuse runtime message and result handling - #1583

Merged
mldangelo-oai merged 11 commits into
mainfrom
mdangelo/codex/runtime-message-handling
Oct 13, 2026
Merged

mldangelo-oai merged 11 commits into
mainfrom
mdangelo/codex/runtime-message-handling

Conversation

@mldangelo-oai

@mldangelo-oai mldangelo-oai commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Reuse existing SDK helpers for messages, progress observers, result projections, and CLI rendering.

Changes

  • Share session parsing and derive private state from constructors.
  • Reuse result schemas, finding identity, and severity ordering while preserving synchronous observers, persistence formats, and diagnostics.
  • Integrate current main while retaining native compaction response accounting in the inferred session state.
  • Forward cancellation and publication metadata through the terminal-race test fixture so it exercises the current completion contract.

Testing

  • Focused SDK tests: 591 passed, one Windows-only skip, no failures across 10 files.
  • All 10 terminal-race orderings passed after the fixture correction.
  • SDK build, types, generated-source freshness, formatting, and all five portable plugin source checks passed.
  • Local tests used the CI-compatible toolchain and a universal native payload verified against the current native source and build inputs.
  • Full SDK package checks and fresh hosted CI are being completed for this revision; earlier full-suite results are not claimed for it.

Risk and rollout

The parent SDK result-type change is merged. CLI syntax, defaults, output formats, persisted formats, and public result shapes remain unchanged. Observer calls retain synchronous invocation, receiver binding, and error handling. Compaction accounting, cost enforcement, diagnostics, CSV identity, and publication storage are preserved. No migration is required. The cancellation fixture repair changes only test wiring.

Public disclosure review

Reviewed the source, synthetic fixtures, commit metadata, description, and available public PR discussion and validation output.

  • 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.

@mldangelo-oai
mldangelo-oai requested a balanced review from Copilot October 11, 2026 00:42

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T02:22:39.797769Z 8c9db2d New commits
🔒 Security Review ✅ Completed 2026-10-13T02:22:01.202220Z 8c9db2d 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: b349c3c235

ℹ️ 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".

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The refactors preserve existing behavior and no unresolved correctness issues were identified.

0 open findings

What changed in this PR

Refactors SDK runtime message handling to reuse existing helpers and inferred types while preserving CLI, persistence, and result behavior. Builds on #1579.

Changes:

  • Shares session parsing, progress notification, finding identity, severity, and publication schemas.
  • Consolidates CLI rendering and structured-error state.
  • Derives internal and public types from their implementation owners.
File Description
sdk/​typescript/​src/​api.ts Infers authentication result type.
sdk/​typescript/​src/​auth.ts Derives login results from runtime execution.
sdk/​typescript/​src/​classify-severity.ts Reuses shared severity constants.
sdk/​typescript/​src/​cli.ts Consolidates rendering, errors, validation, and record checks.
sdk/​typescript/​src/​contract.ts Centralizes finding identity derivation and validation setup.
sdk/​typescript/​src/​cost-model.ts Infers token pricing types.
sdk/​typescript/​src/​cost.ts Shares session parsing and state constructors.
sdk/​typescript/​src/​deduplication/​deduplication.ts Derives severity ordering from shared constants.
sdk/​typescript/​src/​deep-config.ts Reuses record validation.
sdk/​typescript/​src/​findings-import.ts Reuses record and finding identity helpers.
sdk/​typescript/​src/​mock-scan.ts Derives immutable mock finding types.
sdk/​typescript/​src/​multiscan.ts Derives task types from inventory parsing.
sdk/​typescript/​src/​publication-events.ts Shares publication evidence fields.
sdk/​typescript/​src/​publication-store.ts Validates publication records with a shared schema.
sdk/​typescript/​src/​publish.ts Reuses publication options and inferred reconciliation types.
sdk/​typescript/​src/​saved-scan-bootstrap.ts Reuses record validation.
sdk/​typescript/​src/​scan-activity.ts Exposes shared session content parsing.
sdk/​typescript/​src/​scan-comparison.ts Reuses non-blocking observer notification.
sdk/​typescript/​src/​scan-logs.ts Derives session log types from lookup results.
sdk/​typescript/​src/​severity-store.ts Constructs complete validated classifications.
sdk/​typescript/​src/​version.ts Infers package version result types.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mldangelo-oai
mldangelo-oai requested a balanced review from Copilot October 11, 2026 14:58

Copy link
Copy Markdown
Collaborator Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The refactors preserve the reviewed runtime behavior and introduce no unresolved correctness issues.

0 open findings

🧠 Review effort: Balanced

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 2c6fd4830b

ℹ️ 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".

@mldangelo-oai
mldangelo-oai requested a balanced review from Copilot October 11, 2026 15:51

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Chef's kiss.

Reviewed commit: dc29042209

ℹ️ 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".

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The cross-cutting changes affect CLI output, persistence, identity derivation, and public typings, warranting final human validation.

0 open findings

🧠 Review effort: Balanced

@mldangelo-oai mldangelo-oai changed the title refactor(sdk): share runtime message handling refactor(sdk): reuse runtime message and result handling Oct 12, 2026
Base automatically changed from mdangelo/codex/sdk-schema-result-types to main October 13, 2026 01:47

@zcrab-oai zcrab-oai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 8c9db2dbc406 in two source-review passes, including relevant callers and contracts.

Approved. No new actionable findings in the reviewed scope.

Validation: CI-helper TypeScript compilation and plugin bundling passed locally; native binaries came from CI with matching compiled source inputs. Focused SDK tests passed: contract.test.ts, cost.test.ts, publication-events.test.ts. The full cross-platform suite was not run locally; Windows execution remains unverified here.

@mldangelo-oai
mldangelo-oai merged commit 3b47a02 into main Oct 13, 2026
64 checks passed
@mldangelo-oai
mldangelo-oai deleted the mdangelo/codex/runtime-message-handling branch October 13, 2026 13:46
@github-actions github-actions Bot mentioned this pull request Oct 13, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants