Skip to content

feat(sessions): keep useful names after context resets - #197334

Open
dankarization wants to merge 16 commits into
openclaw:mainfrom
dankarization:fix/conversation-label-refinement-20261111
Open

dankarization wants to merge 16 commits into
openclaw:mainfrom
dankarization:fix/conversation-label-refinement-20261111

Conversation

@dankarization

@dankarization dankarization commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resetting context should not destroy a useful conversation name. Commands such as /model should never become its title.

User Impact

The first real message gives a new Telegram topic or Dashboard conversation a name. This includes Telegram’s New Thread flow, where sending a message creates an implicitly named “New Chat”.

After six follow-up user messages, the utility model compares the opening message and those follow-ups with the current name. After /reset, it compares the first real message with the existing name. A fitting broad name such as “YouGile” stays exactly as it is for related work; the model replaces it only when the subject no longer fits.

Commands, bot replies and child-agent output do not count. Manual edits win over naming attempts already in flight.

Why This Change Was Made

I usually reset a topic to continue the same work with fresh context. Having to restore its old name by hand defeats that workflow.

Naming now starts from approved, recorded user input, without waiting for the agent’s answer. Blocked or hidden input cannot trigger it. Queued messages count individually when their approved text is unchanged; if a hook rewrites the combined input, only that approved result is used. Opening media stays associated with its accepted message.

Related: #184821, #174317, #183368. Reassessing a manually chosen title changes the stable-title policy from #185337 and needs a maintainer decision.

Evidence

The approved-input follow-up passed 113 focused tests in six files, core types, five affected test type graphs, scoped lint, formatting and line budgets. It was then merged with main at e60207216. On the resulting tree 9f86524d, 36 transcript and queue tests, core types, formatting and scoped typed lint passed. An independent review of the three manual conflict resolutions found no P0–P2 issues. A later test-only follow-up removes duplicated fixtures while retaining the in-flight “New Chat” race: 15 lifecycle tests, formatting and the test-line budget against frozen e602 passed. Hosted CI for the current head is separate.

These screenshots are from the earlier integrated build b2b6eb7, not this public head:

First real message:

Automatic title after the first user message

Reset, model selection and the same subject:

The existing title remains for the same subject

Reset and a different subject:

A new title for a different subject

Messages, timings and limits.

The lifecycle retains bounded excerpts of the opening input and up to six follow-ups; that retention proposal needs maintainer review. Older lifecycles without those excerpts use a bounded transcript fallback. Delayed Telegram title edits retain the existing arrival-order behavior; the original live manual-rename mismatch was not captured well enough to prove its cause.

The behavior is now running in my local integration 644e178; that build also carries other patches. This is separate from exact-public-head live acceptance and hosted CI. The manual-title policy and bounded input retention still need maintainer review.

@clawsweeper

clawsweeper Bot commented Nov 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 docs Improvements or additions to documentation channel: telegram Channel integration: telegram gateway Gateway runtime size: XL labels Nov 11, 2026
@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Nov 11, 2026
@dankarization
dankarization marked this pull request as ready for review November 11, 2026 18:53
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-11T19:09:18.996412Z 6abe1d3 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6abe1d3818

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@@ -67,9 +73,12 @@ export function scheduleChatDashboardSessionTitle(
cfg: params.cfg,
agentId: params.agentId,
sessionId: params.admittedSessionId,
lifecycleRevision,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Pass the Talk session revision to the title scheduler

For Talk voice transcripts on a session with a stored lifecycle revision, appendTalkClientTranscript (talk/client-transcript.ts:30-36) still calls this scheduler without entry. This now forwards an own lifecycleRevision property whose value is undefined, so the new Object.hasOwn guard in maybeGenerateSessionTitle rejects the live row before doing any title work. Voice-only Dashboard/iOS/node conversations therefore stop receiving opening titles, and post-reset reassessments never run. Update the Talk caller to pass its already-read entry so the captured revision reaches the title writer.

Useful? React with 👍 / 👎.

Comment on lines +93 to +94
if (current.label?.trim()) {
patch.label = name;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate label ownership before persisting a reassessed name

During a reset or six-message reassessment, if the model proposes a name already used as another session's custom label in the same store, this assignment creates duplicate labels. It bypasses the existing isLabelInUse check in applySessionsPatchDisplayMetadata, and the SQLite label index is non-unique, so the write succeeds. Subsequent sessions.resolve({ label: ... }) requests then fail with Multiple sessions found with label (sessions-resolve.ts:599-602). Apply the existing label-claim validation before changing label, or retain the current label when the generated name is occupied.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 11, 2026
@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR reassesses Dashboard and Telegram conversation names after reset and six follow-up tasks, including manually chosen names.

Example: Reset a conversation named Email, then ask to plan a Lisbon trip.

  • Before: The existing title remains Email.
  • After: The utility model compares the existing title with the task and may replace it with Lisbon trip.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful Telegram live evidence supports part of the proposal, but the custom-label defect, unresolved naming policy, and missing existing-state upgrade proof prevent readiness; the new persisted fields are conversationLabelRefinement and topic-cache labelState/nameRevision.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Users continuing an ongoing conversation want useful names retained across context resets and reconsidered when the subject changes.
Reason: Current main already preserves names across resets and deliberately keeps Dashboard titles stable; reinstating refinement and including manual names is a product choice acknowledged by the author.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep this PR open for an owner decision: it deliberately revisits the stable-title policy, and Telegram custom-label replacement still has a correctness defect.

Priority: P2
Reviewed head: 3ebc991a6c2278ebe60996a77dcba45b7bd7ec8a
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should automatic naming reassess existing and manually chosen titles after reset and six follow-up tasks, reversing the stable-title policy and adding the supporting SDK contract?
  • Recommendation: Preserve stable titles: Retain the current explicit-rename policy and consider the Telegram first-message repair separately.
  • Why: fix: keep session titles stable after the opening task #185337 deliberately removed automatic refinement, and this PR explicitly acknowledges that its broader policy has no maintainer approval.

Before merge

  • Add real behavior proof - The inspected installed-Gateway report and Telegram captures support first-message naming and same-subject, different-subject, and manual-title reset cases on integrated build b2b6eb7. The prepared Dashboard images are historical, and current Dashboard reassessment and rejection of pending inference after a manual rename remain unshown. Scratch writes were refused, so additional captures were inspected in memory through GitHub reads; that reviewer limitation does not discount the supplied Telegram evidence. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Claim custom-label ownership before Telegram replaces a label (P2) - This earlier finding remains unresolved. If a Telegram session has custom label Email, another session in the same store has label Lisbon trip, and reset reassessment returns Lisbon trip, this assignment persists a duplicate custom label. prepareSessionEntryPatch performs no label claim, and sessions.resolve({label: "Lisbon trip"}) then fails with Multiple sessions found with label. Reuse the canonical label-claim operation before replacing the custom label, retaining the current title when the proposed label is occupied; check this before editing the remote topic so both surfaces remain consistent.
  • Complete next step - The contributor should resolve GitHub’s reported merge conflict and run the checks affected by that integration.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

  • [P2] Claim custom-label ownership before Telegram replaces a label — extensions/telegram/src/bot-message-dispatch-topic-label.ts:260-262
  • [P3] Separate the unrelated SQLite proof and CLI fixture repairs — test/helpers/sqlite-flip-proof-races.ts:19-23

Tests

  • Low-value test src/auto-reply/reply/conversation-label-refinement.test.ts: The helper-level countdown, batch, and reset scenarios repeat the added production-owner tests; consolidate duplicate cases and retain only distinct exported-contract coverage.
  • Missing end-to-end proof: Provide current Dashboard reassessment and pending-result rejection after a manual rename through the running product; retain red/green regression evidence and redact credentials, IPs, phone numbers, and non-public endpoints.
Agent review details

How this fits together

Dashboard messages, Talk transcripts, and Telegram topic messages enter the existing naming owners, which call the utility model and persist session presentation and naming lifecycle metadata.

flowchart TD
  A[Dashboard and Talk input] --> C[Dashboard naming owner]
  B[Telegram recorded input] --> D[Telegram naming owner]
  C --> E[Shared naming planner]
  D --> E
  E --> F[Utility model comparison]
  F --> G[Session and topic persistence]
Loading

Technical review

Best possible solution:

Use the existing naming and label-claim owners for any approved lifecycle, with the first-message repair available as a smaller independent change.

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

The central request changes naming policy rather than establishing a current-main regression; the introduced Telegram collision is source-verifiable, and no target code was run.

Is this the best way to solve the issue?

The existing naming owners are appropriate, but automatic replacement of manual names needs an explicit product decision, and Telegram must share the label-claim invariant already enforced by Dashboard.

Full review comments:

  • [P2] Claim custom-label ownership before Telegram replaces a label — extensions/telegram/src/bot-message-dispatch-topic-label.ts:260-262
    This earlier finding remains unresolved. If a Telegram session has custom label Email, another session in the same store has label Lisbon trip, and reset reassessment returns Lisbon trip, this assignment persists a duplicate custom label. prepareSessionEntryPatch performs no label claim, and sessions.resolve({label: "Lisbon trip"}) then fails with Multiple sessions found with label. Reuse the canonical label-claim operation before replacing the custom label, retaining the current title when the proposed label is occupied; check this before editing the remote topic so both surfaces remain consistent.
    Confidence: 0.99
  • [P3] Separate the unrelated SQLite proof and CLI fixture repairs — test/helpers/sqlite-flip-proof-races.ts:19-23
    The previously noted scope concern remains advisory. The deletion-conflict retry, its new helper suite and allocation, and the unrelated CLI pricing fixture repair address independently reported test failures rather than conversation naming. Move those repairs to a focused PR so the naming proposal does not also change acceptance behavior in the SQLite lifecycle proof.
    Confidence: 0.97

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +778, Tests +1640, Docs +28, Other +5. Total +2451 across 55 files. Added test files: 4.

View PR surface stats
Area Files Added Removed Net
Source 27 892 114 +778
Tests 21 1746 106 +1640
Docs 4 33 5 +28
Config 0 0 0 0
Generated 0 0 0 0
Other 3 5 0 +5
Total 55 2676 225 +2451

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Conversation naming is a bounded usability improvement, with a concrete custom-label collision defect on the proposed path.
  • merge-risk: 🚨 compatibility: The PR changes documented stable-title behavior, permits replacement of manual names, and adds public SDK exports.
  • merge-risk: 🚨 session-state: Telegram automatic replacement can create duplicate persisted custom labels and make label-based session resolution ambiguous.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-11-11T19:56:04.375Z sha 6abe1d3818ac33b55f32341d1a26c99e81bad185 :: needs real behavior proof before merge. :: [P2] Pass the captured Talk entry into the title scheduler | [P2] Validate custom-label ownership before automatic replacement
  • reviewed 2026-11-11T21:04:51.674Z sha 68247c6 :: needs real behavior proof before merge. :: [P2] Pass the captured Talk entry into the title scheduler | [P2] Validate custom-label ownership before automatic replacement | [P2] Remove the private test-helper import from the Telegram test
  • reviewed 2026-11-12T06:54:55.783Z sha 3ebc991 :: needs real behavior proof before merge. :: [P2] Claim custom-label ownership before Telegram replaces a label | [P3] Separate the unrelated SQLite proof and CLI fixture repairs

Reviewed November 12, 2026, 2:13 AM ET / 07:13 UTC (Revision 4).

@dankarization
dankarization force-pushed the fix/conversation-label-refinement-20261111 branch from 6abe1d3 to 68247c6 Compare November 11, 2026 20:13
@dankarization

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated head 68247c609 resolves the conflict with current main, retains the upstream manual-edit-after-failed-label regression, and passes 15 focused Telegram tests, SDK declarations, targeted lint, formatting and the test-line budget. The PR body includes the real Telegram reset/model-selection screenshot and states the remaining live-test limits.

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 11, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 12, 2026
@clawsweeper

clawsweeper Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 12, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Nov 12, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

Fixed the remaining Telegram label collision in b946370. The topic now claims a custom label through the same storage owner as Dashboard before Telegram is renamed. If another session owns that label, both existing names stay as they are. A failed Telegram rename restores our own unchanged title write without overwriting a later reset or manual edit.

All 27 focused Telegram naming/ownership/recovery tests passed, along with core, extension and extension-test types, targeted typed lint, formatting and the test-line budget. That is local proof for this commit; I have not deployed this last repair yet.

I’m still working through the merge conflict and the separate P3 test split. The earlier live screenshots cover the first-message/reset workflow, not this new collision case.

…ersation-label-refinement-20261111

# Conflicts:
#	src/agents/cli-runner/cli-run-transcript.test.ts

dankarization commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Review follow-up for 4427d37c5: the Telegram label collision is fixed in b94637019, the conflict with main is resolved, and the unrelated SQLite proof/fixture changes have been split into #197609. That companion passed qualification on fdbc70597, including the built-CLI proof; its remaining review feedback is being addressed.

The prior head's CI job timed out in an existing native-hook relay approval test. The full file passed locally on the prior head (97/97), and the same test passed in hosted CI on this head in 173 ms. The timeout did not recur; its underlying cause remains unproven.

The current built-CLI CI proof failed because the concurrent session changed before deletion. The related fix remains in the open companion PR. Other checks are running; the product decision, current Dashboard proof, and existing-state upgrade proof remain open.

@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed agents Agent runtime and tooling labels Nov 12, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Nov 12, 2026

Copy link
Copy Markdown
Contributor Author

On current head 88f3374, the Talk transcript caller already passes the captured session entry and lifecycle revision to the title scheduler. Three focused tests passed through the transcript boundary: client speech, relay speech, and reassessment after reset. As a negative control, removing the entry made the reset test time out; the source was restored. These isolated tests use a test provider and are not live voice acceptance.

Exact-head CI run 43411084733 failed in eight jobs; the failure causes and their relationship to this PR remain unproven. The latest substantive hosted reviews predate this head. CI and review are not yet complete for readiness.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram clawtributors PR from a clawtributor docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants