Repository navigation
Conversation
Each of these adapters decided its own response status, chose between a 500, a bare 502 and a 200, and wrote ng_agent_outcome by hand. They now read their harness's evidence into a RunEvidence and return finish_response(response, evidence) with HTTP 200; only lifecycle failures (a supervisor error or a missing receipt, an unconfirmed plugin or required MCP server, a runner that never started Kilo) still raise. Kilo: classify_outcome also reads ContextOverflowError (context limit) and a retryable APIError without a status (model_transport_error), as the OpenCode adapter does. A nonzero exit or a run without output answers 200 failed agent_run_error instead of a 500. A deadline before any model reply keeps today's retry (retry_deadline_before_reply), because Kilo retries an unreachable model silently. Pi: a nonzero exit, no reply, or a non-terminal last reply answers 200 failed agent_run_error instead of a 500. Pi's final model error is the outcome even after a nonzero exit. An empty length reply is an output-limit stop, or a context limit when Pi's own classifier calls it an overflow, whatever the exit. An aborted reply outside a deadline is no usable result. OpenClaw: the CLI's typed context overflow is graded as incomplete, whatever its exit (it was failed model_context_limit, and a 502 when the exit gate did not hold). A run without a usable result answers 200 failed agent_run_error instead of a bare 502; a supervisor failure raises a typed agent_route_failed 500. The FailoverError exit gate still decides whether a model error is the run's outcome. The ladder's model_request_rejected rule applies to all three: a 4xx other than 408/425/429 before any model reply is no longer graded. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
…-kilo-pi-openclaw Keeps this branch's OpenClaw context-limit test over the base's interim update of the test it replaces. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
This was referenced Nov 10, 2026
This branch was previously deployed
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.
Stacks on #5870 (the shared outcome ladder). Review the diff against
feat/agent-outcome-ladder; it touches only these three adapters.What changed and why
Kilo, Pi and OpenClaw each decided their own response status, chose between a 500, a bare 502 and a 200, and wrote
ng_agent_outcomeby hand. Each now reads its harness's own evidence into aRunEvidenceand returnsfinish_response(response, evidence, session=...)with HTTP 200. The parsers andclassify_outcome()stay in the adapters. Only lifecycle failures still raise.Kilo (
responses_api_agents/kilocode_agent/app.py)_lifecycle_failure()is split out of_runtime_failure(): a missing receipt, a supervisor error, unconfirmed termination, an unconfirmed task-environment plugin or required MCP server, a runner that failed before Kilo, or a Kilo that could not start. These still raise (agent_route_failed 500)._run_evidence()maps Kilo's event stream and exit toRunEvidence. "Model replied" means the same as before: any output or any tokens.classify_outcome()now also readsContextOverflowError(a context limit) and a retryableAPIErrorwithoutstatusCode(model_transport_error), the same rules the OpenCode adapter uses. These names come from Kilo 7.4.15's bundled code; no live Kilo run has shown them yet.retry_deadline_before_reply=True: Kilo retries an unreachable model without emitting events, so a deadline before any reply stays retried (failed unknownnow, a 500 before)./v1/responsespath uses the same ladder, because it shares_response_from_events().Pi (
responses_api_agents/pi_agent/app.py)_reported_model_error()andreport_outcome()are gone. A supervisor error, or required MCP tools that never started (exit 78), still raise.lengthreply is an output-limit stop (model_limit="output",incomplete_details=max_output_tokens). Pi 0.80.2 does not count the default vLLM length path (an empty completion with zero usage) as an overflow, so that path was alreadyincomplete, not a 500. When Pi's own classifier (outcome.mjs) calls alengthreply an overflow, the run is a context limit whatever its exit.abortedreply outside a deadline is no usable result. Pi aborts only on SIGTERM, which exits 143, so this path is not expected in practice.OpenClaw (
responses_api_agents/openclaw_agent/app.py)context_overflowenvelope setscontext_limit=True, whatever the exit code (decision 1). It used to need the exit-code gate.FailoverErrorexit gate still decides whether an assistant model error is the run's outcome.HTTPException(502)for a response without an outcome is gone. A run with no usable result answers 200agent_run_error. A supervisor error or a missing receipt raises a typed agent_route_failed 500.All three adapters now follow the ladder's
model_request_rejectedrule (decision 4). With it, they pass the conformancemodel_errorcheck as #5870 updated it.The adapter READMEs describe the new outcomes. Tests that pinned the old behaviour are updated, and each says why in its name or a comment.
Score and disposition changes
The main column comes from code reading at
acb67734cc(the base of #5870), with main's policy. (t) marks a row that a test on main also pins; this PR updates those tests where the row changes. Actions: verify = graded, retry = episode retried up to the attempt cap, fail = neither. Rows marked changed change disposition.ContextOverflowError(propagate flag on)max_output_tokens) → verifyunknown→ retryagent_run_error→ retrymodel_request_errorN → retry (t)model_transport_error→ retrymodel_request_error401 → failmodel_request_rejected→ failmodel_request_error400 → verify (t)model_request_rejected→ failunknown→ retry (t)length, zero usage)max_output_tokens) → verifylengthreply Pi calls an overflow, then a nonzero exitagent_run_error→ retryagent_run_error→ retrymodel_request_error401 → fail (t)model_request_rejected→ failmodel_request_error400 → verify (t); 500 → retry after a nonzero exit (t)model_request_rejected→ failFailoverErrormodel_context_limit→ fail on main's policy (t)length)max_output_tokens) → verifyagent_run_error→ retrymodel_request_errorN → retry (t)Connection error.,terminated, idle-timeout abort)model_transport_error→ retry (t)model_request_error401 → failmodel_request_rejected→ failmodel_request_error→ verify (t)model_request_rejected→ failFor OpenClaw's context overflow, #5870 alone already grades the failed
model_context_limitresponse: it makesmodel_context_limit: verifythe policy backstop. Against #5870, this PR changes the response from failed to incomplete and removesng_agent_outcome; the disposition is the same. Against main, the score changes.A 4xx after a model reply keeps
model_request_errorwith its status: 400, 413 and 422 are graded, and 401, 403 and 404 fail.Overlaps
agent_timeout_secmetadata and declarescalls_model_from_sandbox. Expect a small textual conflict inkilocode_agent/app.py(thenemo_gym.agentsimports, the lines around the_response_from_eventscall, and the response metadata) and intest_runner_identity_reaches_response_metadata. Whichever lands second resolves it; this PR does not duplicate fix(agent): declare in-sandbox model calls and accept Kilo task timeouts #5863's change._collect_sandbox_responseand_sandbox_response. It is expected to merge first; whichever lands second resolves the conflict. fix(openclaw): preserve replay identity and startup timeout outcomes #5379's replay-receipt failure should then be a typed lifecycle raise, like the supervisor failure here, not a bare 502.Validation
PYTHONPATH:responses_api_agents/{kilocode_agent,pi_agent,openclaw_agent}/tests,scripts/harness_conformance/testsandtests/unit_tests/agents/test_outcome_ladder.py. Result: 1304 passed, 113 skipped (Linux-only and pinned-CLI tests), 2 failed. Both failures aretest_runtime_dependencies.py::test_opensandbox_sdk_is_available_in_agent_environment(Pi and OpenClaw), which fails without this PR too: this venv has noopensandboxmodule.test_outcome_ladder_reads_kilo_events(context overflow, length stop, deadline after a reply with an error event, transport failure) andtest_run_evidence_reads_replies_limits_and_exit.test_empty_length_reply_is_an_output_or_context_limit.test_context_overflow_is_graded_as_incomplete, which also covers exit 1 withoutFailoverError.pre-commit run --files <touched files>: passed.scripts/harness_conformance/tests/test_openclaw_errors.py(Linux CI withHARNESS=openclawand the pinned CLI; its context cases are updated to expect a graded incomplete row), and the pinned Pi 0.80.2 / OpenClaw tests, which skip here.Smoke evidence
Harness conformance scenarios on a Linux host, run as a scripted-model smoke with no real model. Gym's real
vllm_modelsits in front of a scripted upstream, and the Environment Server's action is computed from each response under the default policy.0078c8bfd0, which contains feat(agent): add the shared outcome ladder for harness runs #5870 and keepsmain's adapters.05d5556d14(merged with the other step 1 adapter PRs, no conflicts).No episode had an execution error.
model_error(400 before a reply)model_request_error400 → verify ⇒ failedmodel_request_rejected→ failcontext_overflowmodel_request_error400 → verify, unchanged (see below)context_overflow_lengthdeadline_before_replyunknown→ retry (transitional rule)deadline_after_replyharness_no_resultagent_run_error→ retrymodel_401model_request_error401 → fail ⇒ failedmodel_request_rejected→ failmodel_503unknown→ retry (see below)model_request_error503 → retry, unchangedDisposition changes: Kilo Code 2 (
model_error,context_overflow), Pi 1, OpenClaw 1. Every 5xx on A becomes HTTP 200 on B.Findings this PR does not change:
model_request_error400 after a reply. It should beincomplete(decision 1). fix(openclaw): preserve replay identity and startup timeout outcomes #5379 makes OpenClaw's context overflowincomplete, and its two context tests pass on its head (c739747a1a). Whichever of the two PRs lands second keeps that rule.unknown, which is retried. The action matches; the outcome kind (unknown, notmodel_request_error503) does not./tmp/nemo-gym-kilo-sessions, on both sides.Compatibility
Callers that relied on a 500 or 502 from these adapters for "no usable result" now get a 200 failed response with
agent_run_error, which the default policy in #5870 retries. Custom policies that mapmodel_context_limitor a 400model_request_errorsee the changed rows above.🤖 Generated with Claude Code