Skip to content

Commit 3a3ad61

Browse files
Merge remote-tracking branch 'upstream/main' into pr-109807-prep
2 parents 8dc2cd4 + db7a5c6 commit 3a3ad61

24 files changed

Lines changed: 1130 additions & 402 deletions

‎.github/workflows/ci.yml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,7 +1352,7 @@ jobs:
13521352
exit 1
13531353
fi
13541354
if [[ "$mergeable" == "true" ]] &&
1355-
git fetch --no-tags --depth=2 origin \
1355+
timeout --signal=TERM --kill-after=10s 120s git fetch --no-tags --depth=2 origin \
13561356
"+refs/pull/${PULL_REQUEST_NUMBER}/merge:refs/remotes/origin/ci-max-lines-merge"; then
13571357
merge_sha="$(git rev-parse refs/remotes/origin/ci-max-lines-merge)"
13581358
read -r merge_base merge_head extra_parent <<<"$(git show -s --format=%P "$merge_sha")"
@@ -1430,11 +1430,11 @@ jobs:
14301430
exit 1
14311431
fi
14321432
merge_base="${merge_parents[0]}"
1433-
git fetch --no-tags --depth=1 origin \
1433+
timeout --signal=TERM --kill-after=10s 120s git fetch --no-tags --depth=1 origin \
14341434
"+${merge_base}:refs/remotes/origin/ci-max-lines-base"
14351435
base_ref="refs/remotes/origin/ci-max-lines-base"
14361436
elif [[ -n "$base_sha" ]]; then
1437-
git fetch --no-tags --depth=1 origin \
1437+
timeout --signal=TERM --kill-after=10s 120s git fetch --no-tags --depth=1 origin \
14381438
"+${base_sha}:refs/remotes/origin/ci-max-lines-base"
14391439
base_ref="refs/remotes/origin/ci-max-lines-base"
14401440
elif [[ -n "${RATCHET_MANUAL_TARGET_SHA:-}" ]]; then
@@ -1455,12 +1455,12 @@ jobs:
14551455
echo "Could not resolve the manual target merge base for the max-lines ratchet." >&2
14561456
exit 1
14571457
fi
1458-
git fetch --no-tags --depth=1 origin \
1458+
timeout --signal=TERM --kill-after=10s 120s git fetch --no-tags --depth=1 origin \
14591459
"+${merge_base_sha}:refs/remotes/origin/ci-max-lines-base"
14601460
base_ref="refs/remotes/origin/ci-max-lines-base"
14611461
else
14621462
default_branch="${RATCHET_DEFAULT_BRANCH:-main}"
1463-
git fetch --no-tags --depth=1 origin \
1463+
timeout --signal=TERM --kill-after=10s 120s git fetch --no-tags --depth=1 origin \
14641464
"+refs/heads/${default_branch}:refs/remotes/origin/ci-max-lines-base"
14651465
base_ref="refs/remotes/origin/ci-max-lines-base"
14661466
fi
@@ -1896,7 +1896,7 @@ jobs:
18961896
fi
18971897
harness_root="${RUNNER_TEMP}/openclaw-ci-shard-runner"
18981898
workflow_remote="https://github.com/${job_workflow_repository}.git"
1899-
git fetch --no-tags --depth=1 "$workflow_remote" "$job_workflow_sha"
1899+
timeout --signal=TERM --kill-after=10s 120s git fetch --no-tags --depth=1 "$workflow_remote" "$job_workflow_sha"
19001900
for file in \
19011901
scripts/ci-run-node-test-shard.mjs \
19021902
scripts/lib/direct-run.mjs \
@@ -2032,7 +2032,7 @@ jobs:
20322032
pnpm check:host-env-policy:swift
20332033
pnpm dup:check:coverage
20342034
if [ -n "$PR_BASE_SHA" ]; then
2035-
git fetch --no-tags --depth=1 origin "+${PR_BASE_SHA}:refs/remotes/origin/ci-base"
2035+
timeout --signal=TERM --kill-after=10s 120s git fetch --no-tags --depth=1 origin "+${PR_BASE_SHA}:refs/remotes/origin/ci-base"
20362036
node scripts/report-test-temp-creations.mjs --base refs/remotes/origin/ci-base --head HEAD --no-merge-base
20372037
fi
20382038
pnpm deps:patches:check

‎docs/concepts/memory-qmd.md‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,13 @@ QMD.
197197

198198
Session hits are still filtered by
199199
[`tools.sessions.visibility`](/gateway/config-tools#toolssessions). The
200-
default `tree` visibility does not expose unrelated same-agent sessions. If a
201-
gateway-dispatched session should be recallable from a separate DM session,
202-
set `tools.sessions.visibility: "agent"` intentionally.
200+
default `tree` visibility includes the current session, its spawned sessions,
201+
and same-agent group sessions watched through ambient group awareness. With
202+
`session.dmScope: "main"`, users in a multi-user DM setup share the main
203+
session and can recall content from its watched groups. Use a per-peer
204+
`dmScope` for DM isolation, or set visibility to `"self"` to opt out of ambient
205+
watched-session reads. Other unrelated same-agent sessions still require
206+
`"agent"` visibility.
203207

204208
## Search scope
205209

‎docs/concepts/memory-search.md‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,13 @@ Optionally index session transcripts so `memory_search` can recall earlier
166166
conversations. This is opt-in: set `experimental.sessionMemory: true` and add
167167
`"sessions"` to `sources` (default `sources` is `["memory"]`).
168168

169-
Session hits obey `tools.sessions.visibility`: the default `"tree"` only
170-
exposes the current session and sessions it spawned. To recall an unrelated
171-
same-agent session from a different session (for example a gateway-dispatched
172-
session from a DM), widen visibility to `"agent"`.
169+
Session hits obey `tools.sessions.visibility`: the default `"tree"` exposes the
170+
current session, sessions it spawned, and same-agent group sessions watched
171+
through ambient group awareness. With `session.dmScope: "main"`, a multi-user
172+
DM setup shares that main session, so users routed there can recall content
173+
from its watched groups. Use a per-peer `dmScope` for DM isolation, or set
174+
visibility to `"self"` to opt out of ambient watched-session reads. Other
175+
unrelated same-agent sessions still require `"agent"` visibility.
173176

174177
When using the QMD backend, also set `memory.qmd.sessions.enabled: true` so
175178
transcripts get exported into the QMD collection; `experimental.sessionMemory`

‎docs/gateway/config-tools.md‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,8 @@ Configures inbound media understanding (image/audio/video):
396396

397397
Controls which sessions can be targeted by the session tools (`sessions_list`, `sessions_history`, `sessions_send`).
398398

399-
Default: `tree` (current session + sessions spawned by it, such as subagents).
399+
Default: `tree` (current session + sessions spawned by it, such as subagents, plus ambient
400+
watched group sessions for the same agent).
400401

401402
```json5
402403
{
@@ -412,7 +413,7 @@ Default: `tree` (current session + sessions spawned by it, such as subagents).
412413
<AccordionGroup>
413414
<Accordion title="Visibility scopes">
414415
- `self`: only the current session key.
415-
- `tree`: current session + sessions spawned by the current session (subagents).
416+
- `tree`: current session + sessions spawned by the current session (subagents). For read operations, it also includes same-agent group sessions that the current session watches through ambient group awareness.
416417
- `agent`: any session belonging to the current agent id (can include other users if you run per-sender sessions under the same agent id).
417418
- `all`: any session. Cross-agent targeting still requires `tools.agentToAgent`.
418419
- Sandbox clamp: when the current session is sandboxed and `agents.defaults.sandbox.sessionToolsVisibility="spawned"` (the default), visibility is forced to `tree` even if `tools.sessions.visibility="all"`.
@@ -423,6 +424,12 @@ Default: `tree` (current session + sessions spawned by it, such as subagents).
423424
</Accordion>
424425
</AccordionGroup>
425426

427+
With the default `session.dmScope: "main"`, human activity in a group makes that same-agent group
428+
session ambiently visible to the agent's main session. In a multi-user setup, `"main"` also shares
429+
one DM session across users, so each user routed there can read from ambiently watched groups,
430+
including through session-memory `memory_search`. Use a per-peer `dmScope` for DM isolation, or set
431+
`tools.sessions.visibility: "self"` to opt out of ambient watched-session reads.
432+
426433
### `tools.sessions_spawn`
427434

428435
Controls inline attachment support for `sessions_spawn`.

‎extensions/discord/src/shared-interactive.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ function appendDiscordButtonBlocks(
142142
blocks: NonNullable<DiscordComponentMessageSpec["blocks"]>,
143143
buttons: readonly MessagePresentationButton[],
144144
): void {
145+
// Index is position in the question's options; core emits one buttons block in option order.
145146
const components = buttons
146147
.map((button, optionIndex) => buildDiscordButtonComponent(button, optionIndex))
147148
.filter((button): button is DiscordComponentButtonSpec => Boolean(button));

‎extensions/line/src/webhook-spool.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ export function createLineWebhookSpool(options: LineWebhookSpoolOptions): LineWe
325325
// Keep the claim owner live until every real delivery and core handler exits;
326326
// disposing earlier lets a replacement drain recover work still producing replies.
327327
await Promise.allSettled(activeDeliveries);
328+
// Accepted shutdown tradeoff: deferred claims may wait for the full agent run.
329+
// A deadline would allow duplicate side effects after replacement recovery;
330+
// remove this wait only when core can cancel or abandon the run before release.
328331
await Promise.allSettled(deferredClaims.values());
329332
await drain.waitForIdle();
330333
drain.dispose();

‎extensions/signal/src/monitor/event-handler.ts‎

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -687,11 +687,11 @@ export function createSignalEventHandler(deps: SignalEventHandlerDeps) {
687687
lifecycle.onAdoptionFinalizing();
688688
}
689689
},
690-
onAbandoned: () => {
690+
onAbandoned: async () => {
691691
handedOff = true;
692-
for (const lifecycle of lifecycles) {
693-
lifecycle.onAbandoned();
694-
}
692+
await Promise.all(
693+
lifecycles.map((lifecycle) => Promise.resolve(lifecycle.onAbandoned())),
694+
);
695695
},
696696
},
697697
// Terminal no-dispatch (gated, whitespace-only, deliberate skip) must
@@ -800,14 +800,16 @@ export function createSignalEventHandler(deps: SignalEventHandlerDeps) {
800800
}
801801
// Keep the current keyed debounce task reserved through backoff so a
802802
// newer same-conversation flush cannot overtake this failed batch.
803-
const retryTask = retrySignalInboundFlush(entries, err).catch((terminalError: unknown) => {
804-
// Exhausted retries: release the drain claims so queue retry policy
805-
// owns redelivery instead of the stall watchdog dead-lettering them.
806-
for (const entry of entries) {
807-
entry.turnAdoptionLifecycle?.onAbandoned();
808-
}
809-
throw terminalError;
810-
});
803+
const retryTask = retrySignalInboundFlush(entries, err).catch(
804+
async (terminalError: unknown) => {
805+
// Exhausted retries: release the drain claims so queue retry policy
806+
// owns redelivery instead of the stall watchdog dead-lettering them.
807+
await Promise.all(
808+
entries.map((entry) => Promise.resolve(entry.turnAdoptionLifecycle?.onAbandoned())),
809+
);
810+
throw terminalError;
811+
},
812+
);
811813
deps.runTrackedTask?.(() => retryTask.catch(() => undefined));
812814
await retryTask;
813815
}

‎extensions/signal/src/signal-ingress.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export type SignalIngressLifecycle = {
4242
onAdopted: () => void | Promise<void>;
4343
onDeferred: () => void;
4444
onAdoptionFinalizing: () => void;
45-
onAbandoned: () => void;
45+
onAbandoned: () => void | Promise<void>;
4646
};
4747

4848
type SignalIngressDispatchResult =

‎extensions/slack/src/blocks-render.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ export function buildSlackInteractiveBlocks(
268268
return state;
269269
}
270270
if (block.type === "buttons") {
271+
// Index is position in the question's options; core emits one buttons block in option order.
271272
const elements = block.buttons
272273
.flatMap((button, choiceIndex) => {
273274
const target = resolveSlackButtonTarget(button, choiceIndex);

‎extensions/telegram/src/button-types.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ function chunkInteractiveButtons(
100100
buttons: readonly MessagePresentationButton[],
101101
rows: TelegramInlineButton[][],
102102
) {
103+
// Index is position in the question's options; core emits one buttons block in option order.
103104
for (let i = 0; i < buttons.length; i += TELEGRAM_INTERACTIVE_ROW_SIZE) {
104105
const row = buttons
105106
.slice(i, i + TELEGRAM_INTERACTIVE_ROW_SIZE)

0 commit comments

Comments
 (0)