Skip to content

fix(executions): mark_verified actually sends valid+reason; add replay()#25

Merged
govindkavaturi-art merged 1 commit into
mainfrom
feat/sdk-replay-and-verify-fix
May 4, 2026
Merged

fix(executions): mark_verified actually sends valid+reason; add replay()#25
govindkavaturi-art merged 1 commit into
mainfrom
feat/sdk-replay-and-verify-fix

Conversation

@mikemolinet
Copy link
Copy Markdown
Collaborator

Summary

Two changes, both in ExecutionsResource:

(1) Bug fix — mark_verified silently dropped both kwargs

The prior implementation accepted valid and reason as keyword args but always sent json={}:

def mark_verified(self, execution_id, *, valid=True, reason=None):
    return self._client._post(f\"/v1/executions/{execution_id}/verify\", json={})

The server treats absent body as valid=true, so the default-arg path produced the right outcome by accident. But every caller passing valid=False or reason=\"...\" got verified_success instead of their intent, silently. No exception, no warning, no test caught it.

The fix builds the body explicitly:

body = {\"valid\": valid}
if reason is not None:
    body[\"reason\"] = reason
return self._client._post(f\"/v1/executions/{execution_id}/verify\", json=body)

Pinned by 4 regression tests so a future refactor can't regress to the bug:

  • Default-arg sends {\"valid\": True} (not {})
  • valid=False lands in body
  • reason=\"...\" lands in body
  • reason=None is omitted (not serialized as null)

(2) New: client.executions.replay(execution_id)

Closes one of the endpoints_missing entries from cueapi-python #24's parity manifest. Server-side POST /v1/executions/{id}/replay already shipped on prod; this is pure SDK catch-up.

Returns the server's response dict unchanged (new execution_id, scheduled_for, status, triggered_by=\"replay\", replayed_from).

Tests

5 new (12 → 17 total). All pass.

No hosted-PR dependency

Both server-side endpoints already shipped. Pure SDK fix + catch-up.

Backlog row

Will be added per the parity discipline. The followup PR (workers + usage resources) ships in a separate branch to keep this PR's scope tight on the bug fix + single endpoint add.

How the bug was found

Surfaced while surveying cueapi-python's surface for parity work — comparing the SDK's mark_verified against the cueapi-cli cueapi executions verify command I just shipped (cueapi-cli #31). The CLI explicitly tested --valid / --invalid / --reason branches; comparing back to the SDK exposed that the SDK had silently been broken on those paths.

🤖 Generated with Claude Code

Two changes, both in ExecutionsResource:

(1) **Bug fix — mark_verified silently dropped both kwargs.** The prior
    implementation accepted ``valid`` and ``reason`` as keyword args but
    always sent ``json={}``. The server treats absent body as
    ``valid=true``, so the default-arg path produced the right outcome
    by accident — but every caller passing ``valid=False`` or
    ``reason="..."`` got ``verified_success`` instead of their intent,
    silently. The fix builds the body explicitly:

      body = {"valid": valid}
      if reason is not None:
          body["reason"] = reason

    Pinned by 4 regression tests:
    - default-arg sends ``{"valid": True}`` (not ``{}``)
    - ``valid=False`` lands in body
    - ``reason="..."`` lands in body
    - ``reason=None`` is omitted (not serialized as null)

(2) **New: ``ExecutionsResource.replay(execution_id)``** — POST
    /v1/executions/{id}/replay. Closes one of the
    ``endpoints_missing`` entries from cueapi-python #24's parity
    manifest. Server-side already shipped on prod; this is pure SDK
    catch-up.

    Returns the server's response dict unchanged (new execution_id,
    scheduled_for, status, triggered_by="replay", replayed_from).

Tests: 5 new (12 → 17 total). All pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Copy link
Copy Markdown
Member

@govindkavaturi-art govindkavaturi-art left a comment

Choose a reason for hiding this comment

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

Genuine bug fix on mark_verified — the previous version sent json={} and ignored the valid/reason params, so callers couldn't actually mark verifications failed. Plus replay() addition. Approve.

@govindkavaturi-art govindkavaturi-art merged commit dc4908b into main May 4, 2026
3 of 4 checks passed
mikemolinet added a commit that referenced this pull request May 9, 2026
…t recent ports (#36)

Manifest was 3 days stale; many endpoints listed as missing have
been ported since the last audit.

Moved from endpoints_missing → endpoints_covered (with PR refs):

  - POST /v1/cues/{id}/fire (PR #23; in-flight kwargs in #33)
  - POST /v1/executions/{id}/replay (PR #25)
  - GET /v1/executions/claimable (PR #23)
  - POST /v1/executions/{id}/claim (PR #23)
  - POST /v1/executions/claim (PR #23)
  - GET /v1/workers + DELETE /v1/workers/{id} (PR #26)
  - GET /v1/usage (PR #26)
  - POST /v1/agents + GET/PATCH/DELETE /v1/agents/{ref}
    + GET /v1/agents/{ref}/webhook-secret
    + GET /v1/agents/{ref}/inbox + /sent (PR #27)
  - POST /v1/messages + GET/read/ack (PR #28)

Added in-flight refs (open PRs):

  - GET /v1/agents/roster (in-flight PR #35; cueapi #630 parity)
  - GET /v1/agents/{ref}/presence (in-flight PR #35; cueapi #662 parity)
  - send_at + exit_criteria + idempotency_key kwargs on fire (PR #33)
  - send_at kwarg on messages.send (PR #34)

New endpoints_missing items (post-audit):

  - POST /v1/agents/{ref}/webhook-secret/regenerate (destructive; tracked)
  - DELETE /v1/messages bulk (cueapi #650; bounded by cueapi-cli upstream)
  - POST /v1/executions/{id}/live-claim (cueapi #664; handler-runtime, not SDK)

New "in_flight_ports_2026_05_07" section listing all 4 currently-open
SDK PRs with PR-overlap notes (PR #30/#33 lane-flagged with cueapi-main).

Bumped sdk_version_at_audit 0.1.3 → 0.2.x.

This refresh closes the Backlog row "Refresh cueapi-python parity-manifest.json"
filed earlier today (Self-flag 2026-05-07).

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

2 participants