Skip to content

Commit 260adc7

Browse files
committed
zmedium: auto re-auth detection and CF block retry-with-backoff
- Detect external re-auth via cookie cache mtime and reset session CF counter on next call (no MCP server restart needed). - Retry transient Cloudflare blocks up to 3 times with random 1-4s backoff before surfacing the user-visible "blocked" guidance. classifyError stays pure; counter / mtime side effects move to the retry orchestrator and only commit after every attempt fails. - Add tests for the re-auth reset path and a sleep seam for fast tests. - Ignore local gem Output/ artifacts.
1 parent a92ecfb commit 260adc7

6 files changed

Lines changed: 304 additions & 11 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ coverage/
77
.vscode/
88
.idea/
99
*.tsbuildinfo
10+
Output/

dist/zmedium.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ export interface RunResult {
88
stdout: string;
99
warnings: string;
1010
}
11+
export declare function _setSleepImplForTests(impl: (ms: number) => Promise<void>): void;
12+
export declare function _resetSleepImplForTests(): void;
13+
export declare function _maybeResetForReAuth(): Promise<boolean>;
1114
export declare function _peekCloudflareBlockCountForTests(): number;
15+
export declare function _setCloudflareStateForTests(count: number, mtimeBaseline: number | null): void;
1216
export declare function _resetCloudflareBlockCountForTests(): void;
1317
export declare function runZMedium(opts: RunOpts): Promise<RunResult>;

dist/zmedium.js

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

dist/zmedium.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)