Skip to content

fix(secrets): avoid unrelated reads during GitHub maintenance - #144940

Merged
steipete merged 1 commit into
mainfrom
codex/github-oauth-prefix-scan-20260911
Sep 11, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/github-oauth-prefix-scan-20260911

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where GitHub authorization maintenance repeatedly loads unrelated shared-secret values into memory as the secret store grows. Both device and OAuth reconciliation performed this work even without a configured GitHub identity.

Why This Change Was Made

Narrow the existing indexed query to the requested GitHub name range before projecting values. Keep the exact JavaScript classifier, expiration and scope checks, matched-value redaction, name ordering, and fresh per-record reads. No schema or index change is needed.

User Impact

GitHub maintenance allocates less memory and spends less synchronous time reading unrelated secrets. Authorization behavior stays the same.

Evidence

  • Real SQLite regression fails on the original code because unrelated value payloads cross the query boundary; it passes after the fix. Separate parity cases cover names, expiration, scope, and redaction.
  • Focused coverage: 25 secret-store, 46 GitHub record, and 41 lifecycle tests passed.
  • Local synthetic benchmark with 2,048 unrelated 256-byte values: one list materializes 2 records / 50 value bytes instead of 2,052 records / 524,386 bytes. A device+OAuth pair falls from median 3.83 ms to 0.48 ms across 15 samples after 5 warmups. With 512 unrelated 64 KiB values, the pair falls from 17.55 ms to 0.46 ms. These fixtures do not establish production stall attribution.
  • Native query plans use the existing live index with a name range. Independent parity checks cover UTF-8 and both UTF-16 encodings; exact classification remains in JavaScript.
  • Independent P2 autoreview found no actionable findings.
  • Full check:changed passed.
  • Linux Blacksmith owner-flow exercised actual SQLite and GitHub lifecycle maintenance: invalid device/OAuth rows were removed, a valid pending device and 64 unrelated secrets were retained, and a later exact read observed an updated record. The selected-source receipt and all assertions were retained. The wrapper exited 1 after a cleanup timeout; a separate native check confirmed the lease completed and its workflow ended. This is qualified owner-flow evidence, not a clean overall wrapper run or live GitHub authorization.

@clawsweeper

clawsweeper Bot commented Sep 11, 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 size: S maintainer Maintainer-authored PR labels Sep 11, 2026
@steipete
steipete marked this pull request as ready for review September 11, 2026 13:20
@steipete
steipete requested a review from a team as a code owner September 11, 2026 13:20
@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 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 11:11 AM ET / 15:11 UTC (Revision 2).

ClawSweeper review

What this changes

The PR restricts GitHub maintenance reads to the requested secret-name range and adds regression coverage for reduced reads and unchanged record selection.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: current main and v2026.9.4 still load unrelated secret values during GitHub maintenance. No actionable correctness or security regression was found.

Priority: P2
Reviewed head: df58d27be38e44f740811c19647b7ff7dce90be8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A small, maintainable query repair with meaningful regression coverage and no blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-author exemption applies, and this query optimization does not materially change authority. The body reports relevant SQLite and lifecycle observations, qualified by a cleanup timeout; raw receipts were not independently inspected.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-author exemption applies, and this query optimization does not materially change authority. The body reports relevant SQLite and lifecycle observations, qualified by a cleanup timeout; raw receipts were not independently inspected.
Evidence reviewed 8 items Current-main necessity: The current-main listing selects values from all eligible team secrets before applying the GitHub name classifier in JavaScript.
Released behavior: The v2026.9.4 source contains the same unrestricted listing query; this release does not contain the proposed optimization.
Introduced change and merge result: The host-verified test merge preserves the query change against its exact main parent. The added range contains valid lowercase GitHub record names while retaining existing scope, deletion, classifier, liveness, ordering, and redaction checks.
Findings None None.
Security None None.

How this fits together

GitHub authorization maintenance reads device and OAuth records from OpenClaw’s shared SQLite secret store. The returned names feed fresh record reads used for cleanup and credential maintenance.

flowchart TD
  A[GitHub maintenance] --> B[Requested record type]
  B --> C[Indexed secret-name range]
  D[Shared SQLite secret store] --> C
  C --> E[Exact name and liveness checks]
  E --> F[Register matching values for redaction]
  F --> G[Fresh record reads and maintenance]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +3, Tests +116. Total +119 across 2 files.

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

Review metrics

None.

Technical review

Best possible solution:

Keep name filtering in the existing SQLite query owner while preserving exact classification, matched-value redaction, and fresh record reads.

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

Yes, from source: listing either GitHub record type on current main materializes unrelated eligible team-secret values before filtering names; the added SQLite regression targets that boundary. This review did not execute it.

Is this the best way to solve the issue?

Yes. Restricting the existing indexed query is a narrow repair that preserves the accepted records and avoids a second cache, migration, or authorization policy.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This reduces recurring synchronous database work as the shared secret store grows, without evidence of an urgent production outage.
  • 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: The maintainer-author exemption applies, and this query optimization does not materially change authority. The body reports relevant SQLite and lifecycle observations, qualified by a cleanup timeout; raw receipts were not independently inspected.

Evidence

What I checked:

Likely related people:

  • steipete: 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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-09-11T13:26:14.622Z sha 1f244eec151e5132e511aebdd20148b90af8dd76 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/github-oauth-prefix-scan-20260911 branch from 1f244ee to df58d27 Compare September 11, 2026 15:05
@steipete
steipete merged commit 06985f9 into main Sep 11, 2026
174 checks passed
@steipete
steipete deleted the codex/github-oauth-prefix-scan-20260911 branch September 11, 2026 15:34
@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

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