Skip to content

Commit 3b3c540

Browse files
authored
refactor: remove dead branches and test-only helpers (#121345)
* refactor: remove dead branches and test-only helpers * fix: preserve codex cleanup error causes * fix: preserve gateway error code compatibility * chore: update plugin sdk api baseline * docs: fix live cache runner path
1 parent 14f8ed1 commit 3b3c540

43 files changed

Lines changed: 587 additions & 705 deletions

Some content is hidden

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

‎config/knip.config.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,6 @@ const config = {
379379
// Declaration companions describe executable JavaScript modules; they are not standalone roots.
380380
"scripts/**/*.d.{mts,ts}",
381381
"**/live-*.ts",
382-
"src/secrets/credential-matrix.ts",
383382
"src/shared/text/assistant-visible-text.ts",
384383
bundledPluginFile("telegram", "src/bot/reply-threading.ts"),
385384
bundledPluginFile("telegram", "src/draft-chunking.ts"),

‎docs/.generated/plugin-sdk-api-baseline.jsonl‎

Lines changed: 466 additions & 466 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/reference/prompt-caching.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ agents:
181181
OpenClaw runs one combined live cache regression gate covering repeated prefixes, tool turns, image turns, MCP-style tool transcripts, and an Anthropic no-cache control.
182182

183183
- `src/agents/live-cache-regression.live.test.ts`
184-
- `src/agents/live-cache-regression-runner.ts`
184+
- `src/agents/test-helpers/live-cache-regression-runner.ts`
185185
- `src/agents/live-cache-regression-baseline.ts`
186186

187187
Run it with:

‎extensions/codex/src/session-catalog.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,6 @@ async function findAdoptedSessionEntry(params: {
906906
return (await listAdoptedSessionEntries(params)).get(params.threadId);
907907
}
908908

909-
class CodexAdoptionBindingCleanupError extends AggregateError {}
910-
911909
async function clearCreatedAdoptionBinding(params: {
912910
bindingStore: CodexAppServerBindingStore;
913911
identity: ReturnType<typeof sessionBindingIdentity>;
@@ -934,19 +932,22 @@ async function clearCreatedAdoptionBinding(params: {
934932
try {
935933
current = await params.bindingStore.read(params.identity);
936934
} catch (readError) {
937-
throw new CodexAdoptionBindingCleanupError(
935+
const cleanupFailure = new AggregateError(
938936
[params.cause, ...(clearError ? [clearError] : []), readError],
939937
`OpenClaw session creation failed and the Codex binding could not be verified for ${params.sourceThreadId}`,
938+
{ cause: readError },
940939
);
940+
throw cleanupFailure;
941941
}
942942
// Pending state is the cleanup CAS token. Once lifecycle work changes it,
943943
// that successor owns every tracked native artifact and must survive here.
944944
if (!matchesPendingSupervisionOwner(current, params.expectedPending)) {
945945
return;
946946
}
947-
throw new CodexAdoptionBindingCleanupError(
947+
throw new AggregateError(
948948
[params.cause, ...(clearError ? [clearError] : [])],
949949
`OpenClaw session creation failed and the Codex binding could not be cleared for ${params.sourceThreadId}`,
950+
{ cause: params.cause },
950951
);
951952
}
952953

‎extensions/memory-core/src/short-term-promotion-memory-write.ts‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ export class MemoryWriteConflictError extends Error {
1010
}
1111
}
1212

13-
class MemoryWriteCommittedError extends Error {
14-
constructor(cause: unknown) {
15-
super("MEMORY.md rename committed before a later write step failed", { cause });
16-
this.name = "MemoryWriteCommittedError";
17-
}
18-
}
19-
2013
export async function resolveMemoryWritePath(filePath: string): Promise<string> {
2114
try {
2215
return await fs.realpath(filePath);
@@ -146,7 +139,9 @@ export async function writeMemoryContent(params: {
146139
// Append-only promotion retains the shipped writable-file fallback when
147140
// directory ACLs block temp-file replacement; consolidation never uses it.
148141
if (renameCommitted) {
149-
throw new MemoryWriteCommittedError(error);
142+
throw new Error("MEMORY.md rename committed before a later write step failed", {
143+
cause: error,
144+
});
150145
}
151146
if (
152147
!params.allowInPlaceFallback ||

‎extensions/telegram/src/sendchataction-401-backoff.ts‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,6 @@ function is401Error(error: unknown): boolean {
8989
return normalizeLowercaseStringOrEmpty(message).includes("unauthorized");
9090
}
9191

92-
class TelegramSendChatActionTransientCooldownError extends Error {
93-
constructor(remainingMs: number) {
94-
super(`sendChatAction transient cooldown active for ${Math.ceil(remainingMs)}ms`);
95-
this.name = "TelegramSendChatActionTransientCooldownError";
96-
}
97-
}
98-
9992
function isTransientSendChatActionError(error: unknown): boolean {
10093
return (
10194
isTelegramRateLimitError(error) ||
@@ -160,7 +153,9 @@ export function createTelegramSendChatActionHandler({
160153
if (remainingTransientCooldownMs > 0) {
161154
// Reject transient cooldown starts so channel typing guards can count the
162155
// failure and stop keepalive loops instead of silently hammering Telegram.
163-
throw new TelegramSendChatActionTransientCooldownError(remainingTransientCooldownMs);
156+
throw new Error(
157+
`sendChatAction transient cooldown active for ${Math.ceil(remainingTransientCooldownMs)}ms`,
158+
);
164159
}
165160

166161
const key = minIntervalMs > 0 ? `${String(chatId)}:${action}` : undefined;

‎extensions/tlon/src/monitor/ingress.ts‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ const TlonIngressPermanentError = createChannelIngressError<"invalid-event" | "t
4444
{ withReason: true },
4545
);
4646

47-
class TlonIngressShutdownError extends Error {
48-
constructor() {
49-
super("Tlon ingress stopped before dispatch adoption.");
50-
this.name = "TlonIngressShutdownError";
51-
}
52-
}
53-
5447
function inspectChannelsEvent(event: unknown): { eventId: string; laneKey: string } | null {
5548
const envelope = isRecord(event) ? event : null;
5649
const nest = nonEmptyString(envelope?.nest);
@@ -207,7 +200,7 @@ export function createTlonIngressMonitor(options: {
207200
onLog: (message) => options.runtime.log?.(`tlon ${message}`),
208201
},
209202
...(options.abortSignal ? { abortSignal: options.abortSignal } : {}),
210-
createStoppedError: () => new TlonIngressShutdownError(),
203+
createStoppedError: () => new Error("Tlon ingress stopped before dispatch adoption."),
211204
onError: (error) =>
212205
options.runtime.error?.(`tlon ingress drain failed: ${formatErrorMessage(error)}`),
213206
});

‎extensions/whatsapp/src/inbound/media.ts‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,6 @@ import { extractContextInfo } from "./extract.js";
77
import { resolveInboundMediaMimetype } from "./media-mimetype.js";
88
import { downloadMediaMessage, normalizeMessageContent } from "./runtime-api.js";
99

10-
class WhatsAppInboundMediaLimitExceededError extends Error {
11-
constructor(maxBytes: number) {
12-
super(`Media exceeds ${Math.round(maxBytes / (1024 * 1024))}MB limit`);
13-
this.name = "WhatsAppInboundMediaLimitExceededError";
14-
}
15-
}
16-
1710
function unwrapMessage(message: proto.IMessage | undefined): proto.IMessage | undefined {
1811
const normalized = normalizeMessageContent(message);
1912
return normalized;
@@ -57,7 +50,7 @@ export async function downloadInboundMedia(
5750
fileName,
5851
).catch((err: unknown) => {
5952
if (err instanceof Error && /Media exceeds/i.test(err.message)) {
60-
throw new WhatsAppInboundMediaLimitExceededError(maxBytes);
53+
throw new Error(`Media exceeds ${Math.round(maxBytes / (1024 * 1024))}MB limit`);
6154
}
6255
throw err;
6356
});

‎packages/gateway-client/src/client.ts‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,6 @@ export class GatewayClientRequestTimeoutError extends Error {
269269
}
270270
}
271271

272-
class GatewayClientTransientPreHelloCloseError extends Error {
273-
constructor() {
274-
super("gateway transient pre-hello clean close");
275-
this.name = "GatewayClientTransientPreHelloCloseError";
276-
}
277-
}
278-
279272
class GatewayClientSocketFactoryConfigurationError extends Error {}
280273

281274
class GatewayClientTransportPolicyError extends GatewayClientSocketFactoryConfigurationError {}
@@ -1140,7 +1133,7 @@ export class GatewayClient {
11401133
return {
11411134
retry: true,
11421135
notify: true,
1143-
pendingError: new GatewayClientTransientPreHelloCloseError(),
1136+
pendingError: new Error("gateway transient pre-hello clean close"),
11441137
};
11451138
}
11461139
if (

‎packages/gateway-protocol/src/gateway-error-details.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ import { asProtocolRecord } from "./protocol-value-normalization.js";
22

33
/** Gateway JSON-RPC style error codes shared by clients and server handlers. */
44
export const ErrorCodes = {
5-
/** Client has not completed account/device linking for this gateway. */
5+
/** @deprecated Retained for source compatibility; no current server emitter. */
66
NOT_LINKED: "NOT_LINKED",
77
/** Device exists but still needs an explicit pairing approval. */
88
NOT_PAIRED: "NOT_PAIRED",
9-
/** Agent turn exceeded the gateway wait window. */
9+
/** @deprecated Retained for source compatibility; no current server emitter. */
1010
AGENT_TIMEOUT: "AGENT_TIMEOUT",
1111
/** Request payload failed protocol validation or method preconditions. */
1212
INVALID_REQUEST: "INVALID_REQUEST",

0 commit comments

Comments
 (0)