Skip to content

fix(server): preserve tool results and reduce checkpoint churn#536

Merged
ahmedhesham6 merged 2 commits into
feature/gateway-existing-changesfrom
fix/gateway-toolcall-aborted-debug
Feb 12, 2026
Merged

fix(server): preserve tool results and reduce checkpoint churn#536
ahmedhesham6 merged 2 commits into
feature/gateway-existing-changesfrom
fix/gateway-toolcall-aborted-debug

Conversation

@ahmedhesham6

Copy link
Copy Markdown
Collaborator

Summary

This PR fixes two server-side issues observed in gateway/session runs:

  1. Tool result linkage was lost in session storage conversion

    • Preserves tool_call_id when converting LLMMessage::ToolResult -> ChatMessage.
    • Adds regression coverage in server message storage adapter tests.
  2. Checkpoint churn in short sessions

    • Reworks checkpoint runtime persistence to use a dirty + signature-based snapshot strategy.
    • Hooks now update in-memory latest messages; persistence is deduplicated and flushed via snapshot path.
    • Reduces excessive checkpoint creation while preserving terminal/error persistence behavior.

Also added a TODO in session_actor to migrate checkpoint storage to native Vec<stakai::Message> and remove adapter conversion.

Why

  • Prevents tool-call/result chain breakage in stored sessions (which can surface as aborted/missing tool response behavior).
  • Prevents runaway checkpoint growth in sessions with small message volume.

Validation

  • cargo fmt on touched files
  • cargo clippy -p stakpak-server -p stakpak-shared --lib -- -D warnings
  • cargo test -p stakpak-shared tool_result -- --nocapture
  • cargo test -p stakpak-server preserves_tool_result_tool_call_id_through_storage_adapter -- --nocapture
  • cargo test -p stakpak-server session_actor::tests -- --nocapture
  • cargo check -p stakpak

@ahmedhesham6 ahmedhesham6 merged commit bb18915 into feature/gateway-existing-changes Feb 12, 2026
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