Skip to content

fix(android): atomically upsert app-owned sessions#105144

Merged
steipete merged 1 commit into
mainfrom
codex/android-session-upsert-race
Jul 12, 2026
Merged

fix(android): atomically upsert app-owned sessions#105144
steipete merged 1 commit into
mainfrom
codex/android-session-upsert-race

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #101927
Follow-up to #105115.

What Problem This Solves

Android's new app-session bootstrap used sessions.describe followed by sessions.create. Two concurrent missing-row observations can each prepare a different session identity, allowing the later create to replace the first identity after work has started.

Why This Change Was Made

Use the existing label-only sessions.patch storage-boundary upsert for missing and unlabeled app sessions. This path is atomic, remains operator.write scoped, preserves a nonblank user label, and avoids a second session identity.

The focused reconnect test now proves that a superseded agent adoption cannot create or load history for the stale key even if its delayed response completes later.

User Impact

Android reconnects and rapid agent switches keep the app-owned session identity and transcript stable instead of risking a late replacement.

Evidence

Risk

Android chat session bootstrap only. Adoption remains best-effort; history still loads if the metadata upsert fails.

Docs Updated

No additional docs change: #105115 already documents and credits the app-session behavior; this only hardens its unshipped implementation.

@openclaw-barnacle openclaw-barnacle Bot added app: android App: android size: S maintainer Maintainer-authored PR labels Jul 12, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready verification on exact head c055ef7cdd1f1a70a80518199069fb76c9d6bb6b:

  • Reviewed the Android reconnect/session-key flow end to end. The follow-up replaces the racy sessions.describe + conditional sessions.create sequence with a single label-only sessions.patch, preserving concurrent identity fields while keeping the dedicated per-gateway session behavior landed in feat(android): adopt per-device app sessions #105115.
  • Fresh autoreview: clean; no accepted/actionable findings.
  • Blacksmith Testbox through Crabbox: tbx_01kxanza26gteawzjc1da9733a (Actions run).
  • Testbox command: Play and third-party ChatControllerReconnectRestoreTest, plus :app:ktlintCheck; all 84 tasks passed.
  • Exact-head GitHub Android CI: run 29185512084, including Play tests, third-party tests, Play build, and ktlint.
  • git diff --check: clean.

No known proof gaps for this narrow Android session bootstrap hardening.

@steipete
steipete merged commit d31eeea into main Jul 12, 2026
67 of 71 checks passed
@steipete
steipete deleted the codex/android-session-upsert-race branch July 12, 2026 08:28
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant