Skip to content

feat(discord): AI auto-naming for threads via channels.discord.thread.autoName - #160873

Closed
art22s wants to merge 9 commits into
openclaw:mainfrom
art22s:feat/discord-thread-auto-name
Closed

art22s wants to merge 9 commits into
openclaw:mainfrom
art22s:feat/discord-thread-auto-name

Conversation

@art22s

@art22s art22s commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Related: #160865

What Problem This Solves

New Discord threads can keep generic titles after a conversation develops. This adds optional naming after an admitted conversation reaches a configured message threshold.

User Impact

channels.discord.thread.autoName defaults to false; true uses five messages, a positive integer sets the threshold, and 0 disables it. Account settings override the channel-wide value. A bounded recent transcript goes to an isolated title run using the thread’s bound or routed agent and its utility model, with primary-model fallback. Other bots and webhooks do not contribute. Generated identifiers retain underscores.

Naming requires intents.guildMembers: true for the selected account and Server Members Intent in Discord’s Developer Portal. Without this existing privileged subscription, OpenClaw skips naming and explains the requirement at startup. It does not enable the intent automatically.

Changing autoName or enabled uses the existing Discord channel restart. Before downgrading to a release without the setting, remove the autoName key at the channel and every account scope; false is still an unknown key to that release’s strict schema.

Naming applies to newly observed threads in their first 24 hours. Threshold crossing spends one persisted attempt even if permissions, budget, or later revocation prevent naming. Claims expire after 24 hours and are deleted with the thread. Each account/parent permits two attempts per ten minutes; both protection stores reject new entries at 10,000 rows. Transcripts are not persisted. No non-expiring legacy-claim reader or repair remains.

Maintainer decision remains open: acceptance of the new setting, transcript/model processing, persisted lifecycle, and prepareSessionBindingInspections export through the existing binding SDK subpath is still required. Neither this PR nor #160865 records that acceptance; the existing change request has not been dismissed.

Review Follow-up

Fresh member reads alone did not invalidate retained roles during awaited preparation or queued retries. Discord’s existing native entity-invalidation owner now retains disposable member authority before those reads and invalidates it before listener queueing. The naming route and REST request owner assert that authority before model dispatch/fallback and each physical request/retry, then release it in finally. This covers every contributing human, membership removal, guild role changes/removal, Gateway disconnection, and session replacement. Unrelated members do not cancel the attempt. Relevant membership events conservatively cancel even if the updated roles would still allow access; the consumed claim/budget is not refunded.

Existing config/binding/routing/lifecycle checks remain. Any effective config replacement, including unrelated changes, abandons an active naming attempt. Ordinary in-flight replies retain existing channel-restart behavior for naming, enablement, and action edits. Naming role routing uses the most recently admitted human, so it can differ from another author’s replying agent.

Rebased onto main 3e55551264e9483422ad1b0dd82c38a78aa9a52c. The actual conflict included upstream’s listener-base-class removal; naming listeners now use the current typed event contract without restoring retired classes. Channel metadata and documentation baselines were regenerated with their canonical generators.

Evidence

Published head: 28dfc4980b5e82e3f492b896a76c8b157912734f. Source tree: 29053d663332f22b6e13fadfa4bf322cad5653ec. Current-head CI run 38969845498 completed successfully: all 79 jobs finished with no failures, including every test-types stripe, the baseline ratchets, the Discord bundle, and the CI gate job. Both required openclaw/ci-gate checks pass; the separate combined status confirms CI and applicable security-review requirements passed (publisher run 38971041246).

The local repair proof below was completed at 2f64e5d046ac305f84cc8400bffa45422962920f, before the final conflict-only sync. All feature production/test/docs blobs were identical immediately after that sync (6b6fa94377). The changed test-planner entry is upstream’s Codex history-seed test; the final config hash was regenerated and checked canonically. The subsequent CI cleanup only shares the existing checked member extraction and migrates one Gateway test fixture to upstream’s current runtime-registry owner; it does not change naming admission or test assertions.

ClawSweeper Revision 13 reviewed this exact head and reports no actionable findings, no security concern, sufficient behavior proof, and a single remaining blocker: maintainer acceptance of the feature, persisted/model-processing lifecycle, and supported SDK export. No maintainer approval has been inferred or substituted.

The current production-path harness uses actual Gateway dispatch, entity invalidation, label/isolated-completion preparation, and the queued REST scheduler, with synthetic provider and Discord I/O. It does not claim a new live Discord/model demonstration.

Boundary Allowed control Native revocation
Model preparation Unrelated member update permits utility, primary fallback, and rename Contributor role update permits zero model dispatches and zero PATCHes
Utility failure Existing allowed fallback reaches primary and renames Contributor role update permits the already-failed utility call only; no primary dispatch or PATCH
Queued rename after HTTP 429 Second PATCH succeeds Role update, member removal, role deletion, or session resumption prevents the second PATCH
Member-event subscription Connected Gateway with explicit GuildMembers intent proceeds Missing intent or disconnected Gateway permits no model dispatch or PATCH

Before the repair, the regressions produced eight intended failures: utility/primary dispatch still occurred after revocation, queued retries sent a second PATCH, and absent event authority still allowed naming. Allowed controls passed. After repair, all 98 focused tests across seven files passed (107.44s wrapper wall time), including 57 naming/runtime/persistence cases and 41 cache/client/Gateway/startup cases. Both extension production and test typechecks passed.

Both extension typechecks, canonical metadata/baseline checks, MDX, formatting, and staged-content checks passed. Typed lint caught raw-string/enum comparisons; the existing native event classifier now selects the invalidation kind once, preserving behavior. Typed lint then passed with zero warnings/errors, and all 19 affected cache/deferred-authority cases passed again (54.48s wrapper). Final production/test typechecks passed in 49.06s/76.67s. At 6b6fa94377, the full build passed in 225.6s, including all 155 SDK export checks and CLI bootstrap import checks. The isolated Discord cold-import snapshot qualified with no gaps: 104.64 MiB maximum RSS against a 43.86 MiB baseline, and the temporary home was removed. This measures cold import, not full Gateway startup. That build/profile predates the two-file CI cleanup described below; earlier dirty-source/build-stamp screenings are not qualified evidence.

The requested independent subagent review found and verified the correction of a misplaced configuration-help sentence; no P0–P3 findings remain. Canonical autoreview completed all three passes with P0–P2 scoped-clean; the help correction, regenerated outputs, and behavior-preserving event-classifier refactor were separately verified. The independent subagent re-reviewed the classifier and found no P0–P3 issues. Both reviews were static; execution evidence is recorded above.

CI run 38968359028 exposed two repair-owned issues: the rebase left a removed registry helper in one Gateway test (runtime and test-types failures), and member extraction duplicated an assertion (baseline failure). The fixture now uses the same runtime registry builder and awaited disposal as its sibling; member invalidation shares one checked extraction. No baselines, timeouts, or assertions were weakened. The repaired Gateway integration tests (2), root-other test typecheck, cache tests (5), assertion-safety ratchet, formatting, typed lint, and staged guard passed. All 11 selected production-path model-authority and queued-retry regressions passed again after the extraction cleanup (53.01s wrapper); 43 unrelated cases were not selected in this repeat. Fresh canonical autoreview completed P0–P2 scoped-clean, and the independent subagent found no P0–P3 issues in either CI repair.

Standalone changed-file timings on the secretless four-CPU Node 24.19.0 container: naming 59.55s wall (37 cases), runtime 66.87s wall (17 cases), including worker compilation and concurrent build activity. These suites exercise real credential/routing preparation, worker persistence, and serialized effects; replacing those owners with mocks would miss the reviewed boundary. Individual CI test-case timings were not collected.

Latest-stable upgrade proof

Actual npm [email protected] and @openclaw/[email protected], from release v2026.10.4 at 383c124cc32ffee3f8e56f549b88da94d269a4af, wrote the synthetic existing configuration and two supported account bindings using their shipped owners. The candidate’s real Doctor schema owner migrated shared-state schema 20→26; both released bindings and every stored column stayed exact. Config bytes retained SHA-256 46fd7c3c97a8ed54551228abf96145c46f9d27ffcf40668511b4397d88f22c02; naming remained off without the new key. Enabling the setting in memory validated, and only the two new expiring naming namespaces were added. Their consumed claim and exhausted two-attempt budget survived physical database close/reopen while existing records/config remained intact. The canonical database harness passed (2.110s case, 43.67s wrapper). All 20 individually examined owner files are identical between that proof’s pinned 82448706cc17f9a556b63c4d93c070e963671937 and the published repair. The broader state/infra trees include subsequent upstream changes; no whole-tree identity is claimed. The SQLite fixture does not exercise the changed agent-database/mixed-PostgreSQL paths.

The released CLI also rejected autoName and accepted configuration after removing the key. This proves configuration/storage-owner compatibility and the configuration downgrade note; it does not claim a full updater, agent/session database upgrade, database downgrade, or released live Gateway test. No operator state or credentials were used.

Immutable npm package identities
[email protected]
sha512-+FH0StZF1tlTazM7JJGY6JePeJmhFNSRByi2Q3jXPRiLO7o4dJh2xa9Vy4Dk8Cd2ic8B7Zkf5NfEaCCWUkgqnQ==
@openclaw/[email protected]
sha512-hYtuQRcaD9MJPY94LtiV5BJtGUeBTPsv3LCtyf015Ngc1e81Uuvm2FBe9Jes3m0Zh6fvB1ZapeNcTCn+sGPDGQ==

The repair retains member invalidation in the existing entity-cache owner and effect checks in existing model/REST owners; no parallel policy service, SDK export, compatibility reader, or database schema was added for this repair. The complete proposal against pinned main adds 992/deletes 9 production lines and adds 1,695/deletes 0 test lines (docs/generated outputs excluded). The retained growth implements one bounded plugin feature and its authority, persistence, and routing contracts. The previous reviewed head 79c8f2a0a682549c3dfb5f1190dcfcfe243bfacb had fully successful CI run 38814381864; that is prior-head evidence only.

Historical live Discord demonstration

On October 13, 2026, an isolated ordinary compiled Gateway at f2b5c61988be2af10c7f6a5880790ba2f6b61c6f connected to real Discord and a real model service. With autoName: 2, the title stayed Untitled after the first plain human message and changed automatically after the second. This demonstration predates later routing and policy repairs and has not been repeated on this head; current regressions cover those changes.

Redacted historical observations (UTC)
source_sha=f2b5c61988be2af10c7f6a5880790ba2f6b61c6f
foreground_cli=node scripts/run-node.mjs gateway run
autoName=2
2026-10-13T22:21:06.515Z Discord lifecycle=ready connected=true
2026-10-13T22:22:34.146Z new public thread name="Untitled"
2026-10-13T22:34:18.894Z admitted human message 1 (plain, no mention/reply)
2026-10-13T22:34:28.266Z Discord GET: humans=1 name="Untitled"
2026-10-13T22:34:51.451Z admitted human message 2 (plain, no mention/reply)
2026-10-13T22:34:51.980Z isolated Gateway claim=true expires_after=24h
2026-10-13T22:34:52.619Z isolated Gateway naming_attempts=1 budget_window=10m
2026-10-13T22:34:55.102Z Discord THREAD_UPDATE audit: actor=bot "Untitled" -> "Test messages for check"
2026-10-13T22:34:59.368Z Discord GET: humans=2 name="Test messages for check"
bot_conversation_replies=0 (Discord also emitted its type-4 name-change system message)
2026-10-13T22:40:58.765Z isolated Gateway shutdown completed cleanly
temporary thread, parent channel, test containers, and copied credentials removed

Release-note context: Discord can optionally name new threads after an admitted conversation threshold. Human credit: @art22s. No release-owned changelog edit.

@clawsweeper

clawsweeper Bot commented Sep 29, 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: discord Channel integration: discord gateway Gateway runtime size: L labels Sep 29, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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. labels Sep 29, 2026
@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Adds optional AI-generated Discord thread names after a configurable conversation threshold.

Example: A new Discord thread named Untitled has autoName set to 2.

  • Before: Its title remains Untitled after two messages.
  • After: After two admitted messages, OpenClaw can rename it to Test messages for check.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Scoped behavior and released-state upgrade evidence support correctness; unresolved feature and public SDK acceptance cap overall readiness.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): The historical compiled Gateway trace shows a real Discord threshold rename from Untitled after the second admitted message; subsequent production-path evidence covers assigned-agent dispatch, native member revocation during preparation and fallback, and queued PATCH retry invalidation through real owners with synthetic external I/O, without claiming a repeated live demonstration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Discord threads can retain generic names after their conversation establishes a useful topic.
Reason: The proposal is coherent and distinct but adds configuration, automatic model processing, durable lifecycle state, and a supported SDK operation without recorded owner acceptance.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this PR open for owner acceptance of the feature and SDK contract; no actionable code findings remain, and its same-author request is still open.

Priority: P3
Reviewed head: 28dfc4980b5e82e3f492b896a76c8b157912734f
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should Discord support threshold-based transcript processing, persisted naming claims, and the prepareSessionBindingInspections SDK export?
  • Recommendation: Defer pending owner sponsorship: Keep the paired proposal open until an area owner accepts or narrows the setting, processing lifecycle, and SDK operation.
  • Why: Creation-time naming does not establish acceptance of this additional lifecycle, and the discussion expressly leaves its product and public-contract direction open.

Before merge

  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

None.

Agent review details

How this fits together

Discord Gateway events enter the plugin’s naming lifecycle, which admits conversation text, generates a title through the selected agent, and applies it through Discord REST.

flowchart TD
  A[Discord Gateway events] --> B[Thread naming lifecycle]
  B --> C[Current policy and member authority]
  C --> D[Persistent claim and budget]
  D --> E[Bound or routed agent]
  E --> F[Isolated title generation]
  F --> G[Authorized Discord REST request]
Loading

Technical review

Best possible solution:

An area owner should accept or narrow the opt-in naming lifecycle and supported SDK contract before this implementation lands.

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

This requests new behavior; current main provides creation-time generated names without a later conversation threshold.

Is this the best way to solve the issue?

The implementation uses the appropriate Discord plugin and existing policy, binding, label, REST, and worker-storage owners, subject to acceptance of its additional product contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 44b487a6ae6c.

Provenance checked

  • Existing generated thread titles keeps the original intent (aa91000: Offer generated titles at auto-thread creation while preserving message-based naming by default.)
  • Runtime-owned title authentication keeps the original intent (ec4ae78: Generate titles through the selected runtime’s isolated completion and authentication owner.)
  • Live Discord policy keeps the original intent (1ebb4c0: Apply access-policy updates during active turns without restarting Discord; the new naming snapshot assertion preserves ordinary admission semantics.)
  • Native transport and entity ownership keeps the original intent (f0adbd4: Internalize Discord transport ownership; this change extends the existing entity-invalidation owner.)
  • Title failure diagnostics changes intended behavior with a stated reason (aa91000: Record best-effort title failures; the current proposal explains removing arbitrary provider error text because it can contain transcript or request data.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current main has creation-time naming only: Fetched main generates names from the initial message after auto-thread creation; its thread schema has inheritParent but no autoName threshold. (extensions/discord/src/monitor/threading.auto-thread.ts:175, 44b487a6ae6c)
  • Authority reaches the effects: Contributor authority is retained before fresh member reads and asserted during model preparation, fallback, and physical REST requests, including queued retries; native invalidation precedes listener queueing. (extensions/discord/src/monitor/thread-auto-name.ts:458, 28dfc4980b5e)
  • Full behavior and upgrade evidence inspected: The full body matches captured SHA-256 bc3738ac0d3013429e9cd53603e2f51c8c35ffb21786e420fe3e4924689f1e82. It supplies a historical compiled-Gateway live rename trace, subsequent allowed/revoked production-path results, and v2026.10.4 config and binding preservation through Doctor and physical database reopening. (28dfc4980b5e)
  • Product and public SDK acceptance remain open: The author explicitly leaves acceptance unresolved, and eleqtrizit’s discussion distinguishes resolved implementation defects from the outstanding product decision; no owner approval appears in the retrieved discussion. (src/plugin-sdk/conversation-binding-runtime.ts:17, 28dfc4980b5e)
  • Paired request prevents automatic closure: The same author’s open request defines the threshold, account overrides, isolated generation, and durable one-attempt behavior implemented here.
  • Exact-head gate passes: The combined status reports successful CI, dependency-review, and security-sensitive-review gates. Paginated checks also contain neutral CodeQL and cancelled acknowledgement/context jobs; these establish no diff-caused failure or contributor repair. (28dfc4980b5e)

Likely related people:

  • Peter Steinberger: Raw commit 1ebb4c0 adds extensions/discord/src/monitor/live-policy.ts:121 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1ebb4c09323d; files: extensions/discord/src/monitor/live-policy.ts)
  • David Guttman: Raw commit aa91000 adds extensions/discord/src/monitor/thread-title.ts:20 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: aa91000a5d1b; files: extensions/discord/src/monitor/thread-title.ts)
  • Vyctor H. Brzezowski: Raw commit 82efd1f adds extensions/discord/src/monitor/thread-title.ts:12 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 82efd1f0eeae; files: extensions/discord/src/monitor/thread-title.ts)

PR surface

Source +983, Tests +1695, Docs +47, Generated 0. Total +2725 across 32 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 15 992 9 +983
Tests 10 1695 0 +1695
Docs 4 47 0 +47
Config 0 0 0 0
Generated 3 24 24 0
Other 0 0 0 0
Total 32 2758 33 +2725

Review metrics

Metric Value Why it matters
Production versus test growth Production +992/-9; tests and test support +1695/-0 The growth implements a bounded optional lifecycle and distinct routing, authority, persistence, and restart contracts; its ongoing cost belongs in the product decision.
New configuration contract 1 optional setting with account overrides thread.autoName accepts a boolean or nonnegative integer and defaults off.
Public SDK expansion 1 export added to an existing subpath prepareSessionBindingInspections becomes a supported plugin-facing operation.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #160865
Summary: This PR implements the canonical threshold-naming request; related branches carry the same work, while creation-time naming is distinct.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: Optional naming convenience adds no urgent repair to message delivery or existing manual naming.
  • merge-risk: 🚨 compatibility: The patch expands the public SDK contract, and configurations containing autoName require key removal before downgrade to releases without it.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • 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 (14 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-13T21:30:35.770Z sha f2b5c61988be2af10c7f6a5880790ba2f6b61c6f :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-13T21:39:28.739Z sha f2b5c61988be2af10c7f6a5880790ba2f6b61c6f :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-13T22:56:50.509Z sha f2b5c61988be2af10c7f6a5880790ba2f6b61c6f :: blocked before merge. :: none
  • reviewed 2026-10-13T23:18:48.445Z sha 3b52cb706383c709d4e209e6ae49f9be19a6014e :: blocked before merge. :: none
  • reviewed 2026-10-13T23:39:14.945Z sha 3b52cb706383c709d4e209e6ae49f9be19a6014e :: blocked before merge. :: none
  • reviewed 2026-10-16T20:05:17.058Z sha 79c8f2a0a682549c3dfb5f1190dcfcfe243bfacb :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-16T21:38:28.946Z sha 28dfc49 :: blocked before merge. :: none
  • reviewed 2026-10-16T21:48:47.129Z sha 28dfc49 :: blocked before merge. :: none

Reviewed October 16, 2026, 6:58 PM ET / 22:58 UTC (Revision 15).

@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 29, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 29, 2026
@openclaw-barnacle openclaw-barnacle Bot added channel: imessage Channel integration: imessage channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: zalo Channel integration: zalo labels Oct 13, 2026

@eleqtrizit eleqtrizit 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.

Reviewed 3b52cb706383c709d4e209e6ae49f9be19a6014e. The bounded transcript, persistent attempt budget, and authority checks through model dispatch and queued REST retries are good. Requesting changes for the agent-selection defect and transcript-window edge case below. Please add focused regressions for both and rerun the relevant checks on the resulting head.

This review is based on source/test inspection and the successful exact-head CI run; I did not independently execute the tests or repeat the live Discord demonstration.

@eleqtrizit eleqtrizit 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.

Re-reviewed 184d484308b2.

Resolved from my previous review

  • Agent selection: title generation now resolves the agent through the existing Discord binding/route resolver, so the thread's bound or routed agent is used instead of the default agent. The new runtime tests cover parent, account, role and bound routing, and ownership changes during preparation and fallback.
  • Human admission: state.human keeps the admitting human outside the rolling 20-message window. Thresholds 21 and 22 are now covered.

Thanks for the fixes. This review is based on source and test inspection and the passing required openclaw/ci-gate checks. I did not execute the tests or repeat the live Discord demonstration on this head.

Still needed before this can land

  1. Merge conflict. Merging current main (72048b61942) conflicts in docs/.generated/config-baseline.sha256. Please rebase and regenerate it canonically, then rerun checks.
  2. Docs gaps.
    • docs/gateway/config-channels/community-chat.md documents the other Discord keys (for example threadBindings), but thread.autoName is not listed there.
    • The user docs do not say that changing autoName or enabled uses the existing Discord channel restart. Only the PR body does.
    • The strict thread schema means a config containing autoName fails validation on a release that lacks the key. Please add a downgrade note: remove the key before rolling back.
  3. Legacy-claim compatibility. The PR keeps code and tests for legacy non-expiring boolean claims. I could not find that format on main. Please cite where it shipped, or drop it per the root AGENTS.md rule on retained compatibility.
  4. Policy invalidation. live-policy.ts now includes enabled, actions and thread in the authored policy revision. message-handler.preflight.ts returns null when isPolicyCurrent?.() === false. Please confirm, ideally with a test, that changing thread.inheritParent or actions does not drop an in-flight message beyond the existing channel-restart behavior. If that is accepted, say so.
  5. Maintainer decision. I found no recorded acceptance of the new setting, model processing and persisted lifecycle on this PR or on #160865. That decision is still open.

Non-blocking notes

  • isConfigCurrent compares object identity, so any config write during a title run abandons the attempt after the claim and budget are spent. The docs describe the behavior; a short code comment would make it an explicit accepted tradeoff.
  • Role-based routing uses the roles of the single retained human, while message preflight uses each author's roles. In a thread with several humans on different role bindings, the naming agent can differ from the answering agent. Please note it as accepted.
  • thread-auto-name.ts imports conversation-binding-runtime statically and is reachable from provider.startup.ts; the routing preflights load it lazily. native-command.ts already imports it statically, so the cost may not be new, but I did not run the startup profiler the plugin-SDK guide calls for.

I am leaving my earlier change request in place until items 1-5 are addressed.

@eleqtrizit eleqtrizit 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.

Code review of a647bb349850. I found no correctness or security blockers in the current code. The agent-selection and human-admission fixes look right, and the new in-flight preflight test is a good addition. Remaining notes are maintainability items on the inline comments below, plus two points from my earlier review that are still open:

  • Maintainer decision. I still see no recorded maintainer acceptance of the new setting, model processing and persisted lifecycle on this PR or on #160865.
  • PR body. Please check that it no longer describes the legacy-claim handling that was removed in 7ad5ea492ac.

This review is based on source and test inspection. I did not run the tests, the startup profiler or the docs checks, and I did not repeat the live Discord demonstration on this head.

@eleqtrizit

Copy link
Copy Markdown
Contributor

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@art22s

art22s commented Oct 16, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Updated head 28dfc4980b5e82e3f492b896a76c8b157912734f addresses Revision 12’s retained member-role authority concern with native Gateway invalidation before model dispatch, fallback, and queued PATCH retries. The PR body records pre-fix failures, allowed/revoked production-path proof, actual v2026.10.4 package upgrade compatibility, and the qualified cold-import profile. Conflicts and the two CI repair issues are fixed; targeted tests, types, lint, baseline checks, and independent reviews pass. New-head CI is running. Maintainer acceptance of the feature and SDK export remains open.

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@eleqtrizit

Copy link
Copy Markdown
Contributor

Context for a second maintainer opinion on the product decision here (feature acceptance is the open item from review).

Precedent: we already do automatic, model-generated naming in two places.

  1. Discord, creation-time (autoThreadName) — shipped. When OpenClaw itself auto-creates a thread and autoThreadName: "generated" is set, the plugin names the thread from the initiating message via generateThreadTitle (extensions/discord/src/monitor/threading.auto-thread.ts, feat(discord): add autoThreadName 'generated' strategy #43366). This PR's setting targets the other lifecycle point: renaming a user-created thread later, once the conversation establishes its topic. The docs deliberately keep the two distinct.

  2. Telegram, first-turn (autoTopicLabel) — shipped. On the first turn of a DM-topic session, extensions/telegram/src/bot-message-dispatch.ts renames the topic via the shared generateConversationLabel runtime. Opt-in, same as here.

Both feed through the shared isolated-completion label runtime (src/auto-reply/reply/conversation-label-generator.ts), which this PR also reuses. So the pattern — opt-in, model-generated, bounded input, isolated run — is established, and this is its third instance.

What's genuinely new in this PR, and where a judgment call is needed:

  • Naming on a conversation threshold rather than at creation/first turn. That means sending a bounded recent transcript (up to 20 messages, 1800 chars) to the model, not just the initiating message.
  • Persistence: one-time-per-thread claims and a two-renames-per-parent-per-10-minutes budget in SQLite, surviving Gateway restarts. The shipped precedents keep no such durable lifecycle state.

So the model-processing aspect is precedented; the durable lifecycle is the new commitment. The question I'd put to a second maintainer: are we comfortable shipping the persisted attempt/budget lifecycle as part of the Discord plugin contract, and is the threshold-triggered transcript input acceptable given the existing creation-time and first-turn behaviors?

(Note: head is 28dfc4980b5e; my last full code review was at 79c8f2a0a682. The head has advanced since, so re-verify code state before merging.)

@jacobtomlinson jacobtomlinson 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.

I have some reservations about the design here. This is a new behaviour which I can't find precedent for, but I have desired for sure. The high-level question that this PR opens is "given that we name sessions/threads automatically, should we also rename those threads later into the conversation if the conversation changes direction?". Assuming the answer is yes we then need to figure out the details of how to do that so we can do it consistently across channels and reduce the amount of new config options instroduced.

Right now it seems like we consistently set the name based on the initial message (verified in discord, telegram, control UI, etc). Annoyingly it looks like we don't have a consistent configuration scheme for doing this across connectors, discord calls it autoThreadName and telegram calls it autoTopicLabel. These are acceptable names for each platform but makes it a little hard to figure out what to call this new option with an eye to expanding it to other channels later.

It also looks like the changes here are mutually exclusive with the existing autoThreadName option, so if the thread is named on first message that cancels the later rename. The autoThreadName is also a channel specific configuration, whereas this new option is guild-wide.

I think we need to take a small step back and think about how we want this to be implemented broadly across OpenClaw. I'm not suggesting we try and land a monolith PR that adds this for all channels, but we should try and land a pattern that make it easy for us to follow up and implement consistently in all other channels.

@art22s

art22s commented Oct 20, 2026

Copy link
Copy Markdown
Contributor Author

I have some reservations about the design here. This is a new behaviour which I can't find precedent for, but I have desired for sure. The high-level question that this PR opens is "given that we name sessions/threads automatically, should we also rename those threads later into the conversation if the conversation changes direction?". Assuming the answer is yes we then need to figure out the details of how to do that so we can do it consistently across channels and reduce the amount of new config options instroduced.

Right now it seems like we consistently set the name based on the initial message (verified in discord, telegram, control UI, etc). Annoyingly it looks like we don't have a consistent configuration scheme for doing this across connectors, discord calls it autoThreadName and telegram calls it autoTopicLabel. These are acceptable names for each platform but makes it a little hard to figure out what to call this new option with an eye to expanding it to other channels later.

It also looks like the changes here are mutually exclusive with the existing autoThreadName option, so if the thread is named on first message that cancels the later rename. The autoThreadName is also a channel specific configuration, whereas this new option is guild-wide.

I think we need to take a small step back and think about how we want this to be implemented broadly across OpenClaw. I'm not suggesting we try and land a monolith PR that adds this for all channels, but we should try and land a pattern that make it easy for us to follow up and implement consistently in all other channels.

Thanks, Jacob. I agree we should establish consistent naming behavior before committing to another configuration option.
My original intent was a one-time refinement after several messages provide useful context. Automatically updating titles whenever a conversation changes direction would be a broader behavior that needs its own policy decision.
You’re right about the interaction with autoThreadName. The current implementation treats any subsequent name change as final to protect manual renames, which also cancels refinement after a creation-time generated title. We need an explicit distinction between automatically managed titles and user-chosen titles so initial naming and later refinement can work together.
Discord, Telegram, and the dashboard already share the conversation-label generation runtime. The missing agreement is around when to generate a title, which titles automation may replace, and configuration scope and precedence. I’d propose defining those semantics first, keeping platform permissions and rate limits in each channel’s implementation.
For a first increment, would one opt-in refinement of an automatically managed title, with manual renames taking precedence, fit the direction you have in mind? I’m happy to write a short design proposal and reshape this PR around the agreed configuration, implementing Discord first while leaving a consistent path for other channels.

@jacobtomlinson

Copy link
Copy Markdown
Contributor

FYI we have a core goal of reducing configuration complexity, we already have a very complex config schema. PRs that change config or sqlite schema will get less traction with maintainers at the moment.

Lets try and refine and simplify. IMHO agents should own naming sessions/threads, and I think it's fine for them to periodically rename if the conversation diverges from the title. If a user manually renames a session it should end automatic renaming. We may want one more simplified enable/disable toggle for automatic naming.

Choosing when to rename could be a good opportunity to leverage the decision model support. A small decision on whether the recent conversation is still reflected by the current title would be an easy trigger.

@art22s

art22s commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, Jacob. That direction makes sense. I’ll propose a simpler design around agent-owned ongoing naming, using the existing decision support to check whether the current title still fits and the existing label generator when a replacement is needed. Manual renames would end automatic naming.

I’ll also revisit the threshold setting and one-time bookkeeping, aiming to reuse existing configuration and state. I’ll outline the behavior—including what happens without a configured decision model—for agreement before reshaping the Discord implementation.

@art22s

art22s commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Following up on my earlier comment:

Building on your suggestion, I’d simplify this into ongoing naming managed by the conversation’s agent, with the naming work running outside the main conversation:

  • Run a separate background check using the current title and a short conversation excerpt. When a decision model is configured, use a separate decision request; a full agent session isn’t needed.
  • If a replacement is warranted, use the existing isolated title-generation runtime, following the conversation’s agent settings and permissions.
  • Rename for meaningful topic changes rather than minor wording improvements or brief detours.
  • A manual rename stops automatic naming, including across restarts. OpenClaw’s own automatic renames should allow future updates.
  • Reuse existing configuration and state where possible, while respecting permissions and platform rate limits.

“Agent-owned” means using the conversation’s agent settings and authority without adding naming work to its main chat history.

I’d implement Discord first, with consistent behavior that Telegram and the dashboard can adopt later.

Two questions to settle before implementation:

  1. What happens without a configured decision model?
    Should we use the conversation agent’s model in a separate, isolated session, or require a decision model for ongoing automatic renaming?

  2. How should naming checks be scheduled—after each message, after a number of messages, or with a time-based cooldown? Should this be an internal default or user-configurable?

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

Labels

channel: discord Channel integration: discord docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants