Skip to content

Commit 93fbd9f

Browse files
committed
chore(skills): integrate canonical worker cancellation fixture
Adopt main worker prewarm fixture verbatim: its actual ChildProcess close join is stronger than the temporary HTTP peer-close witness. Preserve the health discovery repair and current main runtime changes. All 29 focused integration tests pass; complete P0-scoped review of the integrated PR returned no findings.
2 parents 3564a6b + 5128f34 commit 93fbd9f

59 files changed

Lines changed: 1691 additions & 587 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,6 +2492,16 @@ jobs:
24922492
--configLoader runner
24932493
ui/src/e2e/agent-file-lifecycle.real-gateway.e2e.test.ts
24942494
2495+
- name: Test Control UI media transcript replay with a real Gateway
2496+
env:
2497+
OPENCLAW_CAPTURE_UI_PROOF: ${{ github.event_name == 'workflow_dispatch' && inputs.capture_ui_proof && '1' || '0' }}
2498+
OPENCLAW_UI_E2E_ARTIFACT_DIR: .artifacts/control-ui-e2e/real-gateway
2499+
run: >-
2500+
node scripts/run-vitest.mjs run
2501+
--config test/vitest/vitest.ui-e2e.config.ts
2502+
--configLoader runner
2503+
extensions/qa-lab/src/control-ui-media-transcript.real-gateway.e2e.test.ts
2504+
24952505
- name: Upload sanitized Control UI real-Gateway proof
24962506
if: always() && github.event_name == 'workflow_dispatch' && inputs.capture_ui_proof
24972507
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7

‎config/assertion-safety-baseline.txt‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ extensions/memory-core/src/memory/manager-source-state.ts 2
754754
extensions/memory-core/src/memory/manager-sync-base.ts 5
755755
extensions/memory-core/src/memory/manager-vector-rebuild-state.ts 1
756756
extensions/memory-core/src/memory/manager-watch-ops.ts 4
757-
extensions/memory-core/src/memory/manager.ts 3
757+
extensions/memory-core/src/memory/manager.ts 2
758758
extensions/memory-core/src/memory/project-ranking.ts 1
759759
extensions/memory-core/src/memory/search-deadline.ts 1
760760
extensions/memory-core/src/migration/doctor-host-event-sources.ts 1
@@ -1768,7 +1768,7 @@ src/agents/embedded-agent-runner/model.ts 5
17681768
src/agents/embedded-agent-runner/openrouter-model-capabilities.ts 2
17691769
src/agents/embedded-agent-runner/prepared-compaction-runtime.ts 1
17701770
src/agents/embedded-agent-runner/prompt-cache-observability.ts 2
1771-
src/agents/embedded-agent-runner/replay-history.ts 60
1771+
src/agents/embedded-agent-runner/replay-history.ts 59
17721772
src/agents/embedded-agent-runner/result-fallback-classifier.ts 2
17731773
src/agents/embedded-agent-runner/run-entry.ts 3
17741774
src/agents/embedded-agent-runner/run-orchestrator.ts 1
@@ -2695,7 +2695,7 @@ src/config/sessions/transcript-recent-window.ts 1
26952695
src/config/sessions/transcript-replay.ts 1
26962696
src/config/sessions/transcript-stream.ts 1
26972697
src/config/sessions/transcript-tree.ts 3
2698-
src/config/sessions/transcript.ts 16
2698+
src/config/sessions/transcript.ts 15
26992699
src/config/sessions/types.ts 1
27002700
src/config/state-dir-dotenv.ts 1
27012701
src/config/talk.ts 1
@@ -2821,7 +2821,7 @@ src/gateway/hooks.ts 1
28212821
src/gateway/live-agent-probes.ts 1
28222822
src/gateway/live-chat-projector.ts 1
28232823
src/gateway/local-request-context.ts 2
2824-
src/gateway/managed-image-attachments.ts 8
2824+
src/gateway/managed-image-attachments.ts 5
28252825
src/gateway/mcp-app-operations.ts 3
28262826
src/gateway/mcp-app-reconstruction.ts 3
28272827
src/gateway/mcp-grant-store.ts 2
@@ -2887,7 +2887,7 @@ src/gateway/server-methods/chat-send-attachments.ts 1
28872887
src/gateway/server-methods/chat-send-reply-dispatch.ts 2
28882888
src/gateway/server-methods/chat-send-request.ts 1
28892889
src/gateway/server-methods/chat-server-timing.ts 1
2890-
src/gateway/server-methods/chat-transcript-inject.ts 2
2890+
src/gateway/server-methods/chat-transcript-inject.ts 1
28912891
src/gateway/server-methods/chat-transcript-persistence.ts 7
28922892
src/gateway/server-methods/chat-tts-markers.ts 1
28932893
src/gateway/server-methods/chat.ts 2

‎docs/cli/index.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Setup commands by intent:
2222
| Area | Commands |
2323
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
2424
| Setup and onboarding | [`openclaw`](/cli/openclaw) · [`setup`](/cli/setup) · [`onboard`](/cli/onboard) · [`configure`](/cli/configure) · [`config`](/cli/config) · [`completion`](/cli/completion) · [`doctor`](/cli/doctor) · [`dashboard`](/cli/dashboard) |
25-
| Reset, backup, and migration | [`backup`](/cli/backup) · [`migrate`](/cli/migrate) · [`reset`](/cli/reset) · [`uninstall`](/cli/uninstall) · [`update`](/cli/update) |
25+
| Reset, backup, and migration | [`backup`](/cli/backup) · [`database`](/reference/database-schemas) · [`migrate`](/cli/migrate) · [`reset`](/cli/reset) · [`uninstall`](/cli/uninstall) · [`update`](/cli/update) |
2626
| Messaging and agents | [`message`](/cli/message) · [`agent`](/cli/agent) · [`agents`](/cli/agents) · [`attach`](/cli/attach) · [`acp`](/cli/acp) · [`mcp`](/cli/mcp) |
2727
| Health and sessions | [`status`](/cli/status) · [`health`](/cli/health) · [`triage`](/cli/triage) · [`sessions`](/cli/sessions) · [`resume`](/cli/resume) · [`audit`](/cli/audit) |
2828
| Gateway and logs | [`fleet`](/cli/fleet) · [`gateway`](/cli/gateway) · [`logs`](/cli/logs) · [`system`](/cli/system) |
@@ -124,6 +124,11 @@ openclaw [--dev] [--profile <name>] <command>
124124
file
125125
schema
126126
validate
127+
database
128+
preflight
129+
ownership
130+
status
131+
claim
127132
completion
128133
doctor
129134
triage

‎docs/concepts/memory-builtin.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,14 @@ which support selective deletion after promotion. For coverage and limits, see
117117

118118
Full reindexes build a replacement in a temporary database and publish the
119119
memory tables atomically. Concurrent searches and status reads keep using the
120-
published index; a failed rebuild leaves that index intact.
120+
published index; a failed rebuild leaves that index intact. The embedding cache
121+
is bounded before publication, not after copying excess entries into the
122+
shared database.
123+
124+
`openclaw memory status` reports stored chunk text and JSON embedding bytes
125+
for each source (`sourceCounts[].chunkBytes` in JSON). These are payload sizes,
126+
not total disk usage: embedding cache, FTS/vector tables, SQLite overhead, and
127+
WAL/free pages are excluded.
121128

122129
After an upgrade, automatic project and trigger recall may need to repair
123130
legacy provenance. That repair runs in the background. Replies continue while

‎docs/plugins/sdk-overview.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,18 @@ For paired-node features, prefer
623623
`api.registerCli(..., { parentPath: ["nodes"] })` and makes commands such as
624624
`openclaw nodes canvas` explicit plugin-owned node features.
625625

626+
Reuse the core node CLI owners when a plugin-owned node command needs the same
627+
Gateway flags, invoke envelope, terminal presentation, and authorization hints:
628+
629+
```typescript
630+
import {
631+
buildNodeInvokeParams,
632+
getNodesTheme,
633+
nodesCallOpts,
634+
runNodesCommand,
635+
} from "openclaw/plugin-sdk/node-cli-runtime";
636+
```
637+
626638
If you want a plugin command to stay lazy-loaded in the normal root CLI path,
627639
provide `descriptors` that cover every top-level command root exposed by that
628640
registrar.

‎docs/plugins/sdk-subpaths.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ Use `isLoopbackHost(host)` when a plugin must accept only the local machine. It
263263
| `plugin-sdk/node-selection-runtime` | Private-local bundled runtime facade for shared capability-gated node selection policy |
264264
| `plugin-sdk/cli-argv` | Dependency-light root-option parsing for CLI metadata, including `getRootOptionAwareCommandPath` and `consumeRootOptionToken` |
265265
| `plugin-sdk/cli-runtime` | Private-local after July 2026; Deprecated broad barrel for CLI formatting, wait, version, argument-invocation, and lazy command-group helpers; prefer focused CLI/runtime subpaths |
266+
| `plugin-sdk/node-cli-runtime` | Shared node CLI Gateway options, invoke envelope, terminal presentation, and authorization-hint error handling for plugin-owned node commands |
266267
| `plugin-sdk/qa-runner-runtime` | Private-local after July 2026; Supported facade exposing plugin QA scenarios through the CLI command surface |
267268
| `plugin-sdk/tts-runtime` | Private-local after July 2026; Supported facade for text-to-speech config schemas and runtime helpers |
268269
| `plugin-sdk/gateway-config-runtime` | Private-local bundled runtime facade for dependency-light Gateway port resolution (`resolveGatewayPort`); not for third-party plugins |

‎extensions/canvas/src/cli.ts‎

Lines changed: 10 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
/**
22
* Canvas node CLI command registration and runtime dependency wiring.
33
*/
4-
import { randomUUID } from "node:crypto";
54
import type { Command } from "commander";
6-
import { runCommandWithRuntime, theme } from "openclaw/plugin-sdk/cli-runtime";
7-
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
85
import {
96
callGatewayFromCli,
107
isGatewayClientRequestError,
118
resolveNodeFromNodeList,
129
type NodeMatchCandidate,
1310
} from "openclaw/plugin-sdk/gateway-runtime";
11+
import {
12+
buildNodeInvokeParams,
13+
getNodesTheme,
14+
nodesCallOpts,
15+
runNodesCommand,
16+
} from "openclaw/plugin-sdk/node-cli-runtime";
1417
import {
1518
addTimerTimeoutGraceMs,
1619
clampPositiveTimerTimeoutMs,
1720
parseStrictFiniteNumber,
1821
parseStrictPositiveInteger,
1922
} from "openclaw/plugin-sdk/number-runtime";
2023
import { defaultRuntime } from "openclaw/plugin-sdk/runtime";
21-
import {
22-
normalizeLowercaseStringOrEmpty,
23-
normalizeOptionalString,
24-
} from "openclaw/plugin-sdk/string-coerce-runtime";
24+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
2525

2626
/** Runtime output surface used by Canvas CLI commands. */
2727
type CanvasCliRuntime = {
@@ -136,33 +136,8 @@ function parseNodeCandidates(raw: unknown): CanvasNodeCandidate[] {
136136
.filter((entry): entry is CanvasNodeCandidate => entry !== null);
137137
}
138138

139-
function unauthorizedHintForMessage(message: string): string | null {
140-
const haystack = normalizeLowercaseStringOrEmpty(message);
141-
if (
142-
haystack.includes("unauthorizedclient") ||
143-
haystack.includes("bridge client is not authorized") ||
144-
haystack.includes("unsigned bridge clients are not allowed")
145-
) {
146-
return [
147-
"peekaboo bridge rejected the client.",
148-
"sign the peekaboo CLI (TeamID Y5PE65HELJ) or launch the host with",
149-
"PEEKABOO_ALLOW_UNSIGNED_SOCKET_CLIENTS=1 for local dev.",
150-
].join(" ");
151-
}
152-
return null;
153-
}
154-
155139
/** Creates the default Canvas CLI dependency bundle backed by the OpenClaw gateway CLI. */
156140
export function createDefaultCanvasCliDependencies(): CanvasCliDependencies {
157-
const nodesCallOpts = (cmd: Command, defaults?: { timeoutMs?: number }) =>
158-
cmd
159-
.option(
160-
"--url <url>",
161-
"Gateway WebSocket URL (defaults to gateway.remote.url when configured)",
162-
)
163-
.option("--token <token>", "Gateway token (if required)")
164-
.option("--timeout <ms>", "Timeout in ms", String(defaults?.timeoutMs ?? 10_000))
165-
.option("--json", "Output JSON", false);
166141
const callGatewayCli: CanvasCliDependencies["callGatewayCli"] = async (
167142
method,
168143
opts,
@@ -177,17 +152,8 @@ export function createDefaultCanvasCliDependencies(): CanvasCliDependencies {
177152
return {
178153
defaultRuntime,
179154
nodesCallOpts,
180-
runNodesCommand: (label, action) =>
181-
runCommandWithRuntime(defaultRuntime, action, (err) => {
182-
const message = formatErrorMessage(err);
183-
defaultRuntime.error(theme.error(`nodes ${label} failed: ${message}`));
184-
const hint = unauthorizedHintForMessage(message);
185-
if (hint) {
186-
defaultRuntime.error(theme.warn(hint));
187-
}
188-
defaultRuntime.exit(1);
189-
}),
190-
getNodesTheme: () => ({ ok: theme.success }),
155+
runNodesCommand,
156+
getNodesTheme,
191157
parseTimeoutMs,
192158
resolveNodeId: async (opts, query) => {
193159
let raw: unknown;
@@ -206,13 +172,7 @@ export function createDefaultCanvasCliDependencies(): CanvasCliDependencies {
206172
}
207173
return resolveNodeFromNodeList(parseNodeCandidates(raw), query).nodeId;
208174
},
209-
buildNodeInvokeParams: ({ nodeId, command, params, timeoutMs }) => ({
210-
nodeId,
211-
command,
212-
params,
213-
idempotencyKey: randomUUID(),
214-
...(typeof timeoutMs === "number" && Number.isFinite(timeoutMs) ? { timeoutMs } : {}),
215-
}),
175+
buildNodeInvokeParams,
216176
callGatewayCli,
217177
};
218178
}

‎extensions/memory-core/src/cli-status.runtime.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
resolveMemoryLightDreamingConfig,
77
resolveMemoryRemDreamingConfig,
88
} from "openclaw/plugin-sdk/memory-core-host-status";
9+
import { formatByteSize } from "openclaw/plugin-sdk/number-runtime";
910
import { asNullableRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
1011
import {
1112
formatAuditCounts,
@@ -373,7 +374,16 @@ export async function runMemoryStatus(
373374
total === null
374375
? `${entry.files}/? files · ${entry.chunks} chunks`
375376
: `${entry.files}/${total} files · ${entry.chunks} chunks`;
376-
lines.push(` ${accent(entry.source)} ${muted("·")} ${muted(counts)}`);
377+
const payload =
378+
entry.chunkBytes === undefined
379+
? ""
380+
: ` · ${formatByteSize(entry.chunkBytes, {
381+
style: "iec",
382+
maxUnit: "tera",
383+
separator: " ",
384+
fractionDigits: 1,
385+
})} text + embeddings`;
386+
lines.push(` ${accent(entry.source)} ${muted("·")} ${muted(counts + payload)}`);
377387
}
378388
}
379389
if (status.fallback) {

‎extensions/memory-core/src/cli.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,7 @@ describe("memory cli", () => {
710710
makeMemoryStatus({
711711
files: 2,
712712
chunks: 5,
713+
sourceCounts: [{ source: "memory", files: 2, chunks: 5, chunkBytes: 2048 }],
713714
cache: { enabled: true, entries: 123, maxEntries: 50000 },
714715
fts: { enabled: true, available: true },
715716
vector: {
@@ -735,6 +736,7 @@ describe("memory cli", () => {
735736
expectLogged(log, "Vector dims: 1024");
736737
expectLogged(log, "Vector path: /opt/sqlite-vec.dylib");
737738
expectLogged(log, "FTS: ready");
739+
expectLogged(log, "2.0 KiB text + embeddings");
738740
expectLogged(log, "Embedding cache: enabled (123 entries)");
739741
expect(close).toHaveBeenCalled();
740742
});

‎extensions/memory-core/src/memory/index.test.ts‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2300,6 +2300,38 @@ describe("memory index", () => {
23002300
}
23012301
});
23022302

2303+
it("refreshes diagnostic byte totals after indexing without changing the serving manager", async () => {
2304+
const cfg = createCfg({ provider: "none" });
2305+
const serving = await getPersistentManager(cfg);
2306+
await serving.sync({ reason: "test", force: true });
2307+
const diagnostic = await getFreshManager(cfg, "cli", true);
2308+
try {
2309+
expect(diagnostic).not.toBe(serving);
2310+
const previousBytes = diagnostic.status().sourceCounts?.[0]?.chunkBytes;
2311+
expect(previousBytes).toBeGreaterThan(0);
2312+
await fs.writeFile(
2313+
path.join(fixture.paths.memory, "2026-01-12.md"),
2314+
"# Reindexed diagnostic\n\nFresh expedition notes 🦞 with a different stored payload size.\n",
2315+
);
2316+
2317+
await diagnostic.sync({ reason: "cli", force: true });
2318+
2319+
const db = Reflect.get(diagnostic, "db") as DatabaseSync;
2320+
const storedBytes = db
2321+
.prepare(
2322+
"SELECT SUM(length(CAST(text AS BLOB)) + length(CAST(embedding AS BLOB))) AS bytes FROM memory_index_chunks WHERE source = 'memory'",
2323+
)
2324+
.get()?.bytes;
2325+
const refreshedBytes = diagnostic.status().sourceCounts?.[0]?.chunkBytes;
2326+
expect(refreshedBytes).toBe(storedBytes);
2327+
expect(refreshedBytes).not.toBe(previousBytes);
2328+
} finally {
2329+
await diagnostic.close();
2330+
}
2331+
expect((await getMemorySearchManager({ cfg, agentId: "main" })).manager).toBe(serving);
2332+
expect(serving.status().sourceCounts?.[0]?.chunkBytes).toBeUndefined();
2333+
});
2334+
23032335
it("reports vector availability after probe", async () => {
23042336
const cfg = createCfg({ vectorEnabled: true });
23052337
const manager = await getPersistentManager(cfg);

0 commit comments

Comments
 (0)