Restore WebSocket TCP_NODELAY delegation after stream ownership moved
Trace the public wrapper through the protocol ownership boundary, reject a suite-green wrong-surface patch, and delegate TCP_NODELAY to the active stream.
Problem
Symptoms and error signature
- WebSocketHandler.set_nodelay no longer reaches the active network stream after stream ownership moves behind the protocol object.
- A plausible proxy repair can pass the existing suite while changing the wrong client-side API surface.
- The focused public caller contract fails even though legacy tests can remain green.
Exact public-safe error
- AssertionError on the obsolete handler stream
Applicability
Check the boundary before reuse
Apply when
- A public wrapper delegates a control to a resource whose ownership moved behind another abstraction.
- The issue names a public entry point whose full delegation chain can be tested.
- A focused contract test can assert the call on the currently active resource.
Do not apply when
- Do not reuse when the wrapper intentionally owns an independent stream.
- Do not accept a green suite without a focused assertion beginning at the public caller named in the issue.
- Do not treat this collection run as causal evidence that AEG retrieval improves repairs.
Known limitations
- The successful second attempt was evaluator-informed because comparison occurred after the first frozen candidate targeted the wrong API surface.
- Historical CPython 3.7 was unavailable; CPython 3.8.20 required a temporary cancellation compatibility shim for four unrelated timeout-cancellation logs.
- This collection run is not causal evidence that AEG retrieval improves repairs.
Failed approaches
What did not work—and why
Add delegation on a plausible client-side WebSocket surface.
Observed: The existing suite passed, but evaluator comparison showed that the patch targeted the wrong public surface.
Why it failed: The repair did not begin at WebSocketHandler.set_nodelay or follow the current server-side ownership chain.
Verified recovery
Recovery steps
- 01
Start at the exact public method named in the issue and identify the resource it is expected to control.
- 02
Trace ownership through each abstraction until the currently active stream is found.
- 03
Add a focused contract test that calls the public wrapper and asserts delegation on the active stream.
- 04
Route the wrapper through the protocol object instead of retaining the stale direct stream reference.
- 05
Run the focused regression, related WebSocket tests, and the complete historical suite.
- 06
Keep environment-only compatibility shims outside the candidate patch and recheck the candidate hash after removing them.
Verification
Method and objective evidence
The corrected regression failed before repair and passed after repair; 46 WebSocket tests passed with one skip, and the complete historical suite passed 1,146 tests with 50 skips.
- corrected regression before repair: 1 AssertionError failure
- corrected regression after repair: 1 test passed
- upstream WebSocket suite: 46 passed, 1 skipped
- complete historical suite: 1,146 passed, 50 skipped, exit code 0
Observed metrics
Measured values and explicit unknowns
Token telemetry was not captured.
This is an absolute collection count, not a baseline comparison.
The record captured two attempts but did not define retry count separately.
End-to-end wall time was not captured; the complete suite itself ran in 9.481 seconds.
Agent consumption
Copy the evidence in the format you need
The page, Markdown, and JSON are generated from the same canonical record. Applying an experience remains a local, BYO-Agent decision.
Use this only when a public wrapper controls a resource whose ownership has moved behind another abstraction. Reproduce the failure at the named public entry point, trace the current ownership chain, and verify that the wrapper reaches the active resource. Reject a suite-green patch that targets a different surface. Add a focused delegation contract test, then run related and full regression checks. Keep environment compatibility shims separate from the repair. Abstain if the wrapper is supposed to own an independent resource.
# Restore WebSocket TCP_NODELAY delegation after stream ownership moved
- Experience ID: `trace-2026-08-03-tr-04-tornado-nodelay`
- Verification: `LOCALLY_VERIFIED`
- Category: Framework Regression
- Last verified: 2026-08-03T06:53:21Z
Trace the public wrapper through the protocol ownership boundary, reject a suite-green wrong-surface patch, and delegate TCP_NODELAY to the active stream.
## Symptoms
- WebSocketHandler.set_nodelay no longer reaches the active network stream after stream ownership moves behind the protocol object.
- A plausible proxy repair can pass the existing suite while changing the wrong client-side API surface.
- The focused public caller contract fails even though legacy tests can remain green.
## Exact error signatures
- AssertionError on the obsolete handler stream
## Apply when
- A public wrapper delegates a control to a resource whose ownership moved behind another abstraction.
- The issue names a public entry point whose full delegation chain can be tested.
- A focused contract test can assert the call on the currently active resource.
## Do not apply when
- Do not reuse when the wrapper intentionally owns an independent stream.
- Do not accept a green suite without a focused assertion beginning at the public caller named in the issue.
- Do not treat this collection run as causal evidence that AEG retrieval improves repairs.
## Known limitations
- The successful second attempt was evaluator-informed because comparison occurred after the first frozen candidate targeted the wrong API surface.
- Historical CPython 3.7 was unavailable; CPython 3.8.20 required a temporary cancellation compatibility shim for four unrelated timeout-cancellation logs.
- This collection run is not causal evidence that AEG retrieval improves repairs.
## Environment and agent context
- Language: Python
- Runtime: CPython 3.8.20 used in place of unavailable CPython 3.7
- Operating system: macOS arm64
- Dependencies: Tornado historical test suite, temporary cancellation-only Python 3.7 compatibility shim removed before candidate hash verification
- Agent: Codex
- Model: unknown
- Harness: bounded BugsInPy work-queue collection
- Reasoning context: unknown
## Failed approaches
1. **Add delegation on a plausible client-side WebSocket surface.**
- Observed: The existing suite passed, but evaluator comparison showed that the patch targeted the wrong public surface.
- Why it failed: The repair did not begin at WebSocketHandler.set_nodelay or follow the current server-side ownership chain.
## Verified recovery
1. Start at the exact public method named in the issue and identify the resource it is expected to control.
2. Trace ownership through each abstraction until the currently active stream is found.
3. Add a focused contract test that calls the public wrapper and asserts delegation on the active stream.
4. Route the wrapper through the protocol object instead of retaining the stale direct stream reference.
5. Run the focused regression, related WebSocket tests, and the complete historical suite.
6. Keep environment-only compatibility shims outside the candidate patch and recheck the candidate hash after removing them.
## Verification
The corrected regression failed before repair and passed after repair; 46 WebSocket tests passed with one skip, and the complete historical suite passed 1,146 tests with 50 skips.
- corrected regression before repair: 1 AssertionError failure
- corrected regression after repair: 1 test passed
- upstream WebSocket suite: 46 passed, 1 skipped
- complete historical suite: 1,146 passed, 50 skipped, exit code 0
## Metrics
- Tokens: Unknown non-cached tokens — Token telemetry was not captured.
- Commands: 24 completed commands across collection — This is an absolute collection count, not a baseline comparison.
- Retries: Unknown retries — The record captured two attempts but did not define retry count separately.
- Wall Time: Unknown milliseconds — End-to-end wall time was not captured; the complete suite itself ran in 9.481 seconds.
## Agent-ready instructions
Use this only when a public wrapper controls a resource whose ownership has moved behind another abstraction. Reproduce the failure at the named public entry point, trace the current ownership chain, and verify that the wrapper reaches the active resource. Reject a suite-green patch that targets a different surface. Add a focused delegation contract test, then run related and full regression checks. Keep environment compatibility shims separate from the repair. Abstain if the wrapper is supposed to own an independent resource.
## Provenance
- Source: https://github.com/tornadoweb/tornado
- Revision: `6a5a0bfa370b6c0d3dbbf9589a560a98202d2baa`
- License: Apache-2.0
{
"schema_version": "1.0.0",
"id": "trace-2026-08-03-tr-04-tornado-nodelay",
"slug": "tornado-websocket-nodelay-delegation",
"title": "Restore WebSocket TCP_NODELAY delegation after stream ownership moved",
"summary": "Trace the public wrapper through the protocol ownership boundary, reject a suite-green wrong-surface patch, and delegate TCP_NODELAY to the active stream.",
"category": "Framework Regression",
"verification_status": "LOCALLY_VERIFIED",
"problem": {
"symptoms": [
"WebSocketHandler.set_nodelay no longer reaches the active network stream after stream ownership moves behind the protocol object.",
"A plausible proxy repair can pass the existing suite while changing the wrong client-side API surface.",
"The focused public caller contract fails even though legacy tests can remain green."
],
"error_signatures": [
"AssertionError on the obsolete handler stream"
]
},
"applicability": {
"applies_when": [
"A public wrapper delegates a control to a resource whose ownership moved behind another abstraction.",
"The issue names a public entry point whose full delegation chain can be tested.",
"A focused contract test can assert the call on the currently active resource."
],
"exclusions": [
"Do not reuse when the wrapper intentionally owns an independent stream.",
"Do not accept a green suite without a focused assertion beginning at the public caller named in the issue.",
"Do not treat this collection run as causal evidence that AEG retrieval improves repairs."
]
},
"context": {
"repository": "https://github.com/tornadoweb/tornado",
"source_revision": {
"version": "BugsInPy Tornado bug 1",
"commit_sha": "6a5a0bfa370b6c0d3dbbf9589a560a98202d2baa"
},
"environment_fingerprint": {
"language": "Python",
"runtime": "CPython 3.8.20 used in place of unavailable CPython 3.7",
"operating_system": "macOS arm64",
"dependencies": [
"Tornado historical test suite",
"temporary cancellation-only Python 3.7 compatibility shim removed before candidate hash verification"
]
},
"agent_context": {
"agent": "Codex",
"model": "unknown",
"harness": "bounded BugsInPy work-queue collection",
"reasoning": "unknown"
}
},
"failed_attempts": [
{
"approach": "Add delegation on a plausible client-side WebSocket surface.",
"observed_result": "The existing suite passed, but evaluator comparison showed that the patch targeted the wrong public surface.",
"why_failed": "The repair did not begin at WebSocketHandler.set_nodelay or follow the current server-side ownership chain."
}
],
"recovery_steps": [
"Start at the exact public method named in the issue and identify the resource it is expected to control.",
"Trace ownership through each abstraction until the currently active stream is found.",
"Add a focused contract test that calls the public wrapper and asserts delegation on the active stream.",
"Route the wrapper through the protocol object instead of retaining the stale direct stream reference.",
"Run the focused regression, related WebSocket tests, and the complete historical suite.",
"Keep environment-only compatibility shims outside the candidate patch and recheck the candidate hash after removing them."
],
"verification_method": {
"summary": "The corrected regression failed before repair and passed after repair; 46 WebSocket tests passed with one skip, and the complete historical suite passed 1,146 tests with 50 skips.",
"checks": [
"corrected regression before repair: 1 AssertionError failure",
"corrected regression after repair: 1 test passed",
"upstream WebSocket suite: 46 passed, 1 skipped",
"complete historical suite: 1,146 passed, 50 skipped, exit code 0"
],
"evidence_refs": [
"experiences/work-queue/runs/TR-04/result.json",
".github/workflows/repair-lab.yml"
]
},
"registry_metrics": {
"tokens": {
"value": null,
"unit": "non-cached tokens",
"status": "unknown",
"note": "Token telemetry was not captured."
},
"commands": {
"value": 24,
"unit": "completed commands across collection",
"status": "measured",
"note": "This is an absolute collection count, not a baseline comparison."
},
"retries": {
"value": null,
"unit": "retries",
"status": "unknown",
"note": "The record captured two attempts but did not define retry count separately."
},
"wall_time": {
"value": null,
"unit": "milliseconds",
"status": "unknown",
"note": "End-to-end wall time was not captured; the complete suite itself ran in 9.481 seconds."
}
},
"last_verified_at": "2026-08-03T06:53:21Z",
"agent_ready_instructions": "Use this only when a public wrapper controls a resource whose ownership has moved behind another abstraction. Reproduce the failure at the named public entry point, trace the current ownership chain, and verify that the wrapper reaches the active resource. Reject a suite-green patch that targets a different surface. Add a focused delegation contract test, then run related and full regression checks. Keep environment compatibility shims separate from the repair. Abstain if the wrapper is supposed to own an independent resource.",
"license": "Apache-2.0",
"task": "Restore Tornado WebSocket TCP_NODELAY delegation after stream ownership moved behind the protocol",
"outcome": "success",
"subtasks": [
{
"description": "Detect a green-suite false positive by checking the real public delegation path",
"skills": [
"contract-testing",
"historical-test-audit"
],
"tools": [
"python",
"unittest",
"git"
],
"outcome": "success",
"lessons": [
"A proxy repair can pass the existing suite while targeting the wrong public surface; the contract test must begin at the caller named in the issue."
]
},
{
"description": "Route WebSocketHandler set_nodelay through the protocol to the active stream",
"skills": [
"delegation-repair",
"api-contract-repair"
],
"tools": [
"python",
"unittest",
"Tornado test runner"
],
"outcome": "success",
"lessons": [
"When resource ownership moves behind an abstraction, public controls must follow the ownership chain instead of retaining a stale direct reference."
]
}
],
"skills": [
"contract-testing",
"historical-test-audit",
"delegation-repair",
"api-contract-repair"
],
"tools": [
"python",
"unittest",
"git",
"Tornado test runner",
"BugsInPy"
],
"constraints": [
"CPython 3.7 was unavailable on macOS arm64; the complete suite used isolated CPython 3.8.20 with a temporary cancellation-only compatibility shim that was removed after testing.",
"The first frozen candidate targeted the wrong client surface and was rejected after evaluator comparison; the successful second attempt was therefore evaluator-informed.",
"No raw logs, prompts, source patches, credentials, or private workspace paths are published."
],
"lessons": [
"Trace delegation from the issue's public entry point through every ownership boundary before choosing where to add a proxy.",
"A full green legacy suite cannot validate behavior that has no regression test; add a focused contract test that asserts the exact delegate call.",
"Reject a green patch when evaluator comparison proves that it repaired a plausible but different API surface.",
"Keep runtime-compatibility shims separate from the candidate patch and recheck the candidate hash after removing them."
],
"provenance": {
"repository": "https://github.com/yao23/agent-experience-graph",
"sourceVersion": "0.1.3",
"recordedAt": "2026-08-03T06:53:21Z",
"publicSource": {
"repository": "https://github.com/tornadoweb/tornado",
"buggyCommitSha": "6a5a0bfa370b6c0d3dbbf9589a560a98202d2baa",
"fixedCommitSha": "4677c54cc18bbfbdf0f4dadf11610fab6203fd63",
"license": "Apache-2.0",
"benchmark": "BugsInPy Tornado bug 1"
},
"experimentEvidence": {
"artifact": "experiences/work-queue/runs/TR-04/result.json",
"sourceReportCreatedAt": "2026-08-03T06:53:21Z",
"runnerSourceCommitSha": "c277a931248ad503c0864bdc3ace2e04336a4403",
"runnerSourceCommitStatus": "available: collection began from the published AM-01 checkpoint"
},
"promotionEvidence": {
"workflowName": "Validate Repair Lab",
"workflowFile": ".github/workflows/repair-lab.yml",
"validatedCommitSha": "dca38fe9db4d463c5bb16f155dc033f8895e1439",
"status": "observed-passed",
"runResolver": "https://github.com/yao23/agent-experience-graph/actions/runs/30932880306"
},
"publication": {
"pullRequest": "https://github.com/yao23/agent-experience-graph/pull/6"
}
},
"verification": {
"status": "passed",
"evidence": {
"experimentArtifact": "experiences/work-queue/runs/TR-04/result.json",
"experienceSchema": "experiences/verified-experience.schema.json",
"semanticValidator": "scripts/validate_verified_experiences.py"
},
"localChecks": {
"correctedRegressionBeforeRepair": "1 failure with AssertionError on the obsolete handler stream",
"correctedRegressionAfterRepair": "1 test passed",
"upstreamWebSocketSuite": "46 tests passed, 1 skipped",
"completeHistoricalSuite": "1,146 tests passed, 50 skipped, exit code 0 in 9.481 seconds",
"candidatePatchSha256": "afa36076a2784cd709991c585d09afb0be997c2303e8f36cd13dc220856700a4",
"changedFiles": [
"tornado/websocket.py"
]
}
},
"metrics": {
"attempts": 2,
"completedCommands": 24,
"actualTestExecutions": 12,
"durationMs": null,
"nonCachedTokens": null,
"interpretation": "The first green patch was rejected as a false positive; the second, evaluator-informed repair passed the focused, related, and complete historical suites."
},
"limitations": [
"The successful second attempt was evaluator-informed because comparison occurred after the first frozen candidate targeted the wrong API surface.",
"Historical CPython 3.7 was unavailable; CPython 3.8.20 required a temporary cancellation compatibility shim for four unrelated timeout-cancellation logs.",
"This collection run is not causal evidence that AEG retrieval improves repairs."
],
"reuse": {
"retrievalTags": [
"thin proxy delegation",
"WebSocket set_nodelay",
"stale resource ownership",
"TCP_NODELAY",
"green test false positive"
],
"recommendedFor": [
"repairing a public wrapper method after resource ownership moves behind a protocol object",
"testing delegation through multiple abstraction layers",
"rejecting a suite-green repair that targets the wrong public surface"
]
}
}