Repository navigation
Conversation
Two defects surfaced while attributing the b9 (3-10-3) benchmark regression. `model_response_invalid` was a catch-all. One `except Exception` caught a rejected request, a transport error, a truncated sample and a malformed one, and reported all four under a name that describes only the last. Three existing tests -- an unterminated string literal, a `finish_reason='length'` truncation, and a `ConnectionError` -- all asserted the same string, which is the defect stated as a test. Failures are now classified and reported as `model_response_unparseable` / `model_output_truncated` / `model_call_failed` / `model_response_empty` / `model_context_overflow`, with the old name kept as `agent_outcome_family` so aggregating consumers do not break. Retrying a context overflow could not work. vLLM rejected four b9 prompts at 64296-64782 tokens against a 64000 limit, and each was resent unchanged five times -- exactly `parse_retries` -- for twenty guaranteed 400s. Parse feedback would have made the prompt longer still. The loop now shrinks the live-image set and replans from the entry policy state instead, so a retry can succeed and the trajectory stays replayable. `plan_history` also gains an optional `max_images` clamp: it stays a pure function and knows nothing about tokenizers, but a caller that can measure the rendered prompt can now converge onto a budget rather than emit a request the server will reject. The new `sink_window` policy keeps the earliest turns live alongside a recent window, which the previous scalar `image_window_start` could not express because it assumed one contiguous suffix. `HistoryPlan.image_intervals` is now the authority; the scalar is a property that raises when the image set is not contiguous, so a stale consumer crashes on the first step rather than building a wrong prompt for a whole benchmark. `low_water`/`high_water` count total live images including the sink, matching what they already mean elsewhere. Rendering now walks the plan in turn order and flushes a text block whenever a folded run ends. For one leading text run -- every policy shipped so far -- this is byte-identical; with a sink it is the only ordering that puts the summary after the turns it describes. `supports_append_stable_intervals` now follows `high_water > low_water` rather than the policy name: only a hysteretic window appends between compactions. The value is unchanged for `fixed` and `hysteresis`. Verified: 4800 algorithm-level comparison points across 12 parameterisations and 400 steps, plus 230 end-to-end rendered prompts across 8 configurations, are byte-identical to a4471b5. `policy_id`, `to_config` and `to_contract` are unchanged for the shipped policies, so no published run record moves. Signed-off-by: Jeff Peng <[email protected]> (cherry picked from commit 780c1e4)
The strongest checks so far only existed as throwaway scripts: nothing in the repo would notice if a later change moved a rendered prompt or a policy_id, and that kind of drift does not fail anything -- the benchmark still produces a plausible number, it just stops being comparable to b1..b11p. test_history_policy_published_parity.py freezes both, using goldens computed from a4471b5, the commit that ran b8/b9/b10p/b11p: six policy_id strings and six sha256 digests over every prompt a deterministic trajectory renders. It also pins the property that made this change additive -- both shipped policies select one contiguous suffix, so the scalar accessor stays defined for them -- and asserts the shipped telemetry keys survive with their old meanings. Mutation-checked rather than assumed: an off-by-one in the fixed window fails 3 cases, one changed character in the history header fails 14, and an extra key in the policy_id input fails 12. test_model_failure_classification.py drives the classifier from sixteen error strings taken verbatim from b7..b10p logs -- four vLLM 400 bodies, five LB 502 transport errors, and the parse failures -- rather than invented ones, so a future matcher change is measured against what the stack really emits. It also asserts an unknown error falls back to the retryable bucket and never to the one that shrinks the prompt. Writing the recovered-step test found a real gap: prompt_shrink_events only reached the terminal parse_failure block, so a step that recovered after a rejection left no trace -- the same shape of blind spot that let twenty HTTP 400s disappear from a whole release. Both evidence fields are now emitted on successful steps too, and only when non-empty so the clean path keeps its byte shape, which the parity goldens confirm. Also adds boundary and interaction coverage: shrinking bottoms out at one image instead of spinning, a sink survives budget pressure, a sink_window agent exposes its policy through agent_contract with the right append-stability flag, interval telemetry reaches the model-call records, and a seeded 300-case sweep over random policies and budgets checks the selection invariants that a fixed table cannot reach. Baseline a4471b5 reports 260 passed and one pre-existing test_app.py import error from the editable install; this branch reports 339 passed and the same single error. Signed-off-by: Jeff Peng <[email protected]> (cherry picked from commit 2a03083)
Preserve main's model-timeout propagation. Stop context-overflow retries when the sink and current image cannot be reduced further, and report terminal-attempt completion independently of earlier malformed samples. Keep evaluator reward and runner admission unchanged. Document the opt-in policy and verify existing prompt/identity parity. Signed-off-by: Jeff Peng <[email protected]>
2a03083 to
9aef853
Compare
|
Overall lgtm |
|
/claude review |
|
SHIP — no reliability concerns. On-call read of the OSWorld adapter change (sink-window history policy + context-overflow prompt shrinking + failure-kind classification). This is exactly the kind of change that can silently corrupt an eval release, so I focused on scorer-adjacent correctness, replayability, and telemetry integrity. It holds up. What I checked and why it's safe:
Reminder for the author per repo policy: this is behavior-changing agent work, so confirm the PR records a representative real smoke rollout (not just green unit tests) before marking ready. |
Signed-off-by: Jeff Peng <[email protected]>
|
/ok to test d083e5d |
|
@Glorf, the score reproduction for the conditional approval: no degradation. Setup. A/B with one run per arm on the OSWorld 361-task set (the 369-task suite
Why #3591 is in both arms: main's E2B provider has no For reference, the pre-split AgentEnv source ( |
|
/ok to test 8b41c6a |
Summary
Add an opt-in
sink_windowhistory policy to the OSWorld Nemotron adapter: retain the earliest screenshots alongside a recent-image window, with intervening turns represented as text in chronological order.This branch includes upstream
mainatd4c0f86c7through a normal merge, including the NumPy metadata fix #3649, CI preflight update #3658, and sandbox lifecycle telemetry #3633. The OSWorld foundation from #2554/#3140 was consolidated and merged through #3592, so this PR no longer carries the old exact-trace/Core stack or depends on #2554. It does not require #3591. No separate issue is needed for this follow-up policy extension.Changes
agent_outcome_family=model_response_invalidfor compatibility.The latest synchronization also annotates six deterministic SHA-256 prompt goldens that the previous secrets-detector run falsely identified as credentials. Only those literal lines are annotated; the digest values, assertions, repository scanner configuration, and baseline are unchanged.
Design and compatibility
History policy selects image/text turns; the adapter owns model protocol rendering and parsing. The runner owns horizon and runtime failure handling, the evaluator owns reward, and runtime admission owns masking. This PR does not change those ownership boundaries or add a training/evaluation switch.
Fixed-window and hysteresis policy IDs and normal-path rendered prompts remain covered by deterministic golden tests, including fixed-3 and 3-10-3. Sink-window is opt-in, not a new default or a claim of improved benchmark score. Context-overflow recovery and more precise failure outcomes are intentional behavioral changes and may affect failed-run outcomes. The legacy scalar
image_window_startaccessor rejects non-contiguous plans; consumers should useimage_intervalsor per-turn decisions.Scope relative to current main remains limited to
responses_api_agents/osworld_agent/: two implementation files, documentation, and tests. No Gym Core, dependency, deployment, sandbox-provider or model-server changes are included in the PR diff.Validation
Re-run on the final main-synchronized tree:
pre-commit run --all-files: passed.uv lock --check --offline: passed.git diff --check: passed.detect-secrets==1.5.0hook and checked-in baseline used by CI passed on all nine PR-scoped files after the inline false-positive annotations.Test invocation, using an existing compatible development environment from this checkout:
The explicit source root prevents an older editable checkout from shadowing the branch under test; importlib mode avoids the shared
osworldtest-package name collision. These checks are local evidence, not a claim that the upstream CI run has completed.Score reproduction
OSWorld 361 tasks, Nemotron-3-Nano-Omni v3 (
24e67ea0), fixed-3 history, 100 steps, one A/B run per arm. Control = maind4c0f86c7+ #3591 (needed for the E2Bendpoint()on AgentEnv); treatment = control + this PR. Raw SR 44.61% → 46.62% (Δ +2.01 pp, paired 95% CI [−2.12, +6.07] pp); binary 154 → 159 of 361 (McNemar p = 0.59); 0 masked and 0 missing in both arms; identical history-policy and agent-contract IDs. No degradation. The context-overflow shrink path was not triggered in either run.