Skip to content

refactor: consolidate session title request ownership - #153871

Merged
steipete merged 5 commits into
mainfrom
codex/session-naming-owner
Sep 20, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/session-naming-owner

Conversation

@steipete

@steipete steipete commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Related: #153455, #154048

What Problem This Solves

The session-naming fix still spread request settlement and cleanup across callers, making late completion and cancellation harder to maintain. This consolidates that ownership and removes 103 net production lines.

User Impact

No user-visible or configuration change: generated titles, two-word fallback names, manual names, and existing Git branches keep their behavior. Worktree and discussion waits remain bounded without canceling shared naming.

Why This Change Was Made

The naming owner handles joins and the single dashboard retry; only the writer reports persistence. The existing async-resource owner cancels and drains failed naming work, replacing a separate scope and abort-listener implementation. Discussion info/open share validation and provider error handling.

CI also exposed fixture problems. Two Gateway fixtures now use canonical state cleanup, with the ACP fixture passing its state directory to the existing child-lifetime owner. The Codex checkpoint fixture prepares its existing history reader before starting the timed attempt. Assertions and deadlines are unchanged. A stale migration-test import now uses the extracted codec owner; thanks @VACInc for the matching correction in #154048.

No schema, database version, saved session shape, or wire protocol changes. The title persistence/source-guard block is unchanged and still writes only displayName; the replaced result union and cancellation option are process-local. Source authority is reacquired before persistence. Existing saved names need no migration.

Evidence

  • 107 focused tests passed across naming, source lifecycle, discussion RPCs, real Gateway creation, and the local OpenAI-compatible transport fixture. After integrating upstream resource-release changes, 66 title/lifecycle tests and 6 shared-resource tests passed again.
  • The full Gateway agent file passes 352/352 on the refreshed base; task-identifier tests pass 9/9. The final ACP callback spelling also passes its targeted case.
  • Linux proof reproduced the original SQLite fixture failure twice on the exact CI merge, then passed 352/352 with canonical cleanup. A controlled 5.1-second cold-reader delay reproduced the original checkpoint failure; the same delay passed after fixture preparation, with the attempt completing normally in 2.8 seconds. Original CI-host latency was not recorded.
  • Independent P0–P2 reviews are clean. The original complete changed-scope gate and the checkpoint-specific gate passed; the final integration gate also passed after refreshing frozen dependencies.
  • The Codex extension config groups passed in CI run 35535175767. Its other failures identified the repaired ACP binding and stale codec import; Security Review separately hit GitHub installation API rate limiting. Final-head CI run 35536602117 and the required CI gate passed; Security Review passed as well.
  • An additional Testbox replay stopped during file sync before tests started; no pass is claimed. Both task-owned leases were stopped and verified absent.

@steipete steipete self-assigned this Sep 20, 2026
@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: M maintainer Maintainer-authored PR labels Sep 20, 2026
@steipete
steipete marked this pull request as ready for review September 20, 2026 17:25
@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 20, 2026
@clawsweeper

clawsweeper Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 20, 2026, 5:15 PM ET / 21:15 UTC (Revision 4).

ClawSweeper review

What this changes

Centralizes session-title request settlement and cancellation, shares discussion request handling, corrects fallback-name documentation, and repairs test-fixture preparation and cleanup.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open as useful, distinct work with no blocking findings. The earlier migration concern does not apply to the introduced changes.

Priority: P3
Reviewed head: 731c3fc77cbd2a36830e30f1cae4a2d7056011f4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused consolidation with preserved contracts, relevant validation, and no blocking findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored internal refactor is exempt from external-contributor proof requirements and introduces no material authority expansion. Naming/lifecycle tests and exact-head CI support validation; inspected predecessor screenshots only establish fallback rendering.
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 internal refactor is exempt from external-contributor proof requirements and introduces no material authority expansion. Naming/lifecycle tests and exact-head CI support validation; inspected predecessor screenshots only establish fallback rendering.
Evidence reviewed 11 items Pinned introduction reviewed: Reviewed the complete merge-base-to-head delta. The verified test merge records the pinned base followed by the reviewed head; base-only changes were excluded from attribution.
Prior migration concern resolved by source: The persistence block still writes only displayName, checks session identity and existing names, and reacquires source custody before persistence. The introduced delta changes no schema, migration, saved-session format, or wire protocol. The prior review contained no code findings; its migration request is not retained.
Cancellation and settlement coverage: Inspected coverage for duplicate-owner cancellation, source-unwind failure, cleanup-before-rejection, late completion, single retry, and final-write authority checks. The changed lifecycle test retains its observable cancellation assertions while adapting to the settled boolean result. Tests were not executed in this read-only review.
Findings None None.
Security None None.

How this fits together

The Gateway generates session names for chat, worktree creation, and discussion opening. Shared naming work feeds guarded session updates while callers retain bounded waits.

flowchart TD
  A[Chat and worktree requests] --> C[Shared title request owner]
  B[Discussion opening] --> C
  C --> D[Model title or fallback name]
  C --> E[Cancellation and cleanup owner]
  D --> F[Current session and source checks]
  F --> G[Saved title and change notification]
  B --> H[Discussion provider]
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -103, Tests -2, Docs 0. Total -105 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 3 86 189 -103
Tests 4 12 14 -2
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 99 204 -105

Review metrics

Metric Value Why it matters
SDK contract 1 optional cleanup argument; 0 default changes The existing plugin SDK re-export exposes the additive option while retaining current callers' behavior.

Stored data model

Persistent data-model change detected: serialized state: src/gateway/dashboard-session-title.ts, serialized state: src/gateway/server-methods/session-discussion.ts, unknown-data-model-change: src/gateway/dashboard-session-title.ts, unknown-data-model-change: src/gateway/server-methods/session-discussion.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep title settlement and cancellation with their existing lifecycle owners while preserving saved names, final-write guards, and caller wait budgets.

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

Not applicable to the primary refactor. The captured body documents fixture-failure reproductions; this read-only review inspected source and existing coverage without executing tests.

Is this the best way to solve the issue?

Yes. Reusing the existing lifecycle owner removes duplicate settlement logic while retaining the persistence boundary and existing caller contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 compatibility: The shared helper is SDK-exposed; compatibility was checked against its optional argument, unchanged defaults, and maintainer-visible rationale.

Label justifications:

  • P3: This is an internal ownership cleanup with bounded fixture repairs and no intended user-visible behavior change.
  • merge-risk: 🚨 compatibility: The shared helper is SDK-exposed; compatibility was checked against its optional argument, unchanged defaults, and maintainer-visible rationale.
  • 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-authored internal refactor is exempt from external-contributor proof requirements and introduces no material authority expansion. Naming/lifecycle tests and exact-head CI support validation; inspected predecessor screenshots only establish fallback rendering.

Evidence

What I checked:

  • Pinned introduction reviewed: Reviewed the complete merge-base-to-head delta. The verified test merge records the pinned base followed by the reviewed head; base-only changes were excluded from attribution. (731c3fc77cbd)
  • Prior migration concern resolved by source: The persistence block still writes only displayName, checks session identity and existing names, and reacquires source custody before persistence. The introduced delta changes no schema, migration, saved-session format, or wire protocol. The prior review contained no code findings; its migration request is not retained. (src/gateway/dashboard-session-title.ts:346, 731c3fc77cbd)
  • Cancellation and settlement coverage: Inspected coverage for duplicate-owner cancellation, source-unwind failure, cleanup-before-rejection, late completion, single retry, and final-write authority checks. The changed lifecycle test retains its observable cancellation assertions while adapting to the settled boolean result. Tests were not executed in this read-only review. (src/gateway/dashboard-session-title.source-lifecycle.test.ts:211, 731c3fc77cbd)
  • Additive SDK option: runWithAsyncWorkResources is exposed through src/plugin-sdk/agent-harness-tool-runtime.ts. The new cancelOnError argument is optional, leaves existing callers unchanged, and is explicitly explained in the maintainer-authored PR body. No subpath or required capability is added. (src/shared/async-work-resources.ts:17, 731c3fc77cbd)
  • Still distinct from main and release: Fetched main retains the result union and caller-owned join/retry handling. The latest supplied release also lacks cancelOnError. The merged naming fix supplies existing fallback behavior, but does not implement this consolidation. (src/gateway/dashboard-session-title.ts:97, 6b1495903b21)
  • Release contract checked: Read the shared resource owner at v2026.9.5 through GitHub after the local release blob was unavailable; it has the existing one-argument contract. (src/shared/async-work-resources.ts:8, ec9c1a13db89)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • 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-20T17:32:43.118Z sha e8c14e3 :: blocked before merge. :: none
  • reviewed 2026-09-20T17:52:25.849Z sha e8c14e3 :: blocked before merge. :: none
  • reviewed 2026-09-20T19:05:51.513Z sha 65c3ad0 :: blocked before merge. :: none

steipete and others added 5 commits September 20, 2026 13:32
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.
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.
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]>
@steipete
steipete force-pushed the codex/session-naming-owner branch from 101dbcd to 731c3fc Compare September 20, 2026 20:46
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Sep 20, 2026
@steipete
steipete merged commit f8b8956 into main Sep 20, 2026
240 checks passed
@steipete
steipete deleted the codex/session-naming-owner branch September 20, 2026 21:19
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

docs Improvements or additions to documentation extensions: codex gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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