Skip to content

refactor(agents): consolidate transcript-tail model selection - #157382

Merged
vincentkoc merged 1 commit into
mainfrom
refactor/model-selection-transcript-tail-20260924
Sep 24, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor/model-selection-transcript-tail-20260924

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

Command model selection duplicated transcript-tail resolution across the stored-session and fallback paths, making the routing and authority rules harder to maintain.

User Impact

No user-visible behavior change. Session routing, suppressed store access, explicit-entry precedence and the operator-authority check remain unchanged. No configuration, storage schema or public API changes.

Why This Change Was Made

Use one resolver call with the existing keyed-store decision. Preserve empty-string keys, the selected attempt entry and the authority recheck after the lazy loader. Production code shrinks by 9 lines; tests add 109 lines covering 14 routing and authority cases.

Evidence

  • Baseline and candidate each passed the same 35 configured-selection cases, 9 differential cases and 1 real transcript-resolver case: 90 case executions, no failures or skips. Candidate configured-suite wall time was 29.00 s; this is a verification sample, not a performance claim.
  • Targeted formatting, privacy checks, scoped independent review and core production types passed. The original changed-check run completed 18 stages and 9 of 25 core test-type graphs before a remote connection failure (exit 255). These results are retained; the run is not represented as fully green.
  • The two guards outside normal hosted coverage passed separately: the canonical media-download helper check locally, and check:runtime-sidecar-loaders on a fresh pinned remote install. Source guards passed and the remote lease stopped successfully.
  • Personally inspected the Codex rust-v0.155.1 contracts in codex-rs/app-server-protocol/src/protocol/v2/thread.rs (62–159, 335–410) and codex-rs/app-server/src/request_processors/thread_processor.rs (554–576, 3641–4219), alongside OpenClaw's resolver, command caller and Codex thread-request bridge. Routing keys remain distinct from native thread IDs and rollout paths.

Remaining gate: exact-head hosted CI must cover the outstanding core type graphs and remaining canonical checks before landing. No live-session or runtime-speedup claim. Build/module and published-surface boundaries are unchanged.

@vincentkoc vincentkoc self-assigned this Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 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 marked this pull request as ready for review September 24, 2026 15:54
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S labels Sep 24, 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 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 24, 2026, 12:01 PM ET / 16:01 UTC.

ClawSweeper review

What this changes

The branch replaces two transcript-routing call paths in embedded agent model selection with one and adds tests for session routing and operator authority.

Merge readiness

✅ Ready for maintainer review

Keep open: current main still contains the duplicated path, and the focused PR remains useful. Source review found no concrete regression.

Priority: P3
Reviewed head: a6d31849c20889401c7d813aa1264abd3fa8615f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused simplification with relevant boundary coverage and no source-proven defect; ordinary exact-head CI remains pending.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored internal refactor is exempt from the external contributor runtime-proof gate. The PR reports before-and-after selector tests using the real transcript resolver but makes no live-session claim; the diff changes no stored-data contract.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored internal refactor is exempt from the external contributor runtime-proof gate. The PR reports before-and-after selector tests using the real transcript resolver but makes no live-session claim; the diff changes no stored-data contract.
Evidence reviewed 8 items Introduced change: The pinned PR diff replaces the conditional two-call transcript resolution with one call while retaining the post-loader operator check.
Current resolver contract: The resolver returns the supplied session key as a process-local routing token and prefers an explicit entry over an entry from the keyed store. This makes the removed second call unreachable for a nonempty keyed session under the current contract.
Still needed on main: Fetched current main retains the conditional two-call path, so the central cleanup has not already landed.
Findings None None.
Security None None.

How this fits together

Agent command model selection prepares the model and session context for an embedded run. A transcript resolver returns the routing token and session entry passed to the run attempt.

flowchart LR
A[Agent command and session] --> B[Model selection]
P[Operator policy] --> B
B --> C{Keyed store usable?}
C --> D[Transcript resolver]
D --> E[Routing token and session entry]
E --> F[Embedded run attempt]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -9, Tests +109. Total +100 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 17 26 -9
Tests 1 109 0 +109
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 126 26 +100

Review metrics

Metric Value Why it matters
Production versus test LOC production -9, tests +109 The runtime path shrinks while the added routing matrix accounts for the codebase growth.

Technical review

Best possible solution:

Keep the transcript resolver as the single routing owner, with focused coverage for keyed-store isolation, explicit-entry precedence, and authority rechecks.

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

Not applicable: this is a refactor rather than a reported failure; the duplicated calls are visible in current-main source.

Is this the best way to solve the issue?

Yes: one call to the existing resolver is a narrow simplification under its current routing-token contract, and the keyed-store and operator checks remain in place.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 057a032fe19e.

Labels

Label changes:

  • add P3: This is a focused internal cleanup with no claimed 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 MEMBER-authored internal refactor is exempt from the external contributor runtime-proof gate. The PR reports before-and-after selector tests using the real transcript resolver but makes no live-session claim; the diff changes no stored-data contract.

Label justifications:

  • P3: This is a focused internal cleanup with no claimed 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 MEMBER-authored internal refactor is exempt from the external contributor runtime-proof gate. The PR reports before-and-after selector tests using the real transcript resolver but makes no live-session claim; the diff changes no stored-data contract.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Shakker: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Josh Lehman: 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.

@vincentkoc
vincentkoc merged commit 43d35bd into main Sep 24, 2026
268 checks passed
@vincentkoc
vincentkoc deleted the refactor/model-selection-transcript-tail-20260924 branch September 24, 2026 16:27
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Sep 24, 2026
* commit '9a1a6f7db9783d0b8abaf918bfe12978ea745b57': (26 commits)
  fix(maintainer): restore cold PR worktree provisioning (#157394)
  feat(ios): establish native Cloudflare Access sign-in sessions (#146996)
  fix: restore the Gateway after interrupted Doctor maintenance (#156854)
  refactor(line): retire the Express webhook adapter (#157369)
  refactor(cron): consolidate unavailable delivery targets (#157393)
  ci: apply Go memory defaults to architecture checks
  fix(cli): preserve the first PowerShell completion test failure (#157267)
  refactor(agents): consolidate transcript-tail model selection (#157382)
  fix(release): honor frozen validation contracts (#157034)
  fix(perf): use settled Kova terminal CPU accounting (#157029)
  chore(windows): verify packaged repair worker lifecycle (#157047)
  refactor(logging): share memory pressure threshold selection (#157164)
  fix(release): verify bundled fs-safe native bindings (#157027)
  perf(skills): skip warm prompt search when minimum cannot fit (#157343)
  fix(ui): avoid retaining detached tooltip anchors (#157226)
  perf(ci): reuse compiler state and shorten guard and UI tests (#157265)
  perf(ui): preserve model caches on unrelated metadata updates (#157254)
  chore: remove the tracked PR-body artifact and ignore .artifacts (#157296)
  refactor: consolidate duplicate MCP lifecycle tests (#157360)
  test(qa): consolidate CLI runtime fixtures (#118496)
  ...
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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