Skip to content

refactor: consolidate session selection result classification - #146983

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/resume-session-candidate-selection-20260913
Sep 13, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/resume-session-candidate-selection-20260913

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Sep 13, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Session selection repeats the same result classification for substring and fuzzy matches.

User Impact

No user-visible behavior changes. Exact keys still win, nonempty substring matches retain input order, and fuzzy matching runs only when there are no substring matches.

Why This Change Was Made

Select the existing candidate list lazily, then classify it once. Production changes: −5 lines; tests: +16 lines.

Evidence

  • 2,176 before/after comparisons matched complete result metadata and builder/fuzzy call sequences across session subsets, orderings and queries. This uses the actual resolver with a prepared-choice boundary and the actual canonical string normalizer and fuzzy implementation; it does not claim Gateway or interactive TUI execution.

  • Two public regression rows distinguish ambiguous substring matches from fuzzy-only candidates and preserve fuzzy result ordering. Both rows passed in the complete 45-case resume CLI suite; selected pinned type/lint/format checks passed.

  • The installed fuzzy implementation was directly checked against the requested upstream version's source. This verifies that algorithm only; the borrowed dependency installation is otherwise incompatible with this checkout, so package-backed proof remains hosted.

  • Root and independent source review, fresh P2 autoreview, diff checks and normal commit formatting passed.

  • Exact-head CI attempt 34755055350/1 and aggregate gate passed. The complete resume CLI suite passed all 45 cases, and the selected TUI group passed 1,615 tests. The latest exact-head review has no findings, before-merge items or rank-up requests. Hosted fixture execution does not claim a live Gateway or interactive terminal session.

@clawsweeper

clawsweeper Bot commented Sep 13, 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.

@vincentkoc vincentkoc self-assigned this Sep 13, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review September 13, 2026 11:40
@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: XS maintainer Maintainer-authored PR labels Sep 13, 2026
@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 13, 2026
@clawsweeper

clawsweeper Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

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

ClawSweeper review

What this changes

The PR consolidates session-match classification while preserving matching precedence and adds tests for ambiguous candidate ordering.

Merge readiness

✅ Ready for maintainer review

No actionable defects found. This remains a useful, behavior-preserving cleanup absent from inspected main and the latest release; its member authorship and protected label also rule out automatic closure.

Priority: P3
Reviewed head: d0afb035df7f2c56a1ceb6a21df302f909e6d87b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable refactor with useful ordering coverage, successful pinned CI, and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The member-authored internal refactor is exempt from contributor live-proof requirements; reported resolver comparisons and hosted tests support equivalence but do not establish interactive Gateway/TUI execution.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The member-authored internal refactor is exempt from contributor live-proof requirements; reported resolver comparisons and hosted tests support equivalence but do not establish interactive Gateway/TUI execution.
Evidence reviewed 10 items Pinned introduced change: The merge-base-to-head diff matches the supplied introduction evidence. Candidate selection remains lazy, exact matching returns first, substring order is preserved, and fuzzy results are classified without reordering.
Production caller and documented contract: The CLI calls the resolver for a nonempty positional query, reports ambiguous or absent matches, and launches the TUI only for a unique match. docs/cli/resume.md documents this existing precedence and failure behavior; connection, authorization, handoff, and persistence paths are unchanged.
Focused behavioral coverage: The added table rows protect substring-only candidate membership and input order, plus fuzzy score order. They extend the existing resolver table without introducing production test seams.
Findings None None.
Security None None.

How this fits together

The resume command matches a user's query against recent sessions returned by the Gateway. The result determines whether OpenClaw opens the terminal UI for one session or prints ambiguity or no-match guidance.

flowchart TD
  A[User session query] --> C[Session matching]
  B[Recent Gateway sessions] --> C
  C --> D[Exact key first]
  D --> E[Substring candidates or fuzzy fallback]
  E --> F[Classify candidates]
  F --> G[Open selected session]
  F --> H[Print matching guidance]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -5, Tests +16. Total +11 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 9 14 -5
Tests 1 16 0 +16
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 25 14 +11

Review metrics

None.

Technical review

Best possible solution:

Keep one result-classification block in the existing resolver, preserving exact-key precedence, substring ordering, and lazy fuzzy fallback.

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

Not applicable: the PR claims no behavior defect; source inspection supports equivalence of the old and new classification paths.

Is this the best way to solve the issue?

Yes: selecting the existing candidate array once removes duplicate classification without adding another owner or changing the matching contract.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a small internal simplification with unchanged user behavior.
  • 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 member-authored internal refactor is exempt from contributor live-proof requirements; reported resolver comparisons and hosted tests support equivalence but do not establish interactive Gateway/TUI execution.

Evidence

What I checked:

  • Pinned introduced change: The merge-base-to-head diff matches the supplied introduction evidence. Candidate selection remains lazy, exact matching returns first, substring order is preserved, and fuzzy results are classified without reordering. (src/tui/tui-session-picker.ts:75, d0afb035df7f)
  • Production caller and documented contract: The CLI calls the resolver for a nonempty positional query, reports ambiguous or absent matches, and launches the TUI only for a unique match. docs/cli/resume.md documents this existing precedence and failure behavior; connection, authorization, handoff, and persistence paths are unchanged. (src/cli/resume-cli.runtime.ts:224, d0afb035df7f)
  • Focused behavioral coverage: The added table rows protect substring-only candidate membership and input order, plus fuzzy score order. They extend the existing resolver table without introducing production test seams. (src/cli/resume-cli.test.ts:133, d0afb035df7f)
  • Current main still contains duplicate classification: Inspected fetched main retains separate substring and fuzzy classification blocks, so the proposed consolidation remains outstanding. (src/tui/tui-session-picker.ts:90, 5541c3d396ab)
  • Latest-release comparison: The supplied latest release, v2026.9.4, also retains separate classification blocks. This PR is cleanup of existing behavior, not a missing user capability or a shipped bug fix. (src/tui/tui-session-picker.ts:90, 3a9d69db306c)
  • Matching dependency boundary: The resolver directly imports fuzzyFilter from @earendil-works/pi-tui, pinned to 0.85.1 in package.json. This establishes a Pi TUI dependency contract; no changed behavior depends on the Codex harness. (src/tui/tui-session-picker.ts:2, d0afb035df7f)

Likely related people:

  • Peter Steinberger: Raw commit 917fd92 adds src/tui/tui-session-picker.ts:75 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 917fd92686c5; files: src/tui/tui-session-picker.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 (1 earlier review cycle)
  • reviewed 2026-09-13T11:46:52.873Z sha d0afb03 :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc merged commit adb6e51 into main Sep 13, 2026
259 checks passed
@vincentkoc
vincentkoc deleted the refactor/resume-session-candidate-selection-20260913 branch September 13, 2026 17:21
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 13, 2026
* commit '201f11afefdb19a9c75e9d3542bf7425c80df7a7': (141 commits)
  fix: keep catalog discovery scoped and execution lazy (#147159)
  fix: serialize reclamation worker shutdown with foreground writes (#147178)
  test(sessions): cover abrupt committed transcript recovery (#143984)
  fix: stop transcript storms during context overflow recovery (#147202)
  fix: reduce CPU overhead for small history and usage reads (#147205)
  fix: resume tasks after tools finish and the model times out (#147203)
  refactor(scripts): share SQLite reliability message waits (#146900)
  feat(exec): configure approval reviewer thinking and fastMode (#147192)
  test: remove redundant Bonjour module headers (#146981)
  refactor: share streaming media tail boundary update (#146989)
  refactor(tui): classify resume candidates once (#146983)
  improve: skip unused toast dismissal work (#147196)
  fix(linux): recover saved remote connections without replacing active sessions (#146047)
  fix: doctor stays silent when Windows state dir is under OneDrive (#123720)
  feat: announce successful Daybreak retries (#147146)
  feat(code-mode): reuse results across code cells (#147154)
  refactor(test): reuse CLI plugin fixture writer (#147186)
  test: skip unused compiler setup in routing fixtures (#147194)
  test: reuse LINE webhook runtime fixture (#146710)
  fix(code-mode): check automation and process result types (#147143)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes 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