fix(scm-github): throttle repeated GitHub ETag network warnings
Resolves #1526.
Summary
- Suppresses repeated transient network warnings from GitHub ETag guard checks per guard/cache key.
- Clears suppression after a successful guard response so future outages still log once.
Root cause
When gh api repeatedly failed for transient connectivity reasons, every poll emitted the same warning even though the fallback behavior was already safe.
Approach
Classify common transient network messages, remember which guard/key has already warned, and reset that memory on successful 200/304 responses. Non-transient failures keep logging every time.
Verification
pnpm --filter @aoagents/ao-plugin-scm-github test -- graphql-batch.test.tspnpm --filter @aoagents/ao-plugin-scm-github typecheckpnpm --filter @aoagents/ao-plugin-scm-github test
Greptile Summary
This PR introduces a per-guard/per-cache-key transient-warning throttle for the three GitHub ETag guards in graphql-batch.ts. When a network error matches a known transient pattern, only the first failure for a given guard+key pair is logged; subsequent identical failures are suppressed until a successful 200 or 304 response clears the key. All three guards and every success/304 path (including catch-path 304s) were updated in this version.
- Adds
TRANSIENT_NETWORK_PATTERNS, a module-leveltransientNetworkWarningKeysSet, and helperswarnETagGuardFailure/markETagGuardSuccess/pruneTransientNetworkWarningKeysto manage suppression state. - Updates Guards 1, 2, and 3 to route failures through
warnETagGuardFailureand to callmarkETagGuardSuccesson every normal success and on every 304 path (both try-path and catch-path). - Adds targeted tests covering: first-warning emission, repeated suppression, recovery on catch-path 304, and pass-through of non-transient errors.
Confidence Score: 5/5
Safe to merge — all three ETag guards are consistently updated, every 304 and success path clears the suppression key, and the fallback behavior is preserved on every error path.
The change is purely additive observability throttling. Suppression only affects logging, never the returned boolean, so data correctness cannot regress. All catch-path 304 branches now call markETagGuardSuccess, Guard 3 is fully wired up, duplicate imports in the test file are gone, and clearETagCache resets the new Set.
No files require special attention.
Important Files Changed
| Filename | Overview |
|---|---|
| packages/plugins/scm-github/src/graphql-batch.ts | Adds throttling helpers and wires them into all three ETag guards; all catch-path 304 branches now call markETagGuardSuccess, and clearETagCache clears the suppression set. Previously flagged gaps are resolved. |
| packages/plugins/scm-github/test/graphql-batch.test.ts | Adds Guard 1, 2, and 3 throttling tests covering suppression, recovery via catch-path 304, and non-transient pass-through; imports are clean with no duplicates. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[ETag Guard call] --> B{execGhAsync success?}
B -- Yes, 304 --> C[markETagGuardSuccess\nclear suppression key]
B -- Yes, 200 --> C
C --> D[return result]
B -- Error --> E[extractErrorOutput]
E --> F{is304 in output?}
F -- Yes --> C
F -- No --> G{is304 in errorMsg?}
G -- Yes --> C
G -- No --> H[warnETagGuardFailure]
H --> I{isTransientNetworkError?}
I -- No --> J[observer.log warn always]
I -- Yes --> K{warningKey in\ntransientNetworkWarningKeys?}
K -- Yes, suppress --> L[return true\nassume changed]
K -- No --> M[add key to Set\npruneIfNeeded]
M --> J
J --> L
Reviews (3): Last reviewed commit: "fix(scm-github): clear etag warnings on ..." | Re-trigger Greptile
Addressed all review points in 703e6b04.
- Fixed the critical bug: both Guard 1 and Guard 2 now call
markETagGuardSuccess(...)in catch-path 304 branches. - Updated Guard 3 to use shared warning throttling + success reset behavior (including catch-path 304).
- Extracted and expanded transient network patterns (added
ssl,tls,certificate,dial tcp). - Added bounded pruning for transient warning keys to prevent unbounded growth.
- Extended tests for catch-304 recovery (Guards 1/2/3), Guard 3 throttling, and non-transient warnings not being suppressed.
Validation:
pnpm --filter @aoagents/ao-plugin-scm-github test -- test/graphql-batch.test.tspnpm --filter @aoagents/ao-plugin-scm-github typecheck
Want your agent to iterate on Greptile's feedback? Try greploops.
Closing as part of a backlog sweep: Agent Orchestrator was rewritten from the ground up (Go backend + Electron/React frontend), and this PR's changes target files from the pre-rewrite TypeScript codebase that no longer exist in the current tree, so it cannot be rebased onto main. If the underlying change still makes sense for the current app, please open a fresh PR against the new codebase. Thanks for the contribution!