Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
298 changes: 298 additions & 0 deletions docs/lanes/bp0-delegate-timeout-partial-consumer/DONE-NOTE.md

Large diffs are not rendered by default.

102 changes: 102 additions & 0 deletions docs/lanes/bp0-delegate-timeout-partial-consumer/after-probe.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
PATCHED TREE (working copy on top of 5ebf1da)
DATE: 2026-09-03T07:33:00Z
CMD: PYTHONPATH=modules/tool-delegate uv run python docs/lanes/bp0-delegate-timeout-partial-consumer/probe_timeout_contract.py

Agent 'test-agent' timed out after 0.01s (delegate tool session-level timeout; elapsed 0.01s). Partial output was preserved and is returned under 'partial_response' -- it is UNFINISHED, not a result. Child cancellation cleanup is still in progress; do not resume this session until cleanup and persistence complete.
Resumed agent 'test-agent' timed out after 0.01s (delegate tool session-level timeout; elapsed 0.01s). Partial output was preserved and is returned under 'partial_response' -- it is UNFINISHED, not a result. Child cancellation cleanup is still in progress; do not resume this session until cleanup and persistence complete.
Agent 'test-agent' timed out after 0.01s (delegate tool session-level timeout; elapsed 0.01s). Partial output was preserved and is returned under 'partial_response' -- it is UNFINISHED, not a result. Child cancellation cleanup is still in progress; do not resume this session until cleanup and persistence complete.
--- A. spawn timeout: result.success ---
false

--- A. spawn timeout: result.output ---
{
"agent": "test-agent",
"completed": false,
"guidance": "INCOMPLETE: this delegate did not finish. The text in 'partial_response' is unfinished work salvaged from the agent mid-flight -- it has NOT been checked, concluded, or self-reviewed by that agent. Do not report it as a completed result and do not treat its conclusions as final. Re-delegate a narrower task or complete the work yourself; see metadata.recovery_message before considering this session for resumption.",
"metadata": {
"elapsed_s": "<elapsed>",
"recovery_message": "Child cancellation cleanup is still in progress; do not resume this session until cleanup and persistence complete.",
"resumable": false,
"resume_status": "pending_child_cleanup",
"timeout_seconds": 0.01
},
"partial_available": true,
"partial_chars_total": 22,
"partial_response": "straggler got this far",
"partial_segments": 7,
"partial_source": "capability",
"partial_truncated": false,
"session_id": "0000000000000000-c7ab32b24e5947fc_test-agent",
"status": "timeout"
}

--- A. spawn timeout: delegate:error payload (elapsed_s dropped) ---
{
"agent": "test-agent",
"error": "Agent 'test-agent' timed out after 0.01s (delegate tool session-level timeout; elapsed 0.01s). Partial output was preserved and is returned under 'partial_response' -- it is UNFINISHED, not a result. Child cancellation cleanup is still in progress; do not resume this session until cleanup and persistence complete.",
"error_type": "delegate_timeout",
"parallel_group_id": "parallel-timeout",
"parent_session_id": "parent-session-123",
"partial_available": true,
"partial_chars": 22,
"resumable": false,
"resume_status": "pending_child_cleanup",
"status": "timeout",
"sub_session_id": "<generated>",
"timeout_seconds": 0.01,
"tool_call_id": "call-timeout"
}

A. CONTRACT: status==timeout | 'response' absent==True | 'partial_available' present==True

--- B. resume timeout: result.output ---
{
"agent": "test-agent",
"completed": false,
"guidance": "INCOMPLETE: this delegate did not finish. The text in 'partial_response' is unfinished work salvaged from the agent mid-flight -- it has NOT been checked, concluded, or self-reviewed by that agent. Do not report it as a completed result and do not treat its conclusions as final. Re-delegate a narrower task or complete the work yourself; see metadata.recovery_message before considering this session for resumption.",
"metadata": {
"elapsed_s": "<elapsed>",
"recovery_message": "Child cancellation cleanup is still in progress; do not resume this session until cleanup and persistence complete.",
"resumable": false,
"resume_status": "pending_child_cleanup",
"timeout_seconds": 0.01
},
"partial_available": true,
"partial_chars_total": 22,
"partial_response": "straggler got this far",
"partial_segments": 7,
"partial_source": "capability",
"partial_truncated": false,
"session_id": "child-session-001_test-agent",
"status": "timeout"
}

B. CONTRACT: status==timeout | 'response' absent==True | 'partial_available' present==True

--- C. G-D1 sibling survival ---
gather returned; completed siblings surviving = 2 of 2; discarded-completed-sibling count = 0

--- D. normal completion: result.success ---
true

--- D. normal completion: result.output ---
{
"agent": "test-agent",
"contract": {
"artifacts": [],
"conformant": null,
"findings": [],
"not_covered": [],
"reason": null,
"summary": null
},
"metadata": {},
"response": "the whole answer",
"session_id": "sub-1",
"status": "success",
"turn_count": 3
}

D. normal completion: serialized output
{"response": "the whole answer", "session_id": "sub-1", "agent": "test-agent", "turn_count": 3, "status": "success", "metadata": {}, "contract": {"conformant": null, "reason": null, "summary": null, "findings": [], "not_covered": [], "artifacts": []}}

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
BYTE-IDENTITY CHECK -- normal (non-timeout) delegate completion
DATE: 2026-09-03T07:33:09Z

Section D of the probe is a NORMAL completion. Compared verbatim between the
parent commit 5ebf1da (fail-before-probe.txt) and the patched tree (after-probe.txt).
It includes the exact serialized string the model receives.

$ diff <(sed -n "/^--- D./,$p" fail-before-probe.txt) <(sed -n "/^--- D./,$p" after-probe.txt)
(no output -- IDENTICAL)

RESULT: byte-identical. sha256 of each section:
18dfd629b68861f7c11e2182a6d730f5e26cef39d48b8d4a9396b63b587a0ab1 D-before.txt
18dfd629b68861f7c11e2182a6d730f5e26cef39d48b8d4a9396b63b587a0ab1 D-after.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
PARENT COMMIT: 5ebf1dab1fba33539e15499698f33cb3b9fc2b78 (fix(activator): install a bundle root's package only when a declared module lives there; fail by name)
DATE: 2026-09-03T07:29:51Z
CMD: PYTHONPATH=modules/tool-delegate uv run python docs/lanes/bp0-delegate-timeout-partial-consumer/probe_timeout_contract.py

Agent 'test-agent' timed out after 0.01s (delegate tool session-level timeout). Child cancellation cleanup is still in progress; do not resume this session until cleanup and persistence complete.
Resumed agent 'test-agent' timed out after 0.01s (delegate tool session-level timeout). Child cancellation cleanup is still in progress; do not resume this session until cleanup and persistence complete.
Agent 'test-agent' timed out after 0.01s (delegate tool session-level timeout). Child cancellation cleanup is still in progress; do not resume this session until cleanup and persistence complete.
--- A. spawn timeout: result.success ---
false

--- A. spawn timeout: result.output ---
{
"agent": "test-agent",
"metadata": {
"recovery_message": "Child cancellation cleanup is still in progress; do not resume this session until cleanup and persistence complete.",
"resumable": false,
"resume_status": "pending_child_cleanup",
"timeout_seconds": 0.01
},
"session_id": "0000000000000000-d13c50c4216142b9_test-agent",
"status": "timed_out"
}

--- A. spawn timeout: delegate:error payload (elapsed_s dropped) ---
{
"agent": "test-agent",
"error": "Agent 'test-agent' timed out after 0.01s (delegate tool session-level timeout). Child cancellation cleanup is still in progress; do not resume this session until cleanup and persistence complete.",
"error_type": "delegate_timeout",
"parallel_group_id": "parallel-timeout",
"parent_session_id": "parent-session-123",
"resumable": false,
"resume_status": "pending_child_cleanup",
"status": "timed_out",
"sub_session_id": "<generated>",
"timeout_seconds": 0.01,
"tool_call_id": "call-timeout"
}

A. CONTRACT: status==timed_out | 'response' absent==True | 'partial_available' present==False

--- B. resume timeout: result.output ---
{
"agent": "test-agent",
"metadata": {
"recovery_message": "Child cancellation cleanup is still in progress; do not resume this session until cleanup and persistence complete.",
"resumable": false,
"resume_status": "pending_child_cleanup",
"timeout_seconds": 0.01
},
"session_id": "child-session-001_test-agent",
"status": "timed_out"
}

B. CONTRACT: status==timed_out | 'response' absent==True | 'partial_available' present==False

--- C. G-D1 sibling survival ---
gather returned; completed siblings surviving = 2 of 2; discarded-completed-sibling count = 0

--- D. normal completion: result.success ---
true

--- D. normal completion: result.output ---
{
"agent": "test-agent",
"contract": {
"artifacts": [],
"conformant": null,
"findings": [],
"not_covered": [],
"reason": null,
"summary": null
},
"metadata": {},
"response": "the whole answer",
"session_id": "sub-1",
"status": "success",
"turn_count": 3
}

D. normal completion: serialized output
{"response": "the whole answer", "session_id": "sub-1", "agent": "test-agent", "turn_count": 3, "status": "success", "metadata": {}, "contract": {"conformant": null, "reason": null, "summary": null, "findings": [], "not_covered": [], "artifacts": []}}

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
PARENT COMMIT: 5ebf1dab1fba33539e15499698f33cb3b9fc2b78
CMD: uv run pytest <test_delegate_timeout_partial.py with a 2-line ImportError shim> -q
WHY THE SHIM: on the parent commit the module exports no DEFAULT_PARTIAL_MAX_CHARS, so the real
file dies at collection and yields ONE error instead of per-behaviour evidence. The shim defaults
that one constant and changes nothing else, so each test fails on its own assertion.

"""
tool = _make_tool()
> assert tool.partial_max_chars == DEFAULT_PARTIAL_MAX_CHARS == 20000
^^^^^^^^^^^^^^^^^^^^^^
E AttributeError: 'DelegateTool' object has no attribute 'partial_max_chars'

modules/tool-delegate/tests/test_zz_failbefore_shim.py:349: AttributeError
____________ test_resume_timeout_carries_the_same_partial_contract _____________

@pytest.mark.asyncio
async def test_resume_timeout_carries_the_same_partial_contract():
"""The resume path is a second timeout call site; it must not diverge."""
hooks = _hooks()
tool = _make_tool(
timeout=0.01,
resume_fn=AsyncMock(side_effect=_never_finishes),
partial_fn=lambda sid: {"text": "resumed partial", "segments": 3},
)
result = await _resume(tool, hooks)

assert result.success is False
assert "response" not in result.output
> assert result.output["status"] == "timeout"
E AssertionError: assert 'timed_out' == 'timeout'
E
E - timeout
E + timed_out
E ? ++

modules/tool-delegate/tests/test_zz_failbefore_shim.py:366: AssertionError
------------------------------ Captured log call -------------------------------
WARNING amplifier_module_tool_delegate:__init__.py:2481 Resumed agent 'test-agent' timed out after 0.01s (delegate tool session-level timeout). Child cancellation cleanup is still in progress; do not resume this session until cleanup and persistence complete.
=========================== short test summary info ============================
FAILED modules/tool-delegate/tests/test_zz_failbefore_shim.py::test_timeout_is_not_success_on_either_channel
FAILED modules/tool-delegate/tests/test_zz_failbefore_shim.py::test_partial_text_never_lands_on_the_success_key
FAILED modules/tool-delegate/tests/test_zz_failbefore_shim.py::test_straggler_returns_rather_than_raises_so_siblings_survive
FAILED modules/tool-delegate/tests/test_zz_failbefore_shim.py::test_no_partial_capability_degrades_to_no_partial_not_to_error
FAILED modules/tool-delegate/tests/test_zz_failbefore_shim.py::test_partial_capability_raising_does_not_break_the_timeout_path
FAILED modules/tool-delegate/tests/test_zz_failbefore_shim.py::test_async_partial_capability_is_supported
FAILED modules/tool-delegate/tests/test_zz_failbefore_shim.py::test_partial_text_is_capped_and_keeps_the_tail
FAILED modules/tool-delegate/tests/test_zz_failbefore_shim.py::test_malformed_partial_payload_is_ignored
FAILED modules/tool-delegate/tests/test_zz_failbefore_shim.py::test_timeout_event_carries_elapsed_and_partial_flags
FAILED modules/tool-delegate/tests/test_zz_failbefore_shim.py::test_partial_max_chars_default_is_shipped_not_swept
FAILED modules/tool-delegate/tests/test_zz_failbefore_shim.py::test_resume_timeout_carries_the_same_partial_contract
11 failed, 1 passed in 0.24s
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
APPLY.md's literal instruction, run against 5ebf1da:
$ git apply --check PATCH-foundation-tool-delegate.diff
error: patch failed: modules/tool-delegate/amplifier_module_tool_delegate/__init__.py:20
error: modules/tool-delegate/amplifier_module_tool_delegate/__init__.py: patch does not apply
exit=1

$ git apply --3way --check PATCH-foundation-tool-delegate.diff
error: repository lacks the necessary blob to perform 3-way merge.
Falling back to direct application...
error: patch failed: modules/tool-delegate/amplifier_module_tool_delegate/__init__.py:20
error: modules/tool-delegate/amplifier_module_tool_delegate/__init__.py: patch does not apply
Falling back to direct application...
exit=1
Loading
Loading