Skip to content

fix(auto-reply): keep runtime-specific regular label recovery in dedup key - #174164

Merged
obviyus merged 4 commits into
openclaw:mainfrom
dankarization:fix/utility-label-runtime-dedup-20261016
Oct 22, 2026
Merged

obviyus merged 4 commits into
openclaw:mainfrom
dankarization:fix/utility-label-runtime-dedup-20261016

Conversation

@dankarization

@dankarization dankarization commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Automatic session titles can remain provisional even when the session's regular model works through its native runtime. Since #173906, the utility chain records candidates before completion. A failed utility fallback can therefore claim the same provider/model as regular recovery, even though it ran without the session's runtime override.

What Changed

Include the dispatched runtime override in label-attempt identity. Resolve each planned selection and runtime together, so a failed direct fallback does not suppress native-runtime recovery. Calls that already used the same route remain deduplicated.

The original contributor commits are preserved. Original fix by @dankarization.

The simplification removes two helper layers and keeps one attempt-resolution owner instead of separate runtime, key, and plan helpers. Against the merge base: production +51/-35 (net +16), tests +38/-0. The remaining growth carries runtime identity; there are no plugin-SDK surface changes.

Evidence

Built main d5ce64b7e2d2896425879d4bc6891d8b93fd7520 and candidate 9cef2c817d3589c24c3b748709f13b54e79892cc once each in isolated Docker with Node 24.22.1. Configuration and session state were created with shipped CLI commands and Gateway RPCs.

A local OpenAI-compatible provider preserved the exact provider/model overlap between the utility fallback and regular recovery. Sessions persisted a Codex runtime override. On main, two independent sessions kept provisional names after the utility fallback failed. A control using that same regular provider/model through Codex returned Garden planning recovery. On the candidate, both overlapping-fallback sessions and the control received Garden planning recovery; provider request logs show the failed direct regular-model request followed by successful native regular-model recovery.

The added regression fails on main for the suppressed recovery and passes on the candidate. All 40 tests across the label generator and utility-completion suites pass. The build, focused formatting check, and focused lint pass.

On the same candidate, the real OpenAI gpt-5.4-mini automatic-title path returned Plan raised beds through a newly created Gateway session.

Compatibility and Risk

No configuration, schema, or published API changes. Existing successful utility labels and same-route deduplication are preserved.

Merge danger: two-way door, reversible with an ordinary code revert. Blast radius is automatic conversation/session labeling when a utility fallback overlaps regular-model recovery across different runtimes.

@clawsweeper

clawsweeper Bot commented Oct 16, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T12:22:35.160954Z 72a3a20 New commits
ℹ️ 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.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Oct 16, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
…p key

(cherry picked from commit c75cf9ddf4daadb7e7e5d183309ba22711c09787)
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR includes the dispatched runtime in label-attempt identity so failed utility fallbacks cannot suppress recovery through a different runtime.

Example: A utility fallback targets openai/gpt-main directly, while regular recovery uses the same model through the session's codex runtime.

  • Before: The failed direct attempt suppresses native recovery, leaving the session's provisional title.
  • After: Native recovery runs and supplies a generated title.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused bug fix with shipped-entry-point proof, meaningful regression coverage, no findings, and a verified no-migration case; final CI remains pending.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The supplied exact-head isolated built-Gateway comparison exercises sessions.create title generation with overlapping utility and regular models, showing failed direct requests followed by successful native-runtime recovery and generated titles.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Automatic session titles can remain provisional despite a working regular model through the session's native runtime.
Reason: The change restores intended fallback behavior with a bounded repair and preserves existing runtime selection, model policy, and deduplication contracts.

Regression provenance

Regression provenance — verified: source commit 6861671cda97 by Peter Steinberger; canonical PR #173906 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

This PR fixes a current label-recovery bug with a focused implementation and sufficient Gateway proof; no actionable findings remain, and current-head CI is pending.

Priority: P2
Reviewed head: 9cef2c817d3589c24c3b748709f13b54e79892cc

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway session-title generation and channel label callers pass model, profile, and runtime selections to the shared label generator, which returns bounded text through utility completion and isolated runtime dispatch.

flowchart TD
A[Session or channel title request] --> B[Conversation label generator]
B --> C[Resolve selection and runtime]
C --> D[Runtime aware attempt identity]
D --> E[Utility completion fallback chain]
E --> F[Isolated runtime dispatch]
F --> G[Generated conversation label]
Loading

Technical review

Best possible solution:

Keep runtime-aware deduplication in the existing label-attempt owner while preserving same-route suppression and runtime-owned authorization.

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

Current-main source establishes the suppression path, and the supplied Gateway comparison reproduces it on the pinned base; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The patch repairs the attempt-identity invariant directly, reuses existing selection and dispatch owners, and preserves same-route deduplication without new retry machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4d4801bc7ca3.

Provenance checked

  • Utility-chain candidate deduplication keeps the original intent (6861671: Prevent repeated inference when utility fallbacks have already attempted the regular model.)
  • Resolved label-attempt identity keeps the original intent (3d9aaf8: Resolve aliases and profiles consistently while keeping speculative utility-only naming separate from regular recovery.)
  • Compatible and automatic runtime selection keeps the original intent (1041e55: Keep automatic utility naming on the recommended small model through Claude CLI while preserving explicit utility selections.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 6861671 adds src/auto-reply/reply/conversation-label-generator.ts:134 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6861671cda97; files: src/auto-reply/reply/conversation-label-generator.ts)

PR surface

Source +16, Tests +38. Total +54 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 51 35 +16
Tests 1 38 0 +38
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 89 35 +54

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +51/-35; tests +38/-0 The production growth carries runtime identity through the existing owner; the added test protects distinct-runtime recovery alongside existing same-route deduplication coverage.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: The bug leaves automatic titles provisional for overlapping utility and regular models using different runtime routes, without blocking conversation execution.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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-10-16T11:40:05.563Z sha 912ab51a069ce6c5a092b19c02f49be36a4efdc7 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-16T15:41:11.449Z sha 72a3a20 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-18T07:15:51.003Z sha 72a3a20 :: needs maintainer review before merge. :: none

Reviewed October 22, 2026, 9:38 AM ET / 13:38 UTC (Revision 4).

@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: 8d439f1f78

ℹ️ 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".

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Oct 16, 2026
@dankarization

Copy link
Copy Markdown
Contributor Author

Real-behavior proof: shipped Gateway title recovery with the session runtime override

Addressed ClawSweeper item "Add real behavior proof" on exact HEAD 72a3a20b58bc45793e92e9572cc21eeecc93e29e.

Entry point (shipped): sessions.create with titleSource → scheduleCreatedDashboardSessionTitle → maybeGenerateDashboardSessionTitle → generateConversationLabelWithFallback. No mocks in this path.

Scenario (isolated, non-production Gateway):

  • agents.defaults.model = openai/gpt-6-sol
  • agents.defaults.utilityModel = { primary: "mockdead/dead-model", fallbacks: ["openai/gpt-6-sol"] } — the utility fallback overlaps the regular model
  • openai pinned to the openclaw runtime so the direct route has no route-compatible auth; the session is created with agentRuntime=codex

Observed (sanitized; IPs/keys/phone numbers/endpoints removed, timestamps reduced):

[agent/embedded] Codex app-server spawn
[model-fallback/decision] decision=candidate_failed requested=mockdead/dead-model
  candidate=mockdead/dead-model reason=model_not_found next=openai/gpt-6-sol
[model-fallback/decision] decision=candidate_failed requested=mockdead/dead-model
  candidate=openai/gpt-6-sol reason=auth next=none
  detail=...Auth lookup failed for provider "openai": No route-compatible authentication source is configured for openai.
[conversation-label] Conversation label generation failed for mockdead/dead-model (utility).
[agent/embedded] Codex app-server spawn

Result: the session is titled Quarterly marketing budget review (a generated title, not the fallback slug).

Reading: the utility fallback runs the overlapping regular model without the session runtime override and fails on the direct route (auth); the regular-model recovery then runs and succeeds. Because openai has no route-compatible auth except the codex runtime, that success proves the recovery was dispatched with the session runtime override.

Unit-level fail-before/pass-after for the same overlap scenario: 1 failed | 19 passed → 20 passed.

@dankarization

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Real-behavior proof added above for the shipped Gateway title-recovery path on exact HEAD 72a3a20b58. Current check rollup on this head has no failing check; CI/first-party lanes (ci-gate, security-sensitive-review, dependency-review) are green.

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 16, 2026
@dankarization

Copy link
Copy Markdown
Contributor Author

CI attribution (ClawSweeper item 2) — current evidence vs historical

Current evidence, exact HEAD 72a3a20b58: no failing checks. openclaw/ci-gate, check-lint shards, check-test-types*, security-sensitive-review, and dependency-review are all success/skipped; there is no failure in the rollup.

Historical failures (ClawSweeper reviewed head 912ab51a069c) were exactly two jobs; openclaw/ci-gate failed only as their aggregator:

  1. check-lint-core-4 — every annotation is in files this PR does not touch (ui/src/pages/..., ui/src/app/..., src/infra/heartbeat-runner..., src/infra/session-cost-usage-worker-io..., src/process/command-queue..., src/auto-reply/reply/agent-runner-run.ts). These are pre-existing max-lines warnings, not introduced by this diff. The gate's own classifier marked it class=unknown, reason: "Selected scope differs from main; failure signatures not comparable."
  2. checks-fast-baseline-ratchets — the failure text is baseline/environment, not diff-caused:
    • [env-var-count] refs/remotes/origin/ci-ratchet-base shares no reachable ancestor here; skipping the base-budget comparison then OPENCLAW_* count 453 exceeds budget 452
    • assertion-safety failed: "Shrink config/assertion-safety-baseline.txt entries (or run with --prune)" — a stale baseline file.

Conclusion: the historical failures are (a) max-lines warnings in untouched files under a non-comparable scope, and (b) stale/over-budget ratchet baselines with the comparison base ref unreachable. Neither is attributable to this PR's three changed files (src/agents/utility-completion.ts, src/auto-reply/reply/conversation-label-generator.ts, src/auto-reply/reply/conversation-label-generator.test.ts). The lanes are green on the current head.

Copy link
Copy Markdown
Contributor Author

@steipete, could you review this follow-up to #173906? It fixes the session-runtime recovery path identified in the inline review. Current head 72a3a20b58bc has exact-head behavior proof, a green CI gate, and ClawSweeper review with no findings.

Copy link
Copy Markdown
Contributor Author

October 18 readiness reconciliation, unchanged head 72a3a20b58bc45793e92e9572cc21eeecc93e29e: the PR body now links the exact-head native Gateway proof already accepted by the current review. Current openclaw/ci-gate is successful. The review reports sufficient proof, no findings, and ready for maintainer review, while issue labels still say needs proof / intake needs-repro. Please reconcile those labels with the existing verdict; no new runtime result or source change is claimed.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 18, 2026
@obviyus

obviyus commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 22, 2026
@obviyus
obviyus merged commit 80ae18c into openclaw:main Oct 22, 2026
130 of 131 checks passed
@obviyus

obviyus commented Oct 22, 2026

Copy link
Copy Markdown
Collaborator

Landed in 80ae18c. Thanks @dankarization. Session titles now finish when the utility model falls back to a native-runtime model.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
…p key (openclaw#174164)

fix(sessions): finish automatic session titles through the session's native runtime

When the utility model used for session titles failed and the fallback was a regular model served through the session's native runtime (for example Codex), the title request went straight to that model instead of through its runtime, failed too, and the session kept its provisional title. Title generation now recovers through the native runtime, so the session gets a real title.

Evidence: built Gateway with local OpenAI-compatible fixtures, the same utility-fallback and regular model overlap as the report. On main the title stayed provisional (twice); with this change a title is generated (twice), and the wire log shows the failed direct request followed by a successful Codex recovery. A plain native-runtime session works as before, and a live gpt-5.4-mini run titled a session "Plan raised beds.". Production +16 (two helper layers removed).

Requested in Discord. Thanks @dankarization.

Co-authored-by: Ayaan Zaidi <[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 P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor 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.

2 participants