Skip to content

fix: avoid prompt-derived worktree branch names - #153455

Merged
steipete merged 3 commits into
mainfrom
codex/session-title-branch-names
Sep 20, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/session-title-branch-names

Conversation

@steipete

@steipete steipete commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Related: #131480 and #131582.

What Problem This Solves

Fixes new worktree branches retaining a slug of the opening prompt when automatic session naming fails or misses the worktree title deadline, even after the sidebar receives a useful title.

User Impact

New worktrees use a saved or generated session title when available, otherwise a two-word crustacean name. Failed automatic session naming uses that same fallback. Explicit names and existing branches remain unchanged; a late title can still update the sidebar without renaming the branch.

Why This Change Was Made

The canonical title owner no longer saves prompt-derived text after model failure, and both synchronous and deferred worktree preparation stop passing raw title-source text to the branch allocator. Existing title sharing, the 30-second wait, collision handling, and publication ownership remain intact.

This is a focused fallback repair. The broader proposal in #131582 to choose and persist a separate publication destination remains outside this change. No schema migration is required.

Evidence

  • The new title-failure, empty-output, and late-fallback assertions failed on the original implementation and passed after the fix.
  • 81 focused tests passed on Blacksmith Testbox for the initial candidate 7f67d3efe33e, covering actual Git worktree creation through sessions.create, successful and failed naming, creation without an initial title, naming lifecycle/cancellation, retries, and branch collisions.
  • Testbox tbx_01m2yg1q64g6jy0t3d1tz3f416 completed with exit 0 and was stopped: run. The delegated Testbox result is authoritative; its backing Actions step can show cancellation after lease cleanup.
  • check:changed, the two changed docs' MDX checks, git diff --check, and independent review passed.
  • The complete generator-error and title-wait recovery cases now live in the focused title suite. All 3 focused recovery/no-initial-turn cases passed after consolidation, including saved fallback names and branch stability after a late title; fresh independent review and the line-cap guard passed.
  • CI exposed the legacy raw-prompt assertions corrected here and two upstream integration problems. The rebase incorporates the existing database-fixture lifetime fix from fix: stabilize database lifecycle test fixtures #153479. One model-runtime test now imports its replacement factory from the lifecycle owner, matching the production move. No assertions, timeouts, or production behavior were weakened.
  • On the refreshed base, 7 focused naming/model-runtime tests, the Doctor database-byte/schema invariant, the agents-root typecheck, and fresh independent review passed. git range-diff confirms both naming commits were unchanged by the rebase.
  • An existing lifecycle test timed out in a heavily loaded local run; the same test passed in 6.4 seconds on Testbox. No timeout or assertion was weakened.

Focused command:

node scripts/run-vitest.mjs \
  src/gateway/dashboard-session-title.test.ts \
  src/gateway/server.sessions.create.titles.test.ts \
  src/gateway/dashboard-session-title.source-lifecycle.test.ts \
  src/agents/worktrees/service.naming.test.ts

Before and after: failed automatic naming

Inspected synthetic rendering proof on source 8c5afd5af32409aa77311354ff188667d1d4c466. The real Control UI uses maintained mock Gateway contracts and the same synthetic opening prompt. The before values come from the legacy deriveGoalSessionTitle fallback; the after values come from the current createCrustaceanSlug fallback, with both branches formed by the production worktree slugifier. No real user data or provider credentials are present. These captures demonstrate rendering; the registered sessions.create tests above prove failure selection, persistence, and actual Git allocation. Both captures were also delivered in the originating chat.

Before:

Before: failed naming retains the opening prompt in the sidebar and branch

After:

After: failed naming uses the neutral two-word mild-claw title and branch

Required CI passed for 8c5afd5af32409aa77311354ff188667d1d4c466: CI run.

@clawsweeper

clawsweeper Bot commented Sep 20, 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 docs Improvements or additions to documentation gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 20, 2026
@steipete
steipete marked this pull request as ready for review September 20, 2026 05:38
@steipete steipete self-assigned this Sep 20, 2026
@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 20, 2026
@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 20, 2026, 3:51 AM ET / 07:51 UTC (Revision 4).

ClawSweeper review

What this changes

The PR replaces raw-prompt fallback session and worktree names with neutral crustacean names, updates documentation and regression coverage, and corrects a test import.

Merge readiness

✅ Ready for maintainer review

The fix remains necessary on current main. No actionable patch defect was found, and the newly inspected screenshots resolve the previous visual-proof request.

Priority: P2
Reviewed head: 8c5afd5af32409aa77311354ff188667d1d4c466

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regression coverage and inspected visual evidence; no blocking findings remain.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The maintainer-authored PR is exempt from the external-contributor runtime gate. Inspected synthetic Control UI screenshots satisfy the visual request; registered sessions.create tests supplement them for persistence and Git allocation, without claiming live provider proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR is exempt from the external-contributor runtime gate. Inspected synthetic Control UI screenshots satisfy the visual request; registered sessions.create tests supplement them for persistence and Git allocation, without claiming live provider proof.
Evidence reviewed 9 items Current main still needs the repair: Fetched main retains the prompt-derived title fallback and passes pending.titleSource or source into both worktree preparation paths when no title exists.
Latest release retains the fallback: The v2026.9.5 title owner still calls deriveGoalSessionTitle on the opening-message source. The release source was successfully inspected through GitHub after local historical-object retrieval failed.
Canonical fallback owner: The title owner now returns the existing crustacean slug after failed or empty naming. Speculative naming, explicit-name guards, session-generation checks, and late-title persistence remain intact. This fallback decision is implemented in OpenClaw and does not depend on a Codex runtime contract.
Findings None None.
Security None None.

How this fits together

The Gateway generates session titles from opening messages and supplies names to the managed Git worktree allocator. Saved titles appear in the sidebar, while allocated branches remain stable when titles arrive later.

flowchart TD
  A[New session request] --> B[Explicit name available]
  B -->|Yes| E[Worktree allocator]
  B -->|No| C[Automatic title generation]
  C -->|Available| D[Saved session title]
  C -->|Failure or wait expires| F[Neutral crustacean fallback]
  D --> E
  F --> E
  D --> G[Session sidebar]
  E --> H[Stable Git branch]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -2, Tests +61, Docs +6. Total +65 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 3 6 8 -2
Tests 4 141 80 +61
Docs 2 7 1 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 154 89 +65

Review metrics

None.

Technical review

Best possible solution:

Use the existing neutral-name allocator when automatic naming is unavailable, preserve established branch identities, and keep publication-destination changes separately scoped.

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

Yes, by source: create an unnamed worktree session and make naming fail or exceed its wait; current main passes the raw source to the branch allocator. No runtime reproduction was executed in this review.

Is this the best way to solve the issue?

Yes. The patch repairs the title producer and both allocation callers while reusing existing naming, collision handling, and persistence guards.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The maintainer-authored PR is exempt from the external-contributor runtime gate. Inspected synthetic Control UI screenshots satisfy the visual request; registered sessions.create tests supplement them for persistence and Git allocation, without claiming live provider proof.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This repairs confusing automatic session and branch names without changing existing checkouts or blocking core workflows.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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-authored PR is exempt from the external-contributor runtime gate. Inspected synthetic Control UI screenshots satisfy the visual request; registered sessions.create tests supplement them for persistence and Git allocation, without claiming live provider proof.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The maintainer-authored PR is exempt from the external-contributor runtime gate. Inspected synthetic Control UI screenshots satisfy the visual request; registered sessions.create tests supplement them for persistence and Git allocation, without claiming live provider proof.

Evidence

What I checked:

  • Current main still needs the repair: Fetched main retains the prompt-derived title fallback and passes pending.titleSource or source into both worktree preparation paths when no title exists. (src/gateway/server-methods/session-create-project.ts:376, 86f19c734de5)
  • Latest release retains the fallback: The v2026.9.5 title owner still calls deriveGoalSessionTitle on the opening-message source. The release source was successfully inspected through GitHub after local historical-object retrieval failed. (src/gateway/dashboard-session-title.ts:226, ec9c1a13db89)
  • Canonical fallback owner: The title owner now returns the existing crustacean slug after failed or empty naming. Speculative naming, explicit-name guards, session-generation checks, and late-title persistence remain intact. This fallback decision is implemented in OpenClaw and does not depend on a Codex runtime contract. (src/gateway/dashboard-session-title.ts:229, 8c5afd5af324)
  • Existing allocation and upgrade behavior: Both preparation paths remove only raw-source fallback labels. The allocator still prioritizes explicit names, reuses existing owner-bound worktrees, generates neutral defaults, and resolves collisions; no schema or existing branch is rewritten. (src/gateway/session-worktree-preparation.ts:619, 8c5afd5af324)
  • Regression coverage through session creation: The focused suite invokes sessions.create with real Git allocation and mocked naming responses. It checks generator failure, the 30-second wait, saved fallback titles, unchanged branches after late titles, and creation without an initial turn. These tests were inspected, not executed during this read-only review. (src/gateway/server.sessions.create.titles.test.ts:255, 8c5afd5af324)
  • Previous screenshot request addressed: Inspected both downloaded PR images: the before capture shows the opening prompt in the sidebar and branch; the after capture shows mild-claw and openclaw/mild-claw while preserving the message. The captured PR body attributes these to synthetic rendering on the reviewed head and states both were delivered in the originating chat. They prove visible rendering, not live provider failure or Git allocation. (8c5afd5af324)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; 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 (3 earlier review cycles)
  • reviewed 2026-09-20T05:45:00.543Z sha 7f67d3efe33e0c29f833e280eb9564674e361745 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-20T06:35:16.353Z sha eec844fcc0828d7ebd005cb16dd9588925c0b404 :: needs changes before merge. :: none
  • reviewed 2026-09-20T07:14:28.111Z sha 8c5afd5 :: needs changes before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 20, 2026
Prefer the generated session title and use the existing two-word crustacean fallback when automatic naming fails or times out. Remove raw title-source fallback from both worktree preparation paths while preserving explicit names and existing branches.

Validation: 81 focused tests on Blacksmith Testbox, changed-file checks, docs MDX checks, and independent review passed. Related: #131480 and #131582.
Move generator-failure and title-wait recovery cases into the focused title suite. Assert the two-word fallback, saved fallback title, and stable branch after a late title. Remove duplicate success and failure cases while retaining no-initial-turn coverage.

Validation: three focused recovery cases, formatting, line-cap checks, and fresh independent review passed.
Follow the factory move on main in the settled-replacement regression, preserving every assertion and the existing production owner.

Validation: four model-runtime cases, three naming recovery cases, the Doctor database invariant, the agents-root typecheck, and fresh independent review passed.
@steipete
steipete force-pushed the codex/session-title-branch-names branch from eec844f to 8c5afd5 Compare September 20, 2026 07:07
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Sep 20, 2026
@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 20, 2026
@steipete
steipete merged commit d0b8dbe into main Sep 20, 2026
230 checks passed
@steipete
steipete deleted the codex/session-title-branch-names branch September 20, 2026 08:06
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

steipete added a commit that referenced this pull request Sep 20, 2026
Follow up #153455 by centralizing joined title settlement and retries, reusing the async-resource owner for failure cleanup, and sharing discussion RPC handling. Preserve generated titles, two-word fallbacks, bounded waits, and source authority. Remove 103 net production lines.
steipete added a commit that referenced this pull request Sep 20, 2026
* refactor: consolidate session title request ownership

Follow up #153455 by centralizing joined title settlement and retries, reusing the async-resource owner for failure cleanup, and sharing discussion RPC handling. Preserve generated titles, two-word fallbacks, bounded waits, and source authority. Remove 103 net production lines.

* test: retain subagent fixture state through cleanup

The full Gateway agent suite reproduced a native-child RPC rejection because a preceding plugin fixture removed its database while an asynchronous worker was opening it. Reuse the canonical test-state fixture for the two leaking cases. Keep assertions, test order, timeouts, and production identity checks unchanged; the exact-merge Linux replay now passes 352 tests with no identity rejection.

* test: prepare checkpoint history before the attempt deadline

* test: bind ACP fixture cleanup to its state directory

* test: import subagent bindings from their codec owner

Use the extracted codec in the task-identifier regression without restoring a competing re-export. Incorporates the matching correction from #154048.

Co-authored-by: VACInc <[email protected]>

---------

Co-authored-by: VACInc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 21, 2026
* fix: avoid prompt-derived worktree branch names

Prefer the generated session title and use the existing two-word crustacean fallback when automatic naming fails or times out. Remove raw title-source fallback from both worktree preparation paths while preserving explicit names and existing branches.

Validation: 81 focused tests on Blacksmith Testbox, changed-file checks, docs MDX checks, and independent review passed. Related: openclaw#131480 and openclaw#131582.

* test: preserve worktree naming recovery coverage

Move generator-failure and title-wait recovery cases into the focused title suite. Assert the two-word fallback, saved fallback title, and stable branch after a late title. Remove duplicate success and failure cases while retaining no-initial-turn coverage.

Validation: three focused recovery cases, formatting, line-cap checks, and fresh independent review passed.

* test: use lifecycle owner for model replacement fixture

Follow the factory move on main in the settled-replacement regression, preserving every assertion and the existing production owner.

Validation: four model-runtime cases, three naming recovery cases, the Doctor database invariant, the agents-root typecheck, and fresh independent review passed.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 21, 2026
* refactor: consolidate session title request ownership

Follow up openclaw#153455 by centralizing joined title settlement and retries, reusing the async-resource owner for failure cleanup, and sharing discussion RPC handling. Preserve generated titles, two-word fallbacks, bounded waits, and source authority. Remove 103 net production lines.

* test: retain subagent fixture state through cleanup

The full Gateway agent suite reproduced a native-child RPC rejection because a preceding plugin fixture removed its database while an asynchronous worker was opening it. Reuse the canonical test-state fixture for the two leaking cases. Keep assertions, test order, timeouts, and production identity checks unchanged; the exact-merge Linux replay now passes 352 tests with no identity rejection.

* test: prepare checkpoint history before the attempt deadline

* test: bind ACP fixture cleanup to its state directory

* test: import subagent bindings from their codec owner

Use the extracted codec in the task-identifier regression without restoring a competing re-export. Incorporates the matching correction from openclaw#154048.

Co-authored-by: VACInc <[email protected]>

---------

Co-authored-by: VACInc <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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