-
Notifications
You must be signed in to change notification settings - Fork 22
feat(runtime): warn when a topology timeout pin is below the default it overrides (#675) #1256
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| import type { ResolvedConfig } from "@ultrafuzz/config"; | ||
| import type { ExpandedGraph, ProjectTopology } from "@ultrafuzz/topology"; | ||
|
|
||
| import type { RuntimeDiagnostic } from "./types.js"; | ||
|
|
||
| /** | ||
| * Warn about each topology `timeout_seconds` pin below the default it overrides (#675). | ||
| * | ||
| * A node's timeout resolves to its own pin, then its group's pin, then its model profile's | ||
| * `timeout_seconds`, then `run.default_timeout_seconds`. A pin therefore wins even when it is the | ||
| * shorter window, so raising the profile or run default silently does not reach a pinned node: the | ||
| * packaged `goals` and `strategies` pins kept high-reasoning goal nodes at 2h after #645 raised the | ||
| * profile default. Each pin is reported once, with the largest default it overrides and the | ||
| * agentic nodes it applies to. | ||
| */ | ||
| export function timeoutShadowingDiagnostics( | ||
| topology: ProjectTopology, | ||
| expanded: ExpandedGraph, | ||
| config: ResolvedConfig | ||
| ): RuntimeDiagnostic[] { | ||
| const topologyNodes = new Map(topology.nodes.map((node) => [node.id, node])); | ||
| const pins = new Map< | ||
| string, | ||
| { label: string; path: string; seconds: number; shadowed: { seconds: number; source: string }; nodes: Set<string> } | ||
| >(); | ||
| for (const node of expanded.nodes) { | ||
| const pinned = node.timeoutSeconds; | ||
| const declared = topologyNodes.get(node.logicalId); | ||
| if (node.kind !== "agentic" || pinned === undefined || declared === undefined) continue; | ||
| const pin = | ||
| declared.timeout_seconds === undefined && declared.group !== undefined | ||
| ? { | ||
| key: `group:${declared.group}`, | ||
| label: `group \`${declared.group}\``, | ||
| path: `groups.${declared.group}.defaults.timeout_seconds` | ||
| } | ||
| : { | ||
| key: `node:${declared.id}`, | ||
| label: `node \`${declared.id}\``, | ||
| path: `nodes.${declared.id}.timeout_seconds` | ||
| }; | ||
| // The default task compilation would apply without the pin: the profile's own timeout, else the | ||
| // run default. Expansion folds the run default into each fan-out entry, so read the profile itself. | ||
| const profileIds = node.modelFanout.length === 0 ? [undefined] : node.modelFanout.map((m) => m.modelProfileId); | ||
| for (const profileId of profileIds) { | ||
| const profileTimeout = profileId === undefined ? undefined : config.models.profiles[profileId]?.timeoutSeconds; | ||
| const shadowed = | ||
| profileId === undefined || profileTimeout === undefined | ||
| ? { seconds: config.run.defaultTimeoutSeconds, source: "`run.default_timeout_seconds`" } | ||
| : { seconds: profileTimeout, source: `model profile \`${profileId}\` \`timeout_seconds\`` }; | ||
| if (shadowed.seconds <= pinned) continue; | ||
| const entry = pins.get(pin.key) ?? { ...pin, seconds: pinned, shadowed, nodes: new Set<string>() }; | ||
| if (shadowed.seconds > entry.shadowed.seconds) entry.shadowed = shadowed; | ||
| entry.nodes.add(declared.id); | ||
| pins.set(pin.key, entry); | ||
| } | ||
| } | ||
| return [...pins.values()].map((pin) => { | ||
| const nodes = [...pin.nodes].sort(); | ||
| const named = nodes.slice(0, 3).join(", "); | ||
| const applies = nodes.length > 3 ? `${named} and ${String(nodes.length - 3)} more nodes` : named; | ||
| return { | ||
| code: "TOPOLOGY_TIMEOUT_SHADOWS_DEFAULT", | ||
| message: `topology ${pin.label} pins timeout_seconds=${String(pin.seconds)}, below ${pin.shadowed.source}=${String(pin.shadowed.seconds)}; the pin wins, so ${applies} time out after ${String(pin.seconds)} seconds. Raise or remove the pin to use the longer default.`, | ||
| severity: "warning", | ||
| source: "topology", | ||
| path: pin.path | ||
| }; | ||
| }); | ||
| } |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.