Skip to content

fix(clock-skew): exclude server processing time from skew correction - #8391

Merged
stobrien89 merged 1 commit into
mainfrom
fix/clock-skew-long-running-requests
Oct 30, 2026
Merged

stobrien89 merged 1 commit into
mainfrom
fix/clock-skew-long-running-requests

Conversation

@stobrien89

Copy link
Copy Markdown
Member

Issue

n/a

Description

Updates clock skew correction to compare the server time against the client time when the response is received instead of the request midpoint.

The midpoint calculation attributed half of the server processing time to clock skew. For long-running requests, this could store an incorrect offset and cause subsequent requests to fail with InvalidSignatureException.

This preserves the existing 15-minute request duration and Age header safeguards.

Testing

  • Added regression coverage for a 620-second request.

Checklist

  • If the PR is a feature, add integration tests (*.integ.spec.ts) or E2E tests.
    • It's not a feature.
  • My E2E tests are resilient to concurrent i/o.
    • I didn't write any E2E tests.
  • I added access level annotations e.g. @public, @internal tags and enabled doc generation on the package. Remember that access level annotations go below the description, not above.
    • I didn't add any public functions.
  • Streams - how do they work?? My WebStream readers/locks are properly lifecycled. Node.js stream backpressure is handled. Error handling.
    • No streams here.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@stobrien89
stobrien89 requested a review from a team as a code owner October 29, 2026 21:56
@stobrien89
stobrien89 force-pushed the fix/clock-skew-long-running-requests branch from 18eb177 to bb19fa4 Compare October 30, 2026 15:24
@stobrien89
stobrien89 merged commit 2dd7086 into main Oct 30, 2026
8 checks passed
@kuhe
kuhe deleted the fix/clock-skew-long-running-requests branch October 30, 2026 16:14
laithalsaadoon added a commit to memhtml/memhtml that referenced this pull request Nov 11, 2026
…s to 3.1161.0 (#375)

Weekday dependency sweep: the `ai` family patches, its Bedrock and openai-compatible providers, and the AWS SDK clients, all past pnpm's 3-day soak. Updated 2026-11-06 to the newer `ai` patches (main merged in first; main had moved no manifest or lockfile since this branch was cut).

| Package | From | To | Where |
| --- | --- | --- | --- |
| `ai` | 7.0.158 | 7.0.162 | `packages/curator` |
| `@ai-sdk/amazon-bedrock` (exact pin `@ai-sdk/anthropic` 4.0.93 -> 4.0.96) | 5.0.129 | 5.0.132 | `packages/curator` |
| `@ai-sdk/openai-compatible` | 3.0.82 | 3.0.84 | `packages/curator` |
| `@aws-sdk/credential-providers` | 3.1160.0 | 3.1161.0 | `packages/curator` |
| `@aws-sdk/client-bedrock-runtime` | 3.1160.0 | 3.1161.0 | `packages/llm` |

Transitives of the `ai` set: `@ai-sdk/gateway` 4.0.131 -> 4.0.135, `@ai-sdk/openai` 4.0.106 -> 4.0.108 (reached only through bedrock's `/mantle` subpath, which nothing imports) and `@ai-sdk/provider-utils` 5.0.72 -> 5.0.74. AWS SDK side, unchanged since the first push: the clients now ask `@smithy/core` ^3.38.0 and `@smithy/node-http-handler` ^4.14.0. A within-range refresh (`pnpm update -r --depth Infinity @smithy/core @aws-sdk/core`) keeps one copy of `@smithy/core` (3.38.1; npm marks 3.37.0 deprecated for aws/aws-sdk-js-v3#8393, a custom logger receiving unredacted nested sensitive fields, and memhtml passes no logger) and one copy of `@aws-sdk/core` (3.979.1, where main holds 3.978.3 and 3.979.0). `@aws-sdk/xml-builder` leaves the tree.

One reached behavior change, which is why this PR is left for review rather than merged: `@aws-sdk/core` 3.979.1 (aws/aws-sdk-js-v3#8391) stops storing half of a SigV4 call's duration as clock skew, and `packages/llm`'s direct client runs that code on every signed response. It is a fix: on main a 620 s call makes the next signed call fail with `InvalidSignatureException`, on this branch it does not.

Verification:
- `mise run check` on 5f06fc8: 76/76 in 205 s (on 71f3e1a: 76/76 in 217 s).
- Pre-push `package:smoke:live` on 5f06fc8: 92 checks, real Bedrock embeddings (query embed 390 ms). Its `curate run` uses `--model fake`, so the smoke proves the embedding client in `packages/llm` and the head server's vector arm, not the curator's model path; the wire capture in the comments is the proof for that path.
- Changelog, dist and wire-capture reads: the AWS half in the 2026-11-03 comment, the newer `ai` half in the 2026-11-06 comment.
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

⌂ 换网址