mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 23:00:03 +00:00
fix(engine): realistic worker memory budget + sizing/feedback telemetry
This commit is contained in:
@@ -85,6 +85,39 @@ export interface HyperframesConfig {
|
||||
* `DE_PARALLEL_ROUTER_TRIAL_MAX_RENDERS` in `render.ts`.
|
||||
*/
|
||||
deParallelRouterTrialRenderCount?: number;
|
||||
/**
|
||||
* Ring of the last few local renders (newest last). `hyperframes feedback`
|
||||
* attaches these ids — which are the `render_job_id` /
|
||||
* `observability_render_job_id` on this install's PostHog events — to the
|
||||
* feedback it submits, so a wild bug report can be joined to the exact
|
||||
* telemetry rows of the renders it describes.
|
||||
*/
|
||||
recentRenders?: RecentRenderRecord[];
|
||||
}
|
||||
|
||||
/** One entry in {@link HyperframesConfig.recentRenders}. */
|
||||
export interface RecentRenderRecord {
|
||||
/** The render job id (`RenderJob.id` — the telemetry `render_job_id`). */
|
||||
id: string;
|
||||
/** ISO timestamp of when the render finished. */
|
||||
at: string;
|
||||
/** Whether the render completed successfully. */
|
||||
ok: boolean;
|
||||
}
|
||||
|
||||
/** Ring size for {@link HyperframesConfig.recentRenders}. */
|
||||
const MAX_RECENT_RENDERS = 5;
|
||||
|
||||
/**
|
||||
* Append a finished render to the recent-renders ring (newest last, capped).
|
||||
* Fresh read-modify-write like the trial counters — narrows, but does not
|
||||
* eliminate, lost updates against a concurrent CLI process.
|
||||
*/
|
||||
export function recordRecentRender(id: string, ok: boolean): void {
|
||||
const config = readConfigFresh();
|
||||
const ring = [...(config.recentRenders ?? []), { id, at: new Date().toISOString(), ok }];
|
||||
config.recentRenders = ring.slice(-MAX_RECENT_RENDERS);
|
||||
writeConfig(config);
|
||||
}
|
||||
|
||||
const DEFAULT_CONFIG: HyperframesConfig = {
|
||||
@@ -142,6 +175,18 @@ export function readConfig(): HyperframesConfig {
|
||||
typeof parsed.deParallelRouterTrialRenderCount === "number"
|
||||
? parsed.deParallelRouterTrialRenderCount
|
||||
: undefined,
|
||||
recentRenders: Array.isArray(parsed.recentRenders)
|
||||
? parsed.recentRenders
|
||||
.filter(
|
||||
(r): r is RecentRenderRecord =>
|
||||
typeof r === "object" &&
|
||||
r !== null &&
|
||||
typeof (r as RecentRenderRecord).id === "string" &&
|
||||
typeof (r as RecentRenderRecord).at === "string" &&
|
||||
typeof (r as RecentRenderRecord).ok === "boolean",
|
||||
)
|
||||
.slice(-MAX_RECENT_RENDERS)
|
||||
: undefined,
|
||||
};
|
||||
|
||||
cachedConfig = config;
|
||||
|
||||
Reference in New Issue
Block a user