Skip to content

refactor(auth): reuse privately assembled choice groups - #152166

Merged
steipete merged 1 commit into
mainfrom
codex/perf-auth-choice-owned-groups-20260918
Sep 18, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/perf-auth-choice-owned-groups-20260918

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Auth-choice menu assembly copies each freshly created private group and copies its options array immediately before a sorting operation that already returns a new array.

User Impact

No user-visible behavior change. Menu order, selection, cancellation, metadata, and caller-owned option identities remain unchanged. This is a bounded cleanup of intermediate copies; measurements do not establish a general onboarding speedup.

Why This Change Was Made

Assign the sorted options to the invocation-private group and return that group. Retain the original assembly pipeline and all three sorting layers. No group escapes before assembly completes, and no input or caller-supplied group is mutated. Production grows by one formatted line because the private assignment is explicit; no new wrapper, cache, or public contract is introduced.

Evidence

The baseline and candidate passed all 24 existing auth-choice/options/prompt/discovery tests. Additional artifact-only proof exercised the real grouped prompt through the actual builder, covering full menus, selection/error traces, container freshness, option identities, descriptors/key order, duplicate/tie ordering, visibility, More/Back/skip/keep-current, cancellation, and upstream errors. All maintained changed-file checks passed. Independent managed Codex P2 review found no actionable findings; a separate evidence audit verified source/fixture bindings and all observations.

A fixed AB/BA/AB comparison retained 1,824 observations, including 1,368 measured calls across 19 cases. Small-group builder wall medians improved 16.97%/6.48%/3.72%. The synthetic 92-choice builder improved 20.51%/6.16% but regressed 10.96% in the third pair; its pooled wall change was −8.65%. The 1,000-choice scaling case regressed 28.49% before improving 2.48%/4.13%, with pooled wall +2.35% and CPU +1.41%. Overall, 18/57 wall and 16/57 CPU comparisons were adverse; 16 CPU comparisons were exactly neutral. Unchanged controls also moved. Every adverse and near-zero comparison remains in the retained results.

These are microsecond/submillisecond owner measurements on a shared host, not full CLI, live metadata, allocation, or memory measurements. No full build or live authentication/network run was selected because imports, schemas, plugin loading, credential writes, and auth execution are unchanged. A broader earlier private assembly variant and its predominantly adverse results are preserved separately; no timing was transferred between variants.

@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 commands Command implementations size: XS maintainer Maintainer-authored PR labels Sep 18, 2026
@steipete
steipete marked this pull request as ready for review September 18, 2026 21:02
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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, 5:07 PM ET / 21:07 UTC.

ClawSweeper review

What this changes

The PR removes redundant copies while assembling authentication menus, preserving option identities, metadata, and ordering.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a sound, bounded cleanup that current main does not contain. No actionable correctness or security findings were identified.

Priority: P3
Reviewed head: b71a41e7c0f3fe1922baa750c1ddecba19af1ee6

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-supported cleanup with no actionable findings and appropriately limited performance claims.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal cleanup is exempt from the external proof gate; the body reports builder-to-prompt checks, but this review did not execute or independently inspect their raw artifacts.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal cleanup is exempt from the external proof gate; the body reports builder-to-prompt checks, but this review did not execute or independently inspect their raw artifacts.
Evidence reviewed 7 items Private ownership makes reassignment safe: The complete builder creates its map, group objects, and option arrays within each invocation. Groups do not escape before the return. Reassigning the sorted options preserves option objects and does not mutate caller-owned containers.
Introduced patch and current-main necessity: The pinned merge-base-to-head diff contains only the private-group reuse change. Inspection of fetched main shows the Object.assign group copy and redundant options spread remain, so this cleanup is not already implemented there.
Consumer and dependency boundary: The grouped prompt consumes completed builder results and handles caller-supplied additional groups separately. The changed operation uses ordinary arrays and private objects; it does not depend on Codex runtime, authentication protocol, or harness behavior.
Findings None None.
Security None None.

How this fits together

The authentication menu builder turns provider setup choices into sorted groups for onboarding and agent setup. The interactive prompt consumes those groups to offer providers and authentication methods.

flowchart TD
  A[Provider setup choices] --> C[Filter and group choices]
  B[Core choices] --> C
  C --> D[Sort private groups and options]
  D --> E[Interactive setup menu]
  E --> F[Selected authentication method]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +1. Total +1 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 4 3 +1
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 4 3 +1

Review metrics

None.

Technical review

Best possible solution:

Keep menu assembly within its existing owner and reuse invocation-private groups while preserving all sorting and caller-owned option identities.

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

Not applicable: this is a behavior-preserving cleanup rather than a bug report; current-main source confirms the redundant copies.

Is this the best way to solve the issue?

Yes: assigning sorted options to freshly created private groups removes the copies without adding another implementation path or changing public contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a small internal allocation cleanup with no intended user-visible behavior change.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal cleanup is exempt from the external proof gate; the body reports builder-to-prompt checks, but this review did not execute or independently inspect their raw artifacts.

Label justifications:

  • P3: This is a small internal allocation cleanup with no intended user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal cleanup is exempt from the external proof gate; the body reports builder-to-prompt checks, but this review did not execute or independently inspect their raw artifacts.

Evidence

What I checked:

  • Private ownership makes reassignment safe: The complete builder creates its map, group objects, and option arrays within each invocation. Groups do not escape before the return. Reassigning the sorted options preserves option objects and does not mutate caller-owned containers. (src/commands/auth-choice-options.ts:160, b71a41e7c0f3)
  • Introduced patch and current-main necessity: The pinned merge-base-to-head diff contains only the private-group reuse change. Inspection of fetched main shows the Object.assign group copy and redundant options spread remain, so this cleanup is not already implemented there. (src/commands/auth-choice-options.ts:183, 400d1f8d0fef)
  • Consumer and dependency boundary: The grouped prompt consumes completed builder results and handles caller-supplied additional groups separately. The changed operation uses ordinary arrays and private objects; it does not depend on Codex runtime, authentication protocol, or harness behavior. (src/commands/auth-choice-prompt.ts:89, b71a41e7c0f3)
  • Existing behavioral coverage: The existing options tests cover provider grouping, featured ordering, method priority, duplicate choice replacement, visibility filtering, and CLI-versus-interactive scope. These tests were read, not executed during this read-only review. (src/commands/auth-choice-options.test.ts:1, b71a41e7c0f3)
  • Validation claims and protected context: The captured PR body reports 24 existing tests passing on baseline and candidate, grouped-prompt boundary checks, and mixed benchmark results without claiming a general onboarding speedup. Repository State identifies MEMBER authorship and the captured labels include maintainer; ordinary external-contributor proof requirements do not apply. (b71a41e7c0f3)
  • Feature-history routing: Available current-main file history records repeated contributions by Peter Steinberger and earlier grouped-onboarding work by Jason (Json). Full blame and deeper pickaxe inspection encountered an unavailable historical object, so no source-line introduction attribution is asserted. (src/commands/auth-choice-options.ts, 400d1f8d0fef)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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.

@steipete
steipete merged commit 9dd45f6 into main Sep 18, 2026
280 checks passed
@steipete
steipete deleted the codex/perf-auth-choice-owned-groups-20260918 branch September 18, 2026 21:37
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 18, 2026
…n-20260918-v4

* origin/main: (81 commits)
  fix: retire failed setup plugins without replaying facade initialization (#152026)
  fix(test): select Node for built runtime recovery fixtures (#152162)
  refactor(auth): reuse privately assembled choice groups (#152166)
  fix: preserve chat media delivery and session boundaries (#152079)
  fix: keep stale Stop messages from canceling replacement sessions (#152116)
  improve(plugins): reduce mutable argument handling overhead (#152154)
  fix(scripts): prevent host tooling drift from blocking PR workflows (#152078)
  improve: reduce model capability preparation work (#152128)
  fix: stop marking delivered scheduled reports as failed (#152165)
  fix: start background context maintenance after durable turns (#151936)
  fix(models): avoid ambient state reads during prepared selection (#152119)
  feat: recover abandoned Crabbox source staging (#152006)
  chore(ui): refresh control ui locales (#152098)
  fix(ui): keep cloud startup prompts and progress in chat (#152024)
  fix: report completed subprocess cleanup after cancellation (#152107)
  perf(reply): reuse normalized inbound text (#152110)
  fix(cron): paused future one-shots disappear after Run now (#152126)
  perf(sessions): reuse rows and skip discarded terminal labels (#152109)
  fix(ui): keep keyboard-focused automation controls clear of sticky actions (#152135)
  fix(ui): load remote images in compact activity previews (#152045)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands Command implementations maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS 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