Skip to content

feat(commandbridge): harden native session recovery - #27

Merged
chicoxyzzy merged 1 commit into
mainfrom
feat/native-session-loss-contract
Jul 17, 2026
Merged

feat(commandbridge): harden native session recovery#27
chicoxyzzy merged 1 commit into
mainfrom
feat/native-session-loss-contract

Conversation

@chicoxyzzy

@chicoxyzzy chicoxyzzy commented Jul 16, 2026

Copy link
Copy Markdown
Member

Problem

Command-backed adapters can prove that a provider-native conversation backing an adopted ACP session no longer exists, but the shared bridge currently collapses that condition into an unclassified prompt failure. Hosts cannot distinguish safe first-turn recovery from an established conversation whose history was deleted or expired.

The bridge also generated default session IDs from a process-local counter, so a restarted process could reuse the same ID and make host-side replacement impossible to commit safely.

Contract

  • add an optional provider-owned prompt-failure classifier to commandbridge.Spec
  • invoke it only for a real nonzero process exit and preserve the existing RPC code/message while adding native_session_missing
  • give the classifier the ACP session, exact process spec, bounded result, and error
  • keep retry and session mutation out of the kit so the host decides from persisted conversation state
  • generate default new/fork session IDs from 128 bits of secure entropy so IDs remain distinct across process restarts
  • fail session creation/fork before state mutation when entropy or a custom ID generator yields no usable ID

Safety coverage

  • classifier is not called for launch/parser errors or a zero exit code
  • classified failure performs one command attempt, does not increment prompt history, and leaves the original session usable
  • independent bridge instances produce distinct new and fork IDs
  • a fork cannot reuse its source ID
  • failed new/fork ID generation does not create partial session state

Checks

  • go test ./...
  • go vet ./...
  • go test -race ./...
  • three independent exact-head reviews completed with no actionable findings

@chicoxyzzy
chicoxyzzy force-pushed the feat/native-session-loss-contract branch 3 times, most recently from f710ca7 to 8790cfe Compare July 16, 2026 22:09
@chicoxyzzy
chicoxyzzy marked this pull request as ready for review July 16, 2026 22:33
@chicoxyzzy
chicoxyzzy force-pushed the feat/native-session-loss-contract branch 2 times, most recently from ace1c3e to fade106 Compare July 17, 2026 00:13
@chicoxyzzy
chicoxyzzy force-pushed the feat/native-session-loss-contract branch from fade106 to 6f4b86d Compare July 17, 2026 00:18
@chicoxyzzy chicoxyzzy changed the title feat(commandbridge): classify missing native sessions feat(commandbridge): harden native session recovery Jul 17, 2026
@chicoxyzzy
chicoxyzzy merged commit f238378 into main Jul 17, 2026
1 check passed
@chicoxyzzy
chicoxyzzy deleted the feat/native-session-loss-contract branch July 17, 2026 08:31
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