Skip to content

Authoritative-run readiness: leaf timeout, setup-reliable curve rep, per-leaf token capture - #137

Merged
pdettori merged 1 commit into
rossoctl:mainfrom
pdettori:feat/authoritative-run-readiness
Jul 17, 2026
Merged

pdettori merged 1 commit into
rossoctl:mainfrom
pdettori:feat/authoritative-run-readiness

Conversation

@pdettori

Copy link
Copy Markdown
Member

Summary

Makes the (expensive) authoritative E6/E1 SWE-bench sharing run ready and priceable, grounded in live OCP characterization (real solve leaves run 8–12 min, model-dominated; setup ~5s). No async (rejected: replica-bound → breaks the per-request concurrency sweep, shared-worker blast radius). Three driver/harness hardenings + token instrumentation.

1. Sync-path leaf timeout (lib.sh, e6/e1)

Real leaves far exceed the ksvc default 300s request timeout and get killed mid-run (uncapturable). New set_ksvc_timeout <sec>; the swebench drivers bump timeoutSeconds to SWEBENCH_LEAF_TIMEOUT (default 1800) in setup; restore_ksvc_env resets to 300. set_ksvc_env/set_scale preserve timeoutSeconds. Cluster prereq: Knative max-revision-timeout-seconds ≥ that value (document as a pre-run step). Recommended authoritative ladder E6_LADDER="1 2 4 8" (high-C mostly measures the model tier).

2. Setup-reliable curve heavy representative (experiments/src/workload.ts)

curveItems()'s heavy representative was matplotlib__matplotlib-24177 — the only C-ext instance in the heavy bucket — which fails setup in ~19s live, so the heavy curve point was always lost. representative() now skips a C-ext/build-heavy repo denylist (matplotlib / scikit-learn / numpy), yielding pydata__xarray-2905 (live-verified: solves in 365s, 1541-byte patch). sweepItem() unchanged. Bucket label unchanged → tests unaffected.

3. Per-leaf token capture (harness/src/run-leaf.ts, leaf-result-store.ts)

Solve LeafResult now carries cumulative usage from session.getSessionStats().tokens (input/output/cacheRead/cacheWrite/total), persisted to leaf:result and returned by GET /runs/status. Drivers record it via a new lib.sh append_usage → usage.jsonl, enabling run cost pricing. Field threading unit-tested.

Validation

  • Live OCP 4.20 (haiku): set_ksvc_timeout accepted at 1800; xarray-2905 heavy rep solves (365s / 1541 B); earlier chars: light 484s, medium 737s (all solved).
  • bash -n + shellcheck clean; getSessionStats().tokens field names verified against pi source; leaf-result-store usage-threading unit tests added. Synthetic E6 path unchanged.

Follow-up

Once merged and CI publishes :latest with the token capture, a costed pilot (reduced config) measures real tokens/leaf → full-run cost estimate before triggering the authoritative sweep.

Assisted-By: Claude Code

… rep, per-leaf token capture)

Prep for the expensive authoritative E6/E1 SWE-bench sharing run. Three hardenings
grounded in live OCP characterization (real solve leaves run 8-12 min, model-dominated):

1. Sync-path leaf timeout (lib.sh set_ksvc_timeout; e6/e1 call it). Real leaves far
   exceed the ksvc default 300s request timeout and get killed mid-run. The drivers now
   bump timeoutSeconds to SWEBENCH_LEAF_TIMEOUT (default 1800) in swebench setup;
   restore_ksvc_env resets it to 300. (Cluster prereq: Knative max-revision-timeout-seconds
   >= that value.) set_ksvc_env/set_scale preserve timeoutSeconds so it persists.

2. Setup-reliable curve heavy representative (workload.ts). curveItems()'s heavy
   representative was matplotlib__matplotlib-24177 (only C-ext in the heavy bucket), which
   fails setup in ~19s live -> the heavy curve point was always lost. representative() now
   skips a C-ext/build-heavy repo denylist (matplotlib/scikit-learn/numpy), yielding
   pydata__xarray-2905 (live-verified: solves in 365s, 1541-byte patch). sweepItem()
   unchanged (already ranks by test_runtime_ms). Bucket label unchanged -> tests unaffected.

3. Per-leaf token capture for run cost pricing (run-leaf.ts + leaf-result-store.ts). The
   solve LeafResult now carries cumulative usage from session.getSessionStats().tokens
   (input/output/cacheRead/cacheWrite/total), persisted to leaf:result and returned by
   GET /runs/status. Drivers record it via a new lib.sh append_usage into usage.jsonl.

Live-validated on OCP 4.20 (haiku): set_ksvc_timeout accepted at 1800; xarray-2905 heavy
rep solves; drivers bash -n + shellcheck clean; token-usage field threading unit-tested.
Synthetic E6 path unchanged.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
@pdettori
pdettori merged commit be48cb5 into rossoctl:main Jul 17, 2026
10 checks passed
@pdettori
pdettori deleted the feat/authoritative-run-readiness branch July 17, 2026 00:43
pdettori added a commit that referenced this pull request Jul 17, 2026
…tats

The Phase-3 token capture (PR #137) called session.getSessionStats() to read
cumulative usage, but that method accesses message.usage non-defensively and
throws at runtime on the pinned pi build — swallowed by the best-effort
try/catch, so usage was silently never captured (usage.jsonl empty in the
costed pilot, though patches captured fine).

Replace it with the same defensive branch-sum that budget-voter.ts:branchSpend
already uses successfully in this harness: iterate sessionManager.getBranch()
and sum usage only for entries that are assistant messages with a usage field,
keeping the per-field breakdown (input/output/cacheRead/cacheWrite) needed for
cost pricing. sessionManager is already in scope. Still best-effort.

Surfaced by the authoritative-run costed pilot on OCP 4.20.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Paolo Dettori <[email protected]>
webchang added a commit to webchang/moca that referenced this pull request Nov 23, 2026
…octl#338)

CodeQL on PR C (rossoctl#137 js/polynomial-redos, rossoctl#138 and rossoctl#139
js/file-access-to-http, relay-release.ts:62/65/67):

- The listener's base URL loses its trailing slashes in a loop
  (releaseUrl), not with /\/+$/, which backtracks on many slashes.
- The release URL and bearer now travel as the control plane's other
  secrets do: configFromEnv reads them into the config
  (CpConfig.relayRelease, every profile, with the same boot checks), and
  the request that needs them builds the releaser from deps.config
  (releaserOf), as the operator inference token reaches its upstream.
  Before, depsFromEnv built a releaser that closed over values read from
  withCredentials' merged env, whose dynamic property writes of file data
  CodeQL counts as tainting every value read from it, the URL included.
  deps.relayRelease stays as the test seam.

A local CodeQL 2.27.5 run (security-extended, as CI) over the control
plane reports the three alerts at the previous head and none here.

Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Rong Chang <[email protected]>
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.

1 participant