Skip to content

feat(sdk): return authoritative turn settlement results - #2525

Open
limityan wants to merge 1 commit into
GCWing:1.0.0-explorefrom
limityan:yanzhn/sdk-authoritative-turn-result
Open

feat(sdk): return authoritative turn settlement results#2525
limityan wants to merge 1 commit into
GCWing:1.0.0-explorefrom
limityan:yanzhn/sdk-authoritative-turn-result

Conversation

@limityan

Copy link
Copy Markdown
Collaborator

Summary

  • Return a typed AgentTurnSettlementResult from the Rust Runtime SDK with the authoritative terminal status, final response, and finish reason.
  • Keep Core as the result owner: terminal facts are recorded only after successful persistence, with bounded live-session storage and persisted transcript fallback.
  • Make SDK Host streaming events progress-only and build the terminal query result from the Runtime settlement result, so intermediate tool-round text cannot be mistaken for the final answer.
  • Preserve the existing CLI and App Server wire contracts by consuming or discarding the richer Runtime return value at those adapters.

Scope

  • Rust Runtime SDK preview API moves from v9 to v10 because the settlement port return type is source-breaking.
  • No custom tool surface, new transport, new process/runtime, dependency addition, or npm/PyPI publication.
  • 19 files, 893 insertions and 120 deletions; one commit.

Adversarial review

The review covered persistence failure, cold persisted sessions, transient sessions, recovery generations, rollback/delete/unload invalidation, bounded-cache refresh, timeout priority, unknown-outcome classification, and Host output/cancellation races. The resulting regressions are covered by focused tests.

Validation

  • cargo test --locked -p bitfun-runtime-ports --features agent-api — 51 passed
  • cargo test --locked -p bitfun-agent-runtime --features agent-runtime --test agent_session_contracts — 67 passed
  • cargo test --locked -p bitfun-sdk-host — 66 passed across unit/lifecycle/protocol suites
  • Focused bitfun-core settlement, persistence, recovery, projection, and fork/rollback tests — passed
  • cargo check --locked -p bitfun-cli --all-targets — passed
  • pnpm --dir sdk/typescript test — 66 passed, 1 Unix-only test skipped on Windows
  • pnpm run check:core-boundaries — passed
  • git diff --check — passed

Known target-branch issue: lightweight_client_negotiates_with_the_production_server fails with missing advertised method session/reloadContext on exact base 21283e2d8 as well as the feature branch. Its lightweight fixture does not register the context-reload port while the assertion requires that dynamically advertised capability; this PR does not alter capability registration. cargo fmt --check likewise reports only five pre-existing formatting diffs outside this PR's changed files.

Implementation and adversarial review used AI assistance. All validation listed above was executed locally.

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