Skip to content

feat(sdk): add shared codex runtime strategy foundation#122

Open
yaniv-tg wants to merge 1 commit intoa5c-ai:stagingfrom
yaniv-tg:codex-sdk-runtime-pr1
Open

feat(sdk): add shared codex runtime strategy foundation#122
yaniv-tg wants to merge 1 commit intoa5c-ai:stagingfrom
yaniv-tg:codex-sdk-runtime-pr1

Conversation

@yaniv-tg
Copy link
Copy Markdown
Contributor

@yaniv-tg yaniv-tg commented Apr 6, 2026

Summary

This PR moves the first Codex runtime uplift into the shared SDK instead of continuing to grow duplicated plugin-only logic.

It adds shared runtime foundations for:

  • harness capability reporting
  • model routing defaults for plan / interactive / execute / review / fix
  • execution strategy resolution for local, subagent, and future cloud modes
  • dispatch envelope abstraction
  • orchestrator_task metadata for subagent fan-out
  • waiting-iteration metadata exposing routed models, pending effects by mode, and harness capabilities

This is PR 1 of the Codex upstreaming work. It is intentionally limited to shared SDK/runtime foundations.

What Changed

Shared runtime modules

Added:

  • packages/sdk/src/runtime/capabilityReport.ts
  • packages/sdk/src/runtime/modelRouting.ts
  • packages/sdk/src/runtime/executionStrategy.ts
  • packages/sdk/src/runtime/strategyDispatch.ts

These provide:

  • Codex capability detection in shared SDK code
  • default model routing:
    • interactive -> gpt-5.3-codex-spark
    • other phases -> gpt-5.3-codex
  • strategy resolution:
    • local
    • subagent
    • cloud requested but still local fallback in this PR
  • dispatch envelope generation for runtime consumers

Runtime wiring

Updated:

  • packages/sdk/src/runtime/intrinsics/task.ts
  • packages/sdk/src/runtime/intrinsics/orchestratorTask.ts
  • packages/sdk/src/runtime/orchestrateIteration.ts
  • packages/sdk/src/runtime/types.ts
  • packages/sdk/src/runtime/index.ts

This adds:

  • executionHints on pending effect actions
  • iteration metadata for:
    • harnessCapabilities
    • routedModelsByPhase
    • pendingEffectsByMode
  • shared handling of orchestrator-task execution metadata

Task schema updates

Updated:

  • packages/sdk/src/tasks/types.ts
  • packages/sdk/src/tasks/kinds/index.ts

This extends orchestrator_task definitions with:

  • executionMode
  • modelPhase
  • parallelism
  • subtasks

This is the baseline needed for local subagent fan-out semantics in shared code.

Tests

Added/updated:

  • packages/sdk/src/runtime/__tests__/strategyRuntime.test.ts
  • packages/sdk/src/runtime/__tests__/intrinsics.behaviors.test.ts
  • packages/sdk/src/runtime/__tests__/orchestrateIteration.integration.test.ts
  • packages/sdk/src/tasks/__tests__/kinds.test.ts

Coverage includes:

  • Codex capability reporting
  • interactive model routing defaults
  • cloud fallback behavior for PR 1
  • subagent dispatch envelope generation
  • orchestrator-task metadata propagation
  • waiting-iteration metadata for routed model + execution mode

Docs

Updated:

  • README.md
  • plugins/babysitter-codex/README.md

These now point out that shared Codex runtime policy is moving into packages/sdk.

Non-goals in This PR

This PR does not yet do:

  • real cloud submit/resume integration
  • deferred cloud lifecycle handling
  • shared instruction deduplication across plugin docs/skills
  • deletion of the duplicated plugins/babysitter-codex tree

Those should follow in later PRs.

Validation

Ran:

npm.cmd test -- --run src/runtime/__tests__/strategyRuntime.test.ts src/runtime/__tests__/intrinsics.behaviors.test.ts src/runtime/__tests__/orchestrateIteration.integration.test.ts src/tasks/__tests__/kinds.test.ts src/harness/__tests__/harness.test.ts

Result:

  • 5 test files passed
  • 63 tests passed
  • 0 failed

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.

1 participant