Skip to content

fix: correct work heartbeat query and roster latest versions - #43

Merged
moonyue-w merged 1 commit into
mainfrom
codex/contract-bug-fixes-20261120
Nov 21, 2026
Merged

moonyue-w merged 1 commit into
mainfrom
codex/contract-bug-fixes-20261120

Conversation

@moonyue-w

Copy link
Copy Markdown
Collaborator

Summary

  • Send environments.work.heartbeat() expected_last_heartbeat and desired_ttl_seconds as query parameters instead of a JSON body. Caller options.query values are still merged.
  • Add ManagedAgentsMultiagentAgentParams, ManagedAgentsMultiagentAgentReference and ManagedAgentsMultiagentAgentVersion. Managed Agent roster child versions accept "latest" and positive integer strings, and saved roster versions are typed number | "latest".
  • Session and Deployment Agent references are unchanged and still take numeric versions.

Why

  • The heartbeat contract defines both fields as query parameters, and the Managed service reads only the query. The SDK sent them in the body, so lease preconditions (412 fencing) and requested TTLs silently had no effect.
  • The official Agent schema saves and returns "latest" for child Agent references, which the previous types could not express.

Verification

  • npm run build
  • npm run typecheck
  • npm test
  • npm run docs:check
  • Relevant examples run or import successfully
  • Account-backed integration tests run, or not required

Commands and results:

npm run build       # passed
npm run typecheck   # passed (tsc and tsconfig.types.json)
npm test            # 4463 tests, 4463 pass, 0 fail
npm run docs:check  # PASS: internal links OK, 17 README snippets compiled

Impact

  • Public API or behavior changed
  • User-facing changes added to CHANGELOG.md under Unreleased, or not applicable (explain below)
  • CommonJS, ESM, and subpath exports remain valid
  • Generated API documentation updated
  • Contract or wire-field fixtures updated
  • Go and Python parity considered
  • Migration notes added for a breaking change
  • No credentials, .env.live, logs, or generated test output committed

Additional context:

  • The generic Managed contract tests check only method and path, which is why the heartbeat bug passed CI. A focused regression test now asserts the query parameters, an empty body and no JSON content type.
  • tests/fixtures/managed/api-methods.json already declared both heartbeat fields as query parameters, so fixtures did not need changes.
  • Breaking change: saved roster version is now number | "latest". The changelog explains how to check for "latest" before treating it as a number.
  • No example uses these APIs, so none was run. Account-backed tests are not required for this request-location and type fix.
  • Parity: Go and Python receive the same roster fix; Java already supports "latest". Only TypeScript sent heartbeat parameters in the body.

- Send Managed work heartbeat expected_last_heartbeat and
  desired_ttl_seconds as query parameters; the service ignored them in
  the JSON body, so lease preconditions and TTLs had no effect.
- Accept and type Managed Agent roster child versions saved as "latest";
  Session and Deployment references stay numeric.
@moonyue-w
moonyue-w merged commit a69e6b8 into main Nov 21, 2026
5 checks passed
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