Skip to content

Commit b0f52cd

Browse files
committed
docs(devlog): WP2 #398 A-gate folds (60s deadline, post-await abort, docs sync, anthropic redact)
1 parent 17ef552 commit b0f52cd

1 file changed

Lines changed: 61 additions & 0 deletions

File tree

‎devlog/_plan/260724_issue_pr_cleanup/010_wp2_issue398_graceful_degradation.md‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,64 @@ existing redaction). Not a release-workflow change.
9797
Terminal: DONE = degradation code + tests green + 2 issues created + #398 comment.
9898
If B proves too large for one cycle, land the deadline-lowering + defensive catch
9999
first (the direct 499/502 fix) and split structured-metadata into a follow-up.
100+
101+
## P stale-check (WP2 cycle, current tree)
102+
103+
Re-read against current `src/web-search/*`:
104+
- `executor.ts:84-100` and `anthropic-executor.ts` ALREADY degrade HTTP non-2xx
105+
and timeout/connect into `{ error }` and ALREADY `redactSecretString(...)` the
106+
body (`executor.ts:88`). So HTTP 429/401/403/5xx already degrade FAST — they are
107+
not the hang.
108+
- The ONLY 200s source is the sidecar search deadline default:
109+
`index.ts:19 DEFAULT_TIMEOUT_MS = 200_000` → `index.ts:145 timeoutMs =
110+
cfg.timeoutMs ?? DEFAULT_TIMEOUT_MS` → `settings.timeoutMs` →
111+
`executor.ts:73 signalWithTimeout(settings.timeoutMs)`. Vision already uses
112+
45_000 (`vision/index.ts:16`).
113+
- `#398`'s observed `201,434ms` ≈ 200_000ms confirms the deadline is the cause.
114+
115+
### Scoped B for THIS cycle (direct 499/502 fix)
116+
117+
1. MODIFY `src/web-search/index.ts` — lower `DEFAULT_TIMEOUT_MS` 200_000 → 45_000
118+
(sidecar SEARCH deadline only; do NOT touch
119+
`DEFAULT_ROUTED_MODEL_STALL_TIMEOUT_MS`, which is the routed-model body
120+
inactivity budget, a different knob). `cfg.timeoutMs` override still honored;
121+
`webSearchStallTimeoutSec` recomputes from the smaller value automatically.
122+
2. MODIFY `src/web-search/loop.ts` — defensive try/catch around the
123+
`runWebSearch`/`runAnthropicWebSearch` dispatch (~:430) so any future executor
124+
throw becomes a failed `SidecarOutcome` (executors are "never throws" today,
125+
but this makes the contract enforced, not assumed). Re-raise genuine parent
126+
aborts (signal.aborted) so real client cancel stays 499.
127+
3. TEST `tests/web-search.test.ts` — assert the default sidecar deadline is now
128+
bounded (45s) and a thrown executor degrades to a failed cell + completed turn.
129+
130+
### Deferred to follow-up (NOT this commit)
131+
132+
The structured `failure{ kind,status,code }` metadata refactor (A-gate blocker
133+
#1) is DEFERRED — since executors already redact+degrade, it is an enhancement,
134+
not required for the 499/502 fix. Deferring it also removes the secret-safety
135+
risk from this commit (no new raw-body handling is added). It becomes a THIRD
136+
follow-up note in the #398 comment. This matches the "if B too large" clause above.
137+
## A-gate (Halley) folds — GO-WITH-FIXES blockers=3
138+
139+
1. **Deadline 60_000ms, not 45_000.** Per-search deadline; maxSearches=3
140+
sequential; hosted-search p90 ≈ 43s (commit 11cc822e). 45s leaves no tail
141+
margin → use `DEFAULT_TIMEOUT_MS = 60_000`. `cfg.timeoutMs` override intact;
142+
stall watchdog still ≥230s (index.ts:52, stall-timeout.ts:8).
143+
2. **Abort correctness.** Executors already catch parent abort and RETURN
144+
`{error}` (executor.ts:96, anthropic-executor.ts:179) — so checking
145+
`signal.aborted` only in a catch misses the fulfilled `{error}`. Check
146+
`signal.aborted` immediately AFTER the dispatch await (and in catch), and
147+
throw `LoopError(499, "client closed request during web-search")` to match
148+
loop.ts:320/341/377. Add a parent-abort-during-sidecar regression.
149+
3. **Docs sync (SOT-SYNC-01).** 200s default is promised in
150+
`structure/04_transports-and-sidecars.md:129`,
151+
`docs-site/.../reference/configuration.md:380` (+ `:450-451` example) and
152+
translations (`zh-cn/.../configuration.md`). Update the `timeoutMs` default to
153+
60000 there or users override the fix back to 200s.
154+
4. **Bonus security fold (Halley note):** `anthropic-executor.ts:168` places an
155+
UNSANITIZED HTTP body into `error`. Wrap it with `redactSecretString(...)` in
156+
THIS commit (small, real secret-leak) — matches `executor.ts:88`.
157+
158+
Final scoped B: `DEFAULT_TIMEOUT_MS 200_000 → 60_000`; loop.ts defensive
159+
catch + post-await abort→LoopError(499); anthropic-executor body redaction;
160+
docs sync (en + zh-cn + structure/04); regression tests.

0 commit comments

Comments
 (0)