Skip to content

fix: await pending session identity lookups (#260 follow-up) - #273

Merged
abogartz merged 2 commits into
abogartz:mainfrom
WhollyMindless:fix/260-pending-session-identity
Nov 3, 2026
Merged

abogartz merged 2 commits into
abogartz:mainfrom
WhollyMindless:fix/260-pending-session-identity

Conversation

@WhollyMindless

Copy link
Copy Markdown
Contributor

After #269, mutating tools await bindSessionIdentity, but a second caller for the same session can still return before the first caller's host lookup resolves. The existing in-flight flags skip the lookup rather than joining it. With an instance in repo A and a parked lookup that eventually identifies repo B, that second caller can merge or delete A's rows, or force-undo A's additions.

Share per-session pending promises for message-context and session-row lookups, including row lookups started by the event handler. Register each promise before invoking the host and remove it when settled. The bounded completed row-attempt cache, retryable message misses, host method receivers, and provisional fallback after a completed miss retain their existing behavior.

Refs #260 as a follow-up to the already merged/released #269. Reproduction uses deterministic harness interleavings; real-host reachability remains unproven, as in the original issue. Ownership and follow-up scope: #260 (comment)

Validation:

  • Nine new regressions fail on main 24734a0; all ten final tests pass with the fix, including a successful same-repository concurrent merge control.
  • Coverage includes both identity sources, an event-started row lookup, pending misses/errors and their cache behavior, foreign merge/forget/force-undo isolation, and host method receivers.
  • Windows full gate: typecheck and lint pass; 921 unit tests pass / 32 skip; all 30 real-host E2E tests pass.
  • Linux focused identity suite: 27 tests pass across four files.

@ocsi-triager ocsi-triager Bot added the review:requested Human-admitted for autonomous review by ocsi-reviewer label Nov 3, 2026

@ocsi-reviewer ocsi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Head reviewed: 1444ff65ec70fa40c254a6d9e92a8c5bdec79b1c (diff key 3c91b03a8892ecbfc50d0dab61defa816abb8b8a8dfc16992e7e07f5fb23fa2b = shasum of git diff 24734a0..1444ff6)

Verdict: APPROVE. Trusted-human PR advising the maintainer; named contract #260 (author WhollyMindless, trusted; issue CLOSED/released — this is the declared follow-up per scope comment 6614392517). Spec anchor 306e42228970cbbf equals recomputed body hash — frozen.

Contract — follow-up scope (WhollyMindless, 2026-11-03T20:14:18Z)

share pending identity lookups, preserving the shipped #269 authorization calls and the existing completed-lookup cache

Criterion Evidence
Share per-session pending promises, both sources, incl. event-started row lookups messageBindings/apiBindings Maps (src/identity/session-context.ts:99,132); joiner returns the pending promise before consulting any cache (:102-103, :135-137). Test "forget joins a row lookup started by another caller" (test/session-identity-pending.test.ts:264)
Register before invoking host; remove when settled set(sid, binding) executes synchronously before await binding; finally deletes (:112-118, :148-156). Promise body catches internally so joiners never reject
Completed row-attempt cache, retryable message misses, method receivers, provisional fallback preserved apiBindTried+LRU untouched; test asserts lookups === 1 and messages === 2 (retryable, :164-165); receiver pinned by expect(this).toBe(session) (:89,95); same-repo concurrent-merge control passes on both base and head (:233)
RED/GREEN New file at merge-base 24734a0 (detached worktree): 1 pass / 9 fail — force-undo restored repo-A's loser while the lookup was parked, the exact claimed interleaving. At head: 10 pass / 0 fail / 42 expects

Commands run at head (Bun 1.4.4)

  • bun run typecheck → exit 0
  • bun run lint → 503 warnings = base baseline
  • bun run test → 934 pass / 19 skip / 0 fail, 12267 expects (924+10 new)
  • bun run test:e2e → 30 pass / 0 fail (src/ changed)

Test integrity: new file has no .skip, no raised timeouts, no widened tolerances; assertions are strict (settled === false while parked, single-host-call counters, foreign-row survival via loadAll).

Nit (non-blocking): no Closes footer; Refs #260 is present and correct since #260 is closed — a follow-up should not close it.

Final gate re-check (verbatim)

$ gh pr view 273 --json headRefOid --jq .headRefOid
1444ff65ec70fa40c254a6d9e92a8c5bdec79b1c
$ gh pr checks 273 --json name,bucket
[{"bucket":"pass","name":"lint"},{"bucket":"pass","name":"test"},{"bucket":"pass","name":"test-windows"},{"bucket":"pass","name":"smoke"}]

No P0/P1 findings. Human merges.

@abogartz
abogartz merged commit 5440900 into abogartz:main Nov 3, 2026
4 checks passed
@abogartz-opencode-self-improvement

Copy link
Copy Markdown

🎉 This PR is included in version 0.15.17 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

released review:requested Human-admitted for autonomous review by ocsi-reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants