Skip to content

refactor(runtime): route fixed session identity through SDK - #1597

Merged
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/refactor-runtime-fixed-session-id
Jul 17, 2026
Merged

refactor(runtime): route fixed session identity through SDK#1597
limityan merged 1 commit into
GCWing:mainfrom
limityan:yanzhn/refactor-runtime-fixed-session-id

Conversation

@limityan

@limityan limityan commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add a source-compatible AgentRuntime::create_session_with_id path while keeping AgentSessionCreateRequest unchanged
  • use the exact-ID path for exec --session-id and CLI backend-session recreation; retain the old Core facade method as a deprecated migration shim
  • reject invalid, duplicate, unsupported, or provider-mismatched identities with typed errors while preserving the existing create_session error contract
  • make first persistence claim the final session directory atomically, so only its owner can clean up a failed write and a concurrent loser cannot delete the winner
  • update the existing runtime and CLI architecture facts without adding a standalone design document

Product and architecture boundaries

  • SDK API version remains v1: the new port method has a default NotAvailable implementation and no field was added to the public create DTO
  • ordinary CLI/TUI creation, ACP, remote-connect, and agent-tool paths still request generated IDs
  • no new TUI screen, command, selector field, session owner, generic persistence transaction, extension surface, or HarmonyOS behavior
  • model updates, branching, usage, snapshots, persistence maintenance, and loaded-session checks remain on the existing compatibility path
  • the internal first-write API is crate-private; ordinary session updates continue to use the existing save_session path

Failure and concurrency behavior

  • late metadata/state write failures roll back memory, caches, storage claims, the owned session directory, and its index entry; retrying the same ID is covered
  • two independent persistence managers sharing one root can race on the same ID, but exactly one can acquire the final directory and the loser cannot write or clean it
  • a provider that reports the wrong ID is rejected by Runtime; Runtime cannot undo side effects already performed by a non-conforming provider
  • a process crash after the directory claim can still leave a partial directory that is safely rejected on retry; crash recovery is intentionally outside this PR

Validation

  • cargo +nightly test -p bitfun-runtime-ports
  • cargo +nightly test -p bitfun-agent-runtime
  • cargo +nightly test -p bitfun-core agent_submission_create_session_ -- --nocapture
  • cargo +nightly test -p bitfun-core concurrent_first_session_persistence_keeps_the_winner
  • cargo +nightly test -p bitfun-core persistent_session_creation_failure_does_not_publish_runtime_state
  • cargo +nightly test -p bitfun-core compatibility_operations_have_one_core_owned_facade
  • cargo +nightly test -p bitfun-cli
  • cargo +nightly check --workspace
  • node scripts/check-core-boundaries.mjs
  • pnpm run check:repo-hygiene
  • git diff --check gcwing/main

Rust validation used the coherent installed nightly toolchain because the local stable Cargo and standard-library installation are mismatched. Existing dependency deprecation and CLI dead-code warnings remain unchanged.

@limityan
limityan force-pushed the yanzhn/refactor-runtime-fixed-session-id branch from f5eacf5 to 5268cc5 Compare July 17, 2026 11:43
@limityan
limityan marked this pull request as ready for review July 17, 2026 11:56
@limityan
limityan merged commit f67bf55 into GCWing:main Jul 17, 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