mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 18:20:44 +00:00
Surface Codex usage-limit reset details in chat replies (#77557)
* fix(codex): surface usage limit reset details * fix(codex): satisfy extension lint * fix: surface codex runtime failures in tool-only replies
This commit is contained in:
@@ -2762,6 +2762,37 @@ describe("createTelegramBot", () => {
|
||||
expect(sendMessageSpy).toHaveBeenCalledTimes(1);
|
||||
expect(sendMessageSpy.mock.calls[0][1]).toBe("PFX final reply");
|
||||
});
|
||||
|
||||
it("sends Codex usage-limit reset details as the Telegram reply body", async () => {
|
||||
const codexRateLimitText =
|
||||
"⚠️ You've reached your Codex subscription usage limit. Next reset in 42 minutes (2026-05-04T21:34:00.000Z). Run /codex account for current usage details.";
|
||||
replySpy.mockResolvedValue({ text: codexRateLimitText });
|
||||
loadConfig.mockReturnValue({
|
||||
channels: {
|
||||
telegram: { dmPolicy: "open", allowFrom: ["*"] },
|
||||
},
|
||||
});
|
||||
|
||||
createTelegramBot({ token: "tok" });
|
||||
const handler = getOnHandler("message") as (ctx: Record<string, unknown>) => Promise<void>;
|
||||
await handler({
|
||||
message: {
|
||||
chat: { id: 5, type: "private" },
|
||||
text: "hi",
|
||||
date: 1736380800,
|
||||
},
|
||||
me: { username: "openclaw_bot" },
|
||||
getFile: async () => ({ download: async () => new Uint8Array() }),
|
||||
});
|
||||
|
||||
expect(sendMessageSpy).toHaveBeenCalledTimes(1);
|
||||
expect(sendMessageSpy.mock.calls[0][0]).toBe("5");
|
||||
expect(sendMessageSpy.mock.calls[0][1]).toBe(codexRateLimitText);
|
||||
expect(String(sendMessageSpy.mock.calls[0][1])).not.toContain(
|
||||
"All models are temporarily rate-limited",
|
||||
);
|
||||
});
|
||||
|
||||
it("honors threaded replies for replyToMode=first/all", async () => {
|
||||
for (const [mode, messageId] of [
|
||||
["first", 101],
|
||||
|
||||
Reference in New Issue
Block a user