Skip to content

feat(sse): record per-request added wait with cause in call logs - #14756

Merged
diegosouzapw merged 6 commits into
diegosouzapw:release/v3.8.51from
maxmad64bis:fix/request-added-wait
Sep 25, 2026
Merged

diegosouzapw merged 6 commits into
diegosouzapw:release/v3.8.51from
maxmad64bis:fix/request-added-wait

Conversation

@maxmad64bis

@maxmad64bis maxmad64bis commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #14750. Only the last commit is this PR's; I'll rebase once it lands.

⚠️ base-red inherited: #14547

Summary

Per-request latency hides where the wait was suffered: egress pacing and park time never reach the call log, so a slow request cannot be told apart from a slow upstream. A request-scoped accumulator measures the added wait at the dispatch call-site, carries it through the capture sink, and stores it in two nullable columns (added_wait_ms, added_wait_cause), surfaced in the journal columns and detail view. Null means unmeasured, never zero.

Related Issues

No linked issue — per-request added-wait attribution has no prior ticket.

Validation

  • Change type: sse
  • Focused tests and category gates from the golden path
  • npm run lint
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include a new or updated automated test in this PR

Tests Added Or Updated

  • tests/unit/opencode-added-wait.test.ts (new, 7 tests): off-null, fail-open throttle, park steps non-stream and streaming, abort bounds, zero-wait null, out-of-context null; 7/7 green. Parent suite opencode-applied-egress-key.test.ts 10/10 green on the same head.

Coverage Notes

  • New accumulator/sink/schema branches covered by the new suite; no coverage movement beyond the new branches.
  • New en.json keys (requestLogger.columns.addedWait, requestLogger.detail.addedWait) translated across all 66 locales (check-new-key-coverage PASS).

Reviewer Notes

@maxmad64bis
maxmad64bis force-pushed the fix/request-added-wait branch from 868eb59 to f5286dd Compare September 25, 2026 00:51
@maxmad64bis
maxmad64bis marked this pull request as ready for review September 25, 2026 00:52
The added-wait p50/p90 helper had no caller and no test; the per-request
added_wait_ms/added_wait_cause columns are already surfaced through the
call-log route and the request logger. Remove it until a consumer lands.
@diegosouzapw

diegosouzapw commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Migration number coordination: several open PRs claim the same slot, and the release tip is already at 189 (187_proxy_logs_attempts, 188_call_logs_reasoning_encrypted, 189_quota_schedules). This PR's migration keeps 192, so no rename is needed. Slots go by PR age, and merges happen in ascending order (190 → 196) so the numbering gate stays contiguous.

# Conflicts:
#	config/quality/file-size-baseline.json
#	open-sse/executors/opencode.ts
#	open-sse/handlers/chatCore/attemptLogging.ts
#	src/lib/usage/callLogs.ts
# Conflicts:
#	config/quality/file-size-baseline.json
#	open-sse/utils/proxyFetch.ts
@diegosouzapw
diegosouzapw merged commit b0cc6ef into diegosouzapw:release/v3.8.51 Sep 25, 2026
2 of 3 checks passed
diegosouzapw pushed a commit that referenced this pull request Sep 25, 2026
…14752)

Maintainer rework: reconciled with release/v3.8.51 after #14795/#14810/#14756 — migration 193 now follows 190/191/192 with no gap; AGENTS.md / llm.txt / README edits are out of the diff; selectorHelp ICU-escapes the selector=<name> placeholder; ENVIRONMENT.md keeps the tip's PROXY_SKIP_RECENTLY_FAILED default-on row plus this PR's SELECTOR_CONTROL_ALLOWLIST row. Tests: 142/142 focused (proxySubscription selector client/endpoint/functional/guard/help-ICU/schema/strip/trigger/warning, proxy-outcome-memory); typecheck:core and check:open-sse-typecheck clean; eslint clean on changed files; check-file-size and check-migration-numbering OK; no __MISSING__ markers. Thank you @maxmad64bis!
@maxmad64bis
maxmad64bis deleted the fix/request-added-wait branch September 30, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants