Commit Graph

1960 Commits

Author SHA1 Message Date
Peter Steinberger 276ccd2583
fix(exec): default implicit target to auto 2026-03-30 06:03:08 +09:00
Peter Steinberger f5f8ba6d35 fix: harden bundle MCP session runtime cache (#55090) (thanks @allan0509) 2026-03-30 05:10:32 +09:00
无忌 6477d783e8 Agents: cache bundle MCP runtime per session 2026-03-30 05:10:32 +09: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
Mariano 17c36b5093
Gateway: track background task lifecycle (#52518)
Merged via squash.

Prepared head SHA: 7c4554204e
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
2026-03-29 12:48:02 +02:00
助爪 443295448c
Track ACP sessions_spawn runs and emit ACP lifecycle events (#40885)
* Fix ACP sessions_spawn lifecycle tracking

* fix(tests): resolve leftover merge markers in sessions spawn lifecycle test

* fix(agents): clarify acp spawn cleanup semantics

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-03-29 18:20:10 +09:00
Vincent Koc af694def5b
fix(agents): fail closed on silent turns (#52593)
* fix(agents): fail closed on silent turns

* fix(agents): suppress all silent turn emissions

* fix(agents): pass silent turns into embedded subscribe
2026-03-29 17:40:20 +09:00
Peter Steinberger 8e0ab35b0e
refactor(plugins): decouple bundled plugin runtime loading 2026-03-29 09:10:38 +01:00
Vincent Koc 9777781001
fix(subagents): preserve requester agent for inline announces (#55998)
* fix(subagents): preserve requester agent on inline announce

* docs(changelog): remove maintainer follow-up entry
2026-03-29 17:00:05 +09:00
Ayaan Zaidi d5e59621a7 fix: keep telegram plugin fallback explicit (#45911) (thanks @suboss87) 2026-03-29 10:45:57 +05:30
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
Tak Hoffman f1970b8aef
fix(line): normalize canonical ACP targets (#56713) 2026-03-28 21:05:34 -05:00
Tak Hoffman 6f7ff545dd
fix(line): add ACP binding parity (#56700)
* fix(line): support ACP current-conversation binding

* fix(line): add ACP binding routing parity

* docs(changelog): note LINE ACP parity

* fix(line): accept canonical ACP binding targets
2026-03-28 20:52:31 -05:00
AaronLuo00 971ecabe80 fix(memory): account for CJK characters in QMD memory chunking
The QMD memory system uses a fixed 4:1 chars-to-tokens ratio for chunk
sizing, which severely underestimates CJK (Chinese/Japanese/Korean) text
where each character is roughly 1 token. This causes oversized chunks for
CJK users, degrading vector search quality and wasting context window space.

Changes:
- Add shared src/utils/cjk-chars.ts module with CJK-aware character
  counting (estimateStringChars) and token estimation helpers
- Update chunkMarkdown() in src/memory/internal.ts to use weighted
  character lengths for chunk boundary decisions and overlap calculation
- Replace hardcoded estimateTokensFromChars in the context report
  command with the shared utility
- Add 13 unit tests for the CJK estimation module and 5 new tests for
  CJK-aware memory chunking behavior

Backward compatible: pure ASCII/Latin text behavior is unchanged.

Closes #39965
Related: #40216
2026-03-29 10:22:43 +09:00
Gustavo Madeira Santana 2afc655bd5
ACP: document Matrix bind-here support 2026-03-28 21:07:58 -04:00
Robin Waslander 17479ceb43
fix(auto-reply): suppress JSON-wrapped NO_REPLY payloads before channel delivery (#56612)
Add shared isSilentReplyPayloadText() detector that catches both bare
NO_REPLY tokens and JSON {"action":"NO_REPLY"} envelopes. Apply at the
reply directive parser, reply normalizer, and embedded agent payload
builder so the control payload is stripped before any channel sees it.

Preserves media when text is only a silent control envelope.

Fixes #37727
2026-03-28 22:07:24 +01:00
Frank Yang c14b169a1b
fix(acp): repair stale bindings after runtime exits (#56476)
* fix(acp): repair stale bindings after runtime exits

* fix(acp): narrow stale binding recovery

* fix(acp): preserve policy gating for stale sessions

* fix(acp): handle signal exits and canonical unbinds

* fix(acp): harden canonical stale-session recovery
2026-03-29 01:15:16 +08:00
Saurabh Mishra 90e82fabb3
fix: display model name instead of ID in Telegram model selector (#56165) (#56175)
* fix: display model name instead of ID in Telegram model selector (#56165)

* fix(telegram): scope model display names by provider

Signed-off-by: sallyom <somalley@redhat.com>

---------

Signed-off-by: sallyom <somalley@redhat.com>
Co-authored-by: sallyom <somalley@redhat.com>
2026-03-28 09:23:09 -04:00
Peter Steinberger dec91c400d fix: keep status display on sync model metadata 2026-03-28 11:37:43 +00:00
Peter Steinberger 84d1781a3a fix: avoid status-time provider normalization recursion 2026-03-28 11:35:33 +00:00
Peter Steinberger 0e11072b84 fix: avoid speech runtime import in status output 2026-03-28 11:35:33 +00:00
Peter Steinberger bd4632b9c1 fix: mark buffered reply typing runs complete 2026-03-28 07:57:28 +00:00
Peter Steinberger 155915e7dc test: dedupe routing and text suites 2026-03-28 07:31:40 +00:00
Peter Steinberger 06fba21a9d
test(acp): cover persisted generic conversation binds 2026-03-28 05:53:07 +00:00
Peter Steinberger 83135c31c9
refactor(acp): extract generic current conversation binding store 2026-03-28 05:53:07 +00:00
Gustavo Madeira Santana b253ca70ef
Tests: stabilize Matrix-related shared suites 2026-03-28 01:52:55 -04:00
Peter Steinberger 19e8e7190b
fix(acp): avoid no-op gateway self-call after spawn 2026-03-28 05:23:55 +00:00
Peter Steinberger dee2bde2f5
test(acp): cover generic conversation binds 2026-03-28 03:53:38 +00:00
Peter Steinberger d0d4b73d25
refactor(acp): centralize conversation binding context 2026-03-28 03:53:38 +00:00
Tak Hoffman ae2b1aef10
fix(regression): normalize model picker provider endpoint aliases 2026-03-27 22:01:39 -05:00
Peter Steinberger 68416fdf83
refactor(acp): generalize message-channel binds 2026-03-28 02:53:54 +00:00
Peter Steinberger c42ec81e37
feat(acp): add conversation binds for message channels 2026-03-28 01:54:25 +00:00
Tak Hoffman d2e25b03fe
fix(regression): preserve external command auth context 2026-03-27 20:24:14 -05:00
Tak Hoffman 8a687bdbd7
fix(regression): preserve spawned metadata across auto-reply reset 2026-03-27 20:24:14 -05:00
Tak Hoffman b598cdf968
fix(regression): preserve discord thread bindings for plugin commands 2026-03-27 20:24:14 -05:00
Peter Steinberger fef688fb7a test: dedupe utility and config suites 2026-03-28 00:26:55 +00:00
Peter Steinberger b8069c2bd1 refactor: trim provider model compat seams 2026-03-28 00:17:28 +00:00
Peter Steinberger 13316a9118 refactor: reuse shared model prefix helper in thinking 2026-03-28 00:00:08 +00:00
Peter Steinberger 4ca07559ab refactor: move provider seams behind plugin sdk surfaces 2026-03-27 23:26:26 +00:00
Peter Steinberger c52f89bd60 test: dedupe helper-heavy test suites 2026-03-27 22:35:27 +00:00
Peter Steinberger 634db43b3f test: debrand fallback and registry pin fixtures 2026-03-27 22:05:34 +00:00
Tak Hoffman c125c33724
fix(regression): honor internal provider auth for directives 2026-03-27 16:15:09 -05:00
Tak Hoffman 1a9abb13bd
fix(regression): preserve CLI continuity across chat reset 2026-03-27 16:01:37 -05:00
Jacob Tomlinson 355abe5eba
Discord: enforce approver checks for text approvals (#56015)
* Discord: gate text approvals by approver policy

* Discord: require approvers for plugin text approvals

* Discord: preserve legacy text approval fallback
2026-03-27 20:37:15 +00:00
Jacob Tomlinson be00fcfccb
Gateway: align chat.send reset scope checks (#56009)
* Gateway: align chat.send reset scope checks

* Gateway: tighten chat.send reset regression test

* Gateway: honor internal provider reset scope
2026-03-27 20:36:31 +00:00
Jacob Tomlinson c603123528
fix(gateway): require admin for persisted verbose defaults (#55916)
* fix(gateway): require admin for verbose persistence

* gateway: tighten verbose persistence follow-ups
2026-03-27 19:04:02 +00:00
Peter Steinberger ed055f44ae refactor: route plugin runtime through bundled seams 2026-03-27 16:40:27 +00:00
Peter Steinberger 89267f4273 test: finish reply seam cleanup 2026-03-27 16:22:27 +00:00
Peter Steinberger cd92549119 test: split extension-owned core coverage 2026-03-27 16:08:57 +00:00