Skip to content

fix: avoid session-list rebuilds when authentication availability changes - #151920

Merged
steipete merged 2 commits into
mainfrom
codex/session-auth-facts-invalidation
Sep 18, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/session-auth-facts-invalidation

Conversation

@steipete

@steipete steipete commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Session lists can rebuild every cached row when a model authentication route is recorded or revoked, even though the model catalog is unchanged.

User Impact

Session lists reuse their existing rows across authentication availability changes. Model-picker availability and revocation still refresh; real model, configuration, and owner changes still invalidate session rows. No configuration or database migration is required.

Why This Change Was Made

The existing authentication-materialization publisher now identifies publications that leave model facts unchanged. The session catalog projection consumes that fact only after it has a complete catalog. Existing publication phases and stale-owner guards remain intact.

Evidence

  • Regression reproduces both binding and revocation dirtying all 256 resident sessions on the original code. With the fix, neither action dirties or rematerializes rows, rereads the catalog, or changes the registered sessions.list output; the published authentication facts still change.
  • 82 tests pass across catalog publication, auth materialization and usage, projection recovery, and metadata lifecycle. Coverage includes real model changes/removal, owner replacement, incomplete-catalog recovery, picker refresh/revocation, and stale sibling owners.
  • In an isolated 256-session workload (16 bind/revoke cycles, 32 real list requests), list median fell from 114 ms to 10.5 ms and p95 from 168 ms to 14.7 ms (nearest rank). Rematerializations fell from 8,192 to zero and catalog reads from 64 to zero. Workload time was 4.08 s before and 0.50 s after. Whole-process peak RSS was 915,016 KiB before and 774,216 KiB after, including harness/import memory; this is an observation, not an isolated memory-savings claim.
  • Independent P2 review: no actionable findings. Production trigger attribution remains unverified.
  • Additional CI investigation: an existing Codex process-poll test failed twice with success: false; the failure output omitted its response text. The exact 11-file group passes 129/129 tests on both baseline and candidate under Node 24.20.0 with three workers. The test now also checks its synthetic completed output, exposing response content on failure while preserving all acknowledgement assertions and timeouts. The hosted failure cause remains unverified.

CI also reported a Vitest fork shutdown error after all 434 tests in the affected shard passed. The named transcript test and its cleanup owners came unchanged from the exact main parent; inspection found no causal connection to this diff. The missing worker shutdown response remains unexplained, and its retained log is part of the investigation evidence.

Exact-head CI run 35368653213 passed on 10ee5df0aae3e704c1e69be7dcbe900b2aa2cd58 after one bounded retry of that failed shard. The previously failing process-poll shard passed on this head. Neither earlier failure cause is claimed fixed by the retry.

Keep authentication availability publications for metadata consumers while telling the session projection when model facts are unchanged. Incomplete catalogs and real owner or model changes retain their invalidation paths.
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Sep 18, 2026
@steipete
steipete marked this pull request as ready for review September 18, 2026 15:42
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 18, 2026
@clawsweeper

clawsweeper Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 1:25 PM ET / 17:25 UTC (Revision 3).

ClawSweeper review

What this changes

The PR preserves cached session-list rows when authentication availability changes, adds binding and revocation regression coverage, and strengthens a Codex process-poll output assertion.

Merge readiness

✅ Ready for maintainer review

The PR remains useful: current main still rebuilds session rows for authentication-only publications. No actionable correctness or security findings remain, and the protected maintainer submission should stay open for normal landing.

Priority: P2
Reviewed head: 10ee5df0aae3e704c1e69be7dcbe900b2aa2cd58

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level optimization with meaningful regression coverage, reported comparative measurements, and passing exact-head CI.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its captured body reports an isolated bind/revoke workload through sessions.list with unchanged responses and zero rematerializations after the fix; production latency improvement remains unverified.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its captured body reports an isolated bind/revoke workload through sessions.list with unchanged responses and zero rematerializations after the fix; production latency improvement remains unverified.
Evidence reviewed 10 items Introduced scope: The verified merge-base-to-head delta contains three production edits and two test edits. Endpoint drift and the stale test-merge candidate were excluded from introduction claims.
Current-main necessity: Fetched main still emits authentication invalidation/publication events without modelFactsChanged, while its session projection only skips unchanged catalog-phase events. The proposed optimization is therefore still absent.
Latest-release check: The supplied latest release, v2026.9.4, also has the unmarked authentication publisher; the newer extracted session catalog projection file does not exist at that release revision. No released implementation of this change was established.
Findings None None.
Security None None.

How this fits together

The Gateway builds session-list rows using published model metadata. Authentication availability also feeds model-picker metadata, but does not change the model facts used to build those rows.

flowchart TD
  A[Authentication bound or revoked] --> B[Prepared runtime publisher]
  B --> C[Model-picker metadata refresh]
  B --> D{Complete cached catalog and unchanged model facts?}
  D -->|Yes| E[Reuse session rows]
  D -->|No| F[Refresh catalog and session rows]
  E --> G[Session-list response]
  F --> G
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source 0, Tests +47. Total +47 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 6 6 0
Tests 2 48 1 +47
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 54 7 +47

Review metrics

Metric Value Why it matters
Production versus test growth production net 0 lines; tests net +47 lines The optimization reuses the existing publication and cache owners without growing production code.

Technical review

Best possible solution:

Keep authentication availability publications intact while rebuilding session rows only when their model facts change or their catalog needs recovery.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: binding or revoking runtime authentication on current main emits two publications that invalidate resident session rows despite unchanged catalog facts. The supplied regression exercises that path; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. The existing publisher supplies the unchanged-facts signal, and the existing projection consumes it conservatively without adding another cache, changing authentication decisions, or suppressing incomplete-catalog recovery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d8b6873518d2.

Labels

Label justifications:

  • P2: This is a bounded session-list performance repair with preserved output and no demonstrated urgent outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR is exempt from the external-contributor proof gate. Its captured body reports an isolated bind/revoke workload through sessions.list with unchanged responses and zero rematerializations after the fix; production latency improvement remains unverified.

Evidence

What I checked:

  • Introduced scope: The verified merge-base-to-head delta contains three production edits and two test edits. Endpoint drift and the stale test-merge candidate were excluded from introduction claims. (10ee5df0aae3)
  • Current-main necessity: Fetched main still emits authentication invalidation/publication events without modelFactsChanged, while its session projection only skips unchanged catalog-phase events. The proposed optimization is therefore still absent. (src/agents/prepared-model-runtime-materializations.ts:30, d8b6873518d2)
  • Latest-release check: The supplied latest release, v2026.9.4, also has the unmarked authentication publisher; the newer extracted session catalog projection file does not exist at that release revision. No released implementation of this change was established. (src/agents/prepared-model-runtime-materializations.ts:30, 3a9d69db306c)
  • Cache and recovery boundary: The skip requires explicitly unchanged model facts and a complete resident catalog. Missing catalogs, undefined entries in per-agent maps, failed owner publications, and ordinary owner/config changes retain invalidation. Row model facts consume catalog entries and policy rather than runtime authentication materializations. (src/gateway/session-row-projection-catalog.ts:15, 10ee5df0aae3)
  • Authentication refresh remains active: The publisher still updates authentication materializations and preserves stale-owner guards. The chat metadata listener continues to process invalidated/published phases independently of the added flag; existing integration coverage exercises availability becoming true after binding and false after revocation. (src/gateway/server-chat-metadata-lifecycle.ts:86, 10ee5df0aae3)
  • Regression coverage and reported workload: The added table-driven test exercises both binding and revocation through persisted sessions, the real projection, and registered sessions.list handling, checking unchanged output and no catalog rereads or rematerialization. The captured PR body reports 256-session before/after measurements, including 8,192 versus zero rematerializations; those measurements were not independently rerun. (src/agents/prepared-model-runtime.catalog-publication.test.ts:145, 10ee5df0aae3)

Likely related people:

  • Peter Steinberger: Raw commit 2db54d7 adds src/gateway/session-row-projection-catalog.ts:19 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2db54d773ea7; files: src/gateway/session-row-projection-catalog.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-18T15:59:58.755Z sha edfaeb9 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-18T16:34:29.058Z sha 10ee5df :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 90c1822 into main Sep 18, 2026
375 of 377 checks passed
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete
steipete deleted the codex/session-auth-facts-invalidation branch September 18, 2026 17:32
vincentkoc added a commit that referenced this pull request Sep 18, 2026
* origin/main:
  test(gateway): isolate session resolution channel fixtures (#151945)
  fix(clickclack): drain discussion opens before shutdown (#151978)
  fix(test): restore trusted packaging harness startup (#151967)
  improve(codex): batch session adoption binding reads (#151979)
  improve(cron): reduce allocations for busy stream sources (#151956)
  fix(file-transfer): avoid repeated directory record encoding (#151987)
  fix: avoid session-list rebuilds when authentication availability changes (#151920)
  fix(updates): explain externally managed update refusals (#151942)
  improve(heartbeat): avoid unused config work in membership checks (#151867)
  fix(android): keep status text readable and label accessibility actions (#151342)
  improve(ui): show OS and size in the environment selector (#151947)
  fix(android): keep tool errors visible in collapsed chat activity (#151332)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
…nges (openclaw#151920)

* perf: preserve session rows across auth availability changes

Keep authentication availability publications for metadata consumers while telling the session projection when model facts are unchanged. Incomplete catalogs and real owner or model changes retain their invalidation paths.

* test(codex): check output in process poll delivery proof
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling extensions: codex gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant