Repository navigation
Let Core own the runtime history window - #696
Merged
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Session Runtime history now takes a named
range(1hdefault,6h,24h) instead ofstart,endandmax_points. Core ends the range at the last bucket boundary on its own clock, so the request carries no time and the browser needs no clock.runtimehistory.Capabilities.Windowbuilds the range: the bucket width comes from the range and 120 points, the end is Core's time rounded down to a whole multiple of that width in Unix seconds, and the start is the end minus the range.GET .../runtime-history?range=uses this window. Any other parameter, a repeatedrangeor an unknown value returns 400invalid_request.internal_errorinstead of the caller's 400.rangeNamequery reader. Only runtime history had theend > nowcheck; the other two already used Core-owned named ranges.core.openapi.yamlupdated viamake openapi, and the "Session Runtime history" section updated inruntime-observability-api.md(EN and zh, refreshedsource_hash).retrieveRuntimeHistory(projectId, sessionId, range, options)with aRuntimeHistoryRangetype. The projection checks that the echoedrequested_rangehas the requested length.now,rangeStart,rangeEnd,loadedAtandRUNTIME_DURABLE_MAX_POINTSvalues had no remaining consumer and are removed.readError, so a typed Core code shows in the console's language. Web's own read-bound errors (more than 24 Sessions, mixed bucket widths) now have en and zh-CN copy too.retryTransient: it reads one Session, and when the Session is not active nothing polls, so one retry on a 5xx or network failure is its only recovery. 4xx responses are not retried.Why
When the browser clock was more than 1 s ahead of Core's, every runtime-history read returned 400 "Runtime history range is invalid.", and the zh console showed that English message. Each failed read was also sent twice: the global
retry: 1retried the 400.Sandbox metrics layout, cards and tables are unchanged.
Verification
go build ./services/core/...: pass.go test ./services/core/internal/api/ -run 'RuntimeHistory|HeadRuntime|AdminRuntime|CoreErrorCatalog|CoreMetricsAdministratorContract|SandboxNodeDetailValidationAndAuthentication': pass. This includes the new acceptance testTestRuntimeHistoryRangeEndsOnCoreClock.go test ./services/core/internal/runtimehistory/: pass.go vet ./...(module-wide): clean.make openapi, thenmake check-openapi: no drift, and the generator tests pass.go test ./contracts/agents-api/v1/: pass.pnpm --filter @oac/web typecheck: pass.vitest runonruntime-history.test.ts,session-history.test.tsandcore-error.test.ts: 34 passed.packages/agents-client:pnpm typecheckpasses.vitest runonruntime-history.test.tsandadmin-client.test.ts: 117 passed.make check-docs: pass.make check-names: pass.websitecheck-translations: pass (coverage, freshness and structure).?range=1hrequest per Session; before the change there were two. Charts render with the skewed clock, and the zh 503 message is localized.Skipped
make check: lane rule is focused checks only.check-web-acceptance).check-core-integration). The PG reader is unchanged.