Repository navigation
improve(auth): reduce pauses during concurrent credential reads - #152140
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 18, 2026, 6:21 PM ET / 22:21 UTC (Revision 5). ClawSweeper reviewWhat this changesRoutes canonical credential-reader processes through the existing spawn broker, adds one native fallback after confirmed non-admission, preserves cleanup guarantees, and updates tests, documentation, and wrapper dependencies. Merge readiness✅ Ready for maintainer review The improvement remains useful, and the latest repair resolves the previous availability concern. No blocking correctness or security findings remain. Priority: P2 Review scores
Verification
How this fits togetherAgent preparation reads stored credentials through isolated SQLite reader processes. The Gateway’s spawn broker moves process creation away from its main thread while the credential owner continues checking source identity and returning fresh rows. flowchart TD
A[Agent credential preparation] --> B[Choose reader transport]
B -->|Canonical database and broker available| C[Spawn broker]
B -->|Snapshot or no broker| D[Native process launch]
C -->|Confirmed non-admission only| D
C --> E[Isolated SQLite reader]
D --> E
E --> F[Join process and cleanup]
F --> G[Validate ownership and return fresh credentials]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +95, Tests +321, Docs +6, Other +4. Total +426 across 11 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep one credential-read owner with fresh isolated reads, broker-assisted spawning, and native recovery limited to confirmed non-admission. Do we have a high-confidence way to reproduce the issue? Not applicable as a discrete correctness bug; the performance mechanism is source-supported and the supplied real-entrypoint benchmark measures its before/after effect. Is this the best way to solve the issue? Yes. Reusing the existing broker avoids another process manager or credential cache, while the guarded native fallback preserves availability without replaying uncertain launches. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fe7f80ddca98. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
268ce2f to
55badde
Compare
|
Merged via squash.
|
…pr-149099-main-20260918 * commit '795e460278d4f8f41545dc8b4a66da1d12defd90': (1902 commits) refactor(slack): share Markdown preparation (#149129) fix(tooling): release completed PR operations with exited loaders (#152209) fix(release): allow stable npm bootstrap under an operator soak waiver (#152206) fix(daemon): avoid false restart timeouts during slow startup (#151387) feat: read agent documents from a host-owned workspace (#150584) improve(startup): skip redundant single-agent directory checks (#152192) test(ui): await board widget readiness before size reports (#152198) perf(browser): move dashboard event discovery to SQLite worker (#151952) improve(auth): reduce pauses during concurrent credential reads (#152140) improve(ui): load older chat history in smaller pages (#152093) fix(release): reject incomplete legacy npm install trees (#152186) refactor: share current-conversation binding row serialization (#152134) test(tooling): preserve Node and terminal fixture ownership under Bun (#152187) fix(sqlite): service worker admission through retained path aliases (#152190) improve: reduce CPU work for long CLI reasoning streams (#152191) chore(ui): refresh control ui locales (#152196) test(subagents): align lifecycle retries with durable completion owners (#152184) perf(gateway): defer participant maps for owned sessions (#152097) refactor(stream): share auxiliary queue overflow handling (#149282) fix(test): execute CLI fixture preloads on Node and Bun (#152076) ...
…claw#152140) * improve(auth): reduce pauses during concurrent credential reads * fix: preserve auth cleanup errors and broker build boundary * fix: include broker dependencies in PR wrapper * fix: preserve auth reads after broker nonadmission
What Problem This Solves
Concurrent agent turns repeatedly create isolated credential readers from the Gateway process. Native process creation blocks its main thread while agents prepare authentication.
Why This Change Was Made
Canonical credential reads use the Gateway's existing spawn broker. Every read still creates and closes its own isolated SQLite reader, checks current source identity, and returns fresh rows. The reader waits for IPC readiness and cleanup, preserving both read and cleanup failures with the original cause.
An authoritative broker refusal before launch now closes the proxy and permits one native fallback using the captured environment, working directory, and arguments. Cancellation, timeout, uncertain admission, other errors, and cleanup failure remain terminal. This addresses the availability review finding without replaying an uncertain launch. Snapshot readers keep native spawning.
The broker host also owns its prepared worker path for startup and restarts, preserving the lazy build boundary. The PR wrapper inventory includes the newly reachable broker dependencies.
User Impact
Node-based Linux Gateways can keep canonical credential-reader process creation off their main thread. Operation without a broker remains available. No result cache, persistent reader pool, configuration, schema, dependency, or public SDK change is introduced.
Evidence
git diff --check, and the repository core TypeScript lane passed locally.d6d502e051f9b1cd10206598d280c51935e36d3a, including the required CI gate.loadAuthProfileStoreForRuntimeAsync, Node 24.19.0 on Linux, one warmup and four measured batches per workload per arm. All 1,336 complete stores and freshness results matched; both candidate arms closed all 668 brokered readers. All processes joined and source was restored.Concurrent median batch latency fell 31–32%, parent CPU fell 52–64%, and event-loop delay p99 fell 85–88%. Serial pooled latency gains were smaller (0.8–5.1%), and moderate serial gains were not consistent across arms; serial event-loop delay p99 increased 0.16–0.19 ms. Peak parent RSS increased 1.1% (11.1 MiB) for moderate concurrent reads and decreased 1.4–2.1% in the other cells. Both candidate concurrent medians were faster than both baselines; the second concurrent baselines were 8–11% slower than the first. All adverse observations are retained. These results do not establish whole-Gateway speedup, overall memory reduction, or total CPU savings; parent CPU excludes the broker and reader processes.
The parent revision's CI run failed the existing PR-worktree interruption test because two esbuild processes briefly outlived its wrapper. Owner/test bytes were unchanged, but missing process lineage prevents excluding a timing contribution. The failure remains recorded without claiming its cause was fixed. The same shard and all required checks passed on the final revision. Earlier local type-aware lint exceeded the 8 GiB cap; hosted lint passed on the final revision.