openclaw/test/scripts
David Guttman aa91000a5d
feat(discord): add autoThreadName 'generated' strategy (#43366)
* feat(discord): add autoThreadName 'generated' strategy

Adds async thread title generation for auto-created threads:
- autoThread: boolean - enables/disables auto-threading
- autoThreadName: 'message' | 'generated' - naming strategy
- 'generated' uses LLM to create concise 3-6 word titles
- Includes channel name/description context for better titles
- 10s timeout with graceful fallback

* Discord: support non-key auth for generated thread titles

* Discord: skip fallback auto-thread rename

* Discord: normalize generated thread title first content line

* Discord: split thread title generation helpers

* Discord: tidy thread title generation constants and order

* Discord: use runtime fallback model resolution for thread titles

* Discord: resolve thread-title model aliases

* Discord: fallback thread-title model selection to runtime defaults

* Agents: centralize simple completion runtime

* fix(discord): pass apiKey to complete() for thread title generation

The setRuntimeApiKey approach only works for full agent runs that use
authStorage.getApiKey(). The pi-ai complete() function expects apiKey
directly in options or falls back to env vars — it doesn't read from
authStorage.runtimeOverrides.

Fixes thread title generation for Claude/Anthropic users.

* fix(agents): return exchanged Copilot token from prepareSimpleCompletionModel

The recent thread-title fix (3346ba6) passes prepared.auth.apiKey to
complete(). For github-copilot, this was still the raw GitHub token
rather than the exchanged runtime token, causing auth failures.

Now setRuntimeApiKeyForCompletion returns the resolved token and
prepareSimpleCompletionModel includes it in auth.apiKey, so both the
authStorage path and direct apiKey pass-through work correctly.

* fix(agents): catch auth lookup exceptions in completion model prep

getApiKeyForModel can throw for credential issues (missing profile, etc).
Wrap in try/catch to return { error } for fail-soft handling rather than
propagating rejected promises to callers like thread title generation.

* Discord: strip markdown wrappers from generated thread titles

* Discord/agents: align thread-title model and local no-auth completion headers

* Tests: import fresh modules for mocked thread-title/simple-completion suites

* Agents: apply exchanged Copilot baseUrl in simple completions

* Discord: route thread runtime imports through plugin SDK

* Lockfile: add Discord pi-ai runtime dependency

* Lockfile: regenerate Discord pi-ai runtime dependency entries

* Agents: use published Copilot token runtime module

* Discord: refresh config baseline and lockfile

* Tests: split extension runs by isolation

* Discord: add changelog for generated thread titles (#43366) (thanks @davidguttman)

---------

Co-authored-by: Onur Solmaz <onur@textcortex.com>
Co-authored-by: Onur Solmaz <2453968+osolmaz@users.noreply.github.com>
2026-03-24 16:27:19 +01:00
..
audit-seams.test.ts test: audit subagent seam coverage inventory 2026-03-24 00:09:36 -05:00
check-channel-agnostic-boundaries.test.ts feat: ACP thread-bound agents (#23580) 2026-02-26 11:00:09 +01:00
check-file-utils.test.ts fix(test): normalize repo-relative paths on Windows 2026-03-22 00:41:57 +00:00
check-no-conflict-markers.test.ts refactor: harden generated-file guards and provider ids 2026-03-22 19:08:08 -07:00
check-no-random-messaging-tmp.test.ts refactor(tmp): harden temp boundary guardrails 2026-02-24 23:51:10 +00:00
check-no-raw-window-open.test.ts refactor: tighten external-link policy and window.open guard 2026-02-24 15:05:31 +00:00
committer.test.ts refactor: harden generated-file guards and provider ids 2026-03-22 19:08:08 -07:00
ios-team-id.test.ts feature(context): extend plugin system to support custom context management (#22201) 2026-03-06 05:31:59 -08:00
run-vitest-profile.test.ts test: avoid repo-root perf profile artifacts 2026-03-23 11:51:26 +00:00
stage-bundled-plugin-runtime-deps.test.ts fix(runtime): anchor bundled plugin npm staging to active node 2026-03-23 20:32:48 -07:00
test-extension.test.ts feat(discord): add autoThreadName 'generated' strategy (#43366) 2026-03-24 16:27:19 +01:00
test-find-thread-candidates.test.ts test: simplify vitest runner pools 2026-03-22 16:22:09 -07:00
test-parallel.test.ts fix(ci): parse GitHub Actions memory hotspot logs 2026-03-20 06:13:27 +00:00
test-report-utils.test.ts refactor(test): dedupe shared test helpers 2026-03-21 23:07:51 +00:00
test-runner-manifest.test.ts ci: balance shards and reuse pr artifacts 2026-03-24 04:19:43 +00:00
test-update-memory-hotspots-utils.test.ts perf: trim vitest hot imports and refresh manifests 2026-03-23 05:25:05 +00:00
ui.test.ts