Commit Graph

768 Commits

Author SHA1 Message Date
Peter Steinberger fc5fdcb091
refactor(plugin-sdk): remove bundled provider setup shims 2026-03-29 20:23:20 +01:00
George Zhang e133924047
[codex] harden clawhub plugin publishing and install (#56870)
* fix: harden clawhub plugin publishing and install

* fix(process): preserve windows shim exit success
2026-03-29 11:59:19 -07:00
Tyler Yust 798e5f9501 plugin-sdk: fix provider setup import cycles 2026-03-29 09:59:52 -07:00
Peter Steinberger 8109195ad8
fix(plugin-sdk): avoid recursive bundled facade loads 2026-03-29 15:00:25 +01:00
Peter Steinberger 24d16c39ad
refactor(plugin-sdk): remove source alias residue 2026-03-29 14:53:03 +01:00
Thomas M 0a01386756
fix: canonicalize session keys at write time (#30654) (thanks @thomasxm)
* fix: canonicalize session keys at write time to prevent orphaned sessions (#29683)

resolveSessionKey() uses hardcoded DEFAULT_AGENT_ID="main", but all read
paths canonicalize via cfg. When the configured default agent differs
(e.g. "ops" with mainKey "work"), writes produce "agent:main:main" while
reads look up "agent:ops:work", orphaning transcripts on every restart.

Fix all three write-path call sites by wrapping with
canonicalizeMainSessionAlias:
- initSessionState (auto-reply/reply/session.ts)
- runWebHeartbeatOnce (web/auto-reply/heartbeat-runner.ts)
- resolveCronAgentSessionKey (cron/isolated-agent/session-key.ts)

Add startup migration (migrateOrphanedSessionKeys) to rename existing
orphaned keys to canonical form, merging by most-recent updatedAt.

* fix: address review — track agent IDs in migration map, align snapshot key

P1: migrateOrphanedSessionKeys now tracks agentId alongside each store
path in a Map instead of inferring from the filesystem path. This
correctly handles custom session.store templates outside the default
agents/<id>/ layout.

P2: Pass the already-canonicalized sessionKey to getSessionSnapshot so
the heartbeat snapshot reads/restores use the same key as the write path.

* fix: log migration results at all early return points

migrateOrphanedSessionKeys runs before detectLegacyStateMigrations, so
it can canonicalize legacy keys (e.g. "main" → "agent:main:main") before
the legacy detector sees them. This caused the early return path to skip
logging, breaking doctor-state-migrations tests that assert log.info was
called.

Extract logMigrationResults helper and call it at every return point.

* fix: handle shared stores and ~ expansion in migration

P1: When session.store has no {agentId}, all agents resolve to the same
file. Track all agentIds per store path (Map<path, Set<id>>) and run
canonicalization once per agent. Skip cross-agent "agent:main:*"
remapping when "main" is a legitimate configured agent sharing the store,
to avoid merging its data into another agent's namespace.

P2: Use expandHomePrefix (environment-aware ~ resolution) instead of
os.homedir() in resolveStorePathFromTemplate, matching the runtime
resolveStorePath behavior for OPENCLAW_HOME/HOME overrides.

* fix: narrow cross-agent remap to provable orphan aliases only

Only remap agent:main:* keys where the suffix is a main session alias
("main" or the configured mainKey). Other agent:main:* keys — hooks,
subagents, cron sessions, per-sender keys — may be intentional
cross-agent references and must not be silently moved into another
agent's namespace.

* fix: run orphan-key session migration at gateway startup (#29683)

* fix: canonicalize cross-agent legacy main aliases in session keys (#29683)

* fix: guard shared-store migration against cross-agent legacy alias remap (#29683)

* refactor: split session-key migration out of pr 30654

---------

Co-authored-by: Your Name <your_email@example.com>
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-03-29 18:59:25 +05:30
Peter Steinberger 270d0c5158
fix: avoid telegram plugin self-recursive sdk imports 2026-03-29 11:32:29 +01:00
Peter Steinberger 8e0ab35b0e
refactor(plugins): decouple bundled plugin runtime loading 2026-03-29 09:10:38 +01:00
Peter Steinberger 04c976b43d
refactor(markdown): share render-aware chunking 2026-03-29 16:33:22 +09:00
Ayaan Zaidi 1791c7c304 fix: unify telegram exec approval auth 2026-03-29 10:45:57 +05:30
Subash Natarajan aee7992629 fix(telegram): accept approval callbacks from forwarding target recipients
When approvals.exec.targets routes to a Telegram DM, the recipient
receives inline approval buttons but may not have explicit
channels.telegram.execApprovals configured. This adds a fallback
isTelegramExecApprovalTargetRecipient check so those DM recipients
can act on the buttons they were sent.

Includes accountId scoping for multi-bot deployments and 9 new tests.
2026-03-29 10:45:57 +05:30
Peter Steinberger 148a65fe90 refactor: share webhook channel status helpers 2026-03-29 02:11:22 +01:00
Peter Steinberger 9e1b524a00 fix: break mattermost runtime cycle 2026-03-29 00:43:58 +00:00
Harold Hunt fcee6fa047
Docs: add boundary AGENTS guides (#56647) 2026-03-28 20:22:03 -04:00
Peter Steinberger 5872f860c9 feat(xai): add plugin-owned x_search onboarding 2026-03-29 00:12:37 +00:00
Peter Steinberger 887d7584d6 refactor(plugins): expose bundled onboard helpers 2026-03-28 21:35:13 +00:00
Ayaan Zaidi b31cd35b36
test(plugin-sdk): align matrix runtime api guardrail 2026-03-28 16:20:33 +05:30
Ayaan Zaidi 8ea5c22985
fix(matrix): avoid heavy jiti runtime barrels 2026-03-28 15:35:05 +05:30
Peter Steinberger a955537a61 fix: slim provider sdk surfaces 2026-03-28 09:35:42 +00:00
Ayaan Zaidi 40a09cc582
fix(irc): avoid registry bootstrap in plugin sdk seam 2026-03-28 14:58:02 +05:30
Kenny Xie cb5afdf108
fix: prevent matrix-js-sdk plugin load crash (#56273) (thanks @aquaright1)
* Fix matrix-js-sdk multiple entrypoint crash on plugin load

* test(matrix): cover runtime bundle import regression

* fix: prevent matrix-js-sdk plugin load crash (#56273) (thanks @aquaright1)

* fix: widen matrix-js-sdk bundle import guard (#56273) (thanks @aquaright1)

---------

Co-authored-by: Kenny Xie <kennyxie@Mac-mini-von-Kenny.local>
Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-03-28 14:27:54 +05:30
Peter Steinberger 30be04cd87 fix: include matrix runtime deps for bundled installs 2026-03-28 07:27:29 +00:00
Peter Steinberger 61936938e9 refactor: move test harnesses off infra runtime 2026-03-28 06:52:06 +00:00
Peter Steinberger c65ec46490 refactor: trim remaining infra runtime residue 2026-03-28 06:41:56 +00:00
Peter Steinberger 922c90e9fa refactor: add approval runtime sdk seam 2026-03-28 06:33:07 +00:00
Peter Steinberger 0d98ce1065 refactor: add diagnostic and error runtime sdk seams 2026-03-28 06:26:38 +00:00
Peter Steinberger 70c2458861 refactor: add host and collection runtime sdk seams 2026-03-28 06:19:16 +00:00
Peter Steinberger d042192c7c
refactor(plugins): move provider policy hooks into plugins 2026-03-28 06:11:13 +00:00
Peter Steinberger c222a44e6f refactor: add retry runtime sdk seam 2026-03-28 05:59:07 +00:00
Peter Steinberger 83135c31c9
refactor(acp): extract generic current conversation binding store 2026-03-28 05:53:07 +00:00
Peter Steinberger a126d23f0d refactor: add fetch runtime sdk seam 2026-03-28 05:44:33 +00:00
Peter Steinberger b236f39104
refactor(agents): generalize tool schema compat cleanup 2026-03-28 05:42:46 +00:00
Peter Steinberger c7883fe892
refactor(plugins): register provider model id hooks 2026-03-28 05:42:46 +00:00
Peter Steinberger 49f693d06a refactor: widen webhook request guard sdk seam 2026-03-28 05:28:10 +00:00
Peter Steinberger d5841f6412
refactor: centralize plugin API assembly 2026-03-28 05:24:25 +00:00
Peter Steinberger 23f0486810 fix: stabilize plugin startup boundaries 2026-03-28 05:22:26 +00:00
Peter Steinberger ab2bd34b66
refactor(xai): split provider compat facades
Co-authored-by: Harold Hunt <harold@pwrdrvr.com>
2026-03-28 05:02:41 +00:00
Tak Hoffman 7779205aa1
Keep matrix SDK external in bundle checks 2026-03-27 23:41:00 -05:00
kakahu 158e7c517e
fix(matrix): resolve env SecretRef fallback in clean() for channel startup (#54980)
Merged via squash.

Prepared head SHA: b71a86e68e
Co-authored-by: kakahu2015 <17962485+kakahu2015@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
2026-03-28 00:21:57 -04:00
Peter Steinberger bd28e6d444 refactor: move transport readiness onto channel runtime 2026-03-28 04:13:40 +00:00
Peter Steinberger 4beb231fd8 refactor: move heartbeat helpers onto channel runtime 2026-03-28 04:09:25 +00:00
Peter Steinberger 49968982a5
fix(plugin-sdk): avoid testing export drift 2026-03-28 03:53:38 +00:00
Peter Steinberger ec9f96cb2a
refactor(plugin-sdk): align binding contract imports 2026-03-28 03:53:38 +00:00
Peter Steinberger 66c4c3bec8 test: align matrix runtime api allowlist 2026-03-28 03:40:51 +00:00
Tak Hoffman 967702d928
test(regression): cover irc plugin-sdk facade exports 2026-03-27 22:28:04 -05:00
Peter Steinberger 2b450ab629 refactor: move discord system events onto channel runtime 2026-03-28 03:27:12 +00:00
Tak Hoffman 83adbc840c
fix(regression): restore irc cold-runtime chunking 2026-03-27 22:24:27 -05:00
Tak Hoffman 3b8564a7c6
test(regression): cover setup and policy plugin-sdk facades 2026-03-27 22:20:40 -05:00
Peter Steinberger 0825ff9619 refactor: move discord duration formatting onto runtime env 2026-03-28 03:17:40 +00:00
Tak Hoffman c1abf7c8c0
test(regression): cover bluebubbles plugin-sdk facade exports 2026-03-27 22:15:22 -05:00