From 871872e2f35a7b3d4bf4c8265fd20f0f60979187 Mon Sep 17 00:00:00 2001 From: Changyong Gong Date: Sat, 10 Oct 2026 10:22:54 +0800 Subject: [PATCH 1/2] Increase agent stream inactivity timeout Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/actions/issuelens/README.md | 18 ++++++++++-------- .github/actions/issuelens/issuelens_action.py | 8 ++++++-- tests/test_team_memory_workflow.py | 7 ++++++- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.github/actions/issuelens/README.md b/.github/actions/issuelens/README.md index bf8ba2c..3e39e5a 100644 --- a/.github/actions/issuelens/README.md +++ b/.github/actions/issuelens/README.md @@ -524,14 +524,16 @@ and full SHA succeeds. Incomplete batches preserve validated receipts before failing; invalid or ambiguous responses never become successful receipts. Issue-loop and task results may be plain text, Markdown, or requested JSON. -The submission socket timeout is 60 seconds, the cooperative stream budget is -15 minutes, and the stream is limited to 8 MiB total and 1 MiB per line. Keep a -30-minute job timeout for team memory as in the example. The nominal 3-minute -discovery, 1-minute token acquisition, 1-minute request connection, and 15-minute -stream budgets already total 20 minutes. The remaining 10 minutes provide -headroom for checkout, source-repository validation, Azure login, cooperative -timeout overruns, and saving the receipt and summary. These socket/cooperative -limits are not hard end-to-end deadlines. +The submission socket/read inactivity timeout is 5 minutes, the cooperative +total stream budget remains 15 minutes, and the stream is limited to 8 MiB total +and 1 MiB per line. The longer inactivity allowance covers model and +orchestration turns that legitimately emit no SSE bytes for more than a minute. +Keep a 30-minute job timeout for team memory as in the example. The nominal +3-minute discovery, 1-minute token acquisition, 5-minute request/read inactivity, +and 15-minute stream budgets can total 24 minutes. The remaining 6 minutes +provide headroom for checkout, source-repository validation, Azure login, +cooperative timeout overruns, and saving the receipt and summary. These +socket/cooperative limits are not hard end-to-end deadlines. Direct-action callers using the example's per-push groups may overlap or finish out of order; those groups do not coordinate different repositories. The diff --git a/.github/actions/issuelens/issuelens_action.py b/.github/actions/issuelens/issuelens_action.py index 0ff380a..e11daa8 100644 --- a/.github/actions/issuelens/issuelens_action.py +++ b/.github/actions/issuelens/issuelens_action.py @@ -22,6 +22,8 @@ MAX_PUSH_COMMITS = 1000 MAX_BATCH_PRS = 100 DISCOVERY_SECONDS = 180 +AGENT_STREAM_INACTIVITY_TIMEOUT_SECONDS = 300 +AGENT_STREAM_READ_BUDGET_SECONDS = 900 ASSOCIATION_BATCH_SIZE = 20 COORDINATOR_REPOSITORY = "microsoft/IssueLens" DISPATCH_WORKFLOW = ".github/workflows/team-memory-post-merge.yml" @@ -683,7 +685,8 @@ def read_response(response, renderer=None): break total += len(raw) require(len(raw) <= 1024 * 1024 and total <= 8 * 1024 * 1024, "Agent response exceeds stream limits") - require(time.monotonic() - started <= 900, "Agent response exceeded the 15-minute read budget") + require(time.monotonic() - started <= AGENT_STREAM_READ_BUDGET_SECONDS, + "Agent response exceeded the 15-minute read budget") line = raw.decode("utf-8").rstrip("\r\n") if renderer is not None: renderer.tick() @@ -823,7 +826,8 @@ def submit(): method="POST", ) try: - with urllib.request.build_opener(NoRedirect()).open(request, timeout=60) as response: + with urllib.request.build_opener(NoRedirect()).open( + request, timeout=AGENT_STREAM_INACTIVITY_TIMEOUT_SECONDS) as response: text = read_response(response, renderer) result = None if request_type == "team-memory": diff --git a/tests/test_team_memory_workflow.py b/tests/test_team_memory_workflow.py index dfe2ef9..62d996d 100644 --- a/tests/test_team_memory_workflow.py +++ b/tests/test_team_memory_workflow.py @@ -505,10 +505,13 @@ def test_successful_submission_and_no_change(self): self.assertEqual(request.get_header("Authorization"), "Bearer fake-endpoint-token") self.assertNotIn(b"fake-endpoint-token", request.data) self.assertEqual(self.opener.open.call_count, 1) + self.assertEqual(action.AGENT_STREAM_INACTIVITY_TIMEOUT_SECONDS, 300) + self.assertEqual(self.opener.open.call_args.kwargs["timeout"], 300) self.assertEqual(self.token.call_args.args[0], [ "az", "account", "get-access-token", "--scope", "https://ai.azure.com/.default", "--query", "accessToken", "-o", "tsv", ]) + self.assertEqual(self.token.call_args.kwargs["timeout"], 60) summary = (self.directory / "summary.md").read_text() self.assertIn(self.result["wiki_sha"], summary) self.assertNotIn("fake-endpoint-token", summary) @@ -591,12 +594,14 @@ def test_azure_token_is_required_before_submission(self): def test_stream_total_budget_and_deadline(self): self.write_envelope() self.execute("submit", [self.stream()]) + self.assertEqual(action.AGENT_STREAM_READ_BUDGET_SECONDS, 900) read_result = action.read_response body = (b":" + b"x" * (128 * 1024) + b"\n\n") * 65 with Response(body, "text/event-stream") as response: with self.assertRaisesRegex(ValueError, "stream limits"): read_result(response) - with self.stream() as response, patch("time.monotonic", side_effect=[0, 901]): + with self.stream() as response, patch( + "time.monotonic", side_effect=[0, action.AGENT_STREAM_READ_BUDGET_SECONDS + 1]): with self.assertRaisesRegex(ValueError, "read budget"): read_result(response) From 3657e9fe70a1ffc18da6edcb064f3e1c31440595 Mon Sep 17 00:00:00 2001 From: Changyong Gong Date: Sat, 10 Oct 2026 10:36:44 +0800 Subject: [PATCH 2/2] Increase issue loop timeout headroom Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/actions/issuelens/README.md | 4 ++-- .github/workflows/issue-triage.yml | 2 +- tests/test_issue_triage_workflow.py | 2 +- tests/test_team_memory_workflow.py | 6 ++++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/actions/issuelens/README.md b/.github/actions/issuelens/README.md index 3e39e5a..3fc7d34 100644 --- a/.github/actions/issuelens/README.md +++ b/.github/actions/issuelens/README.md @@ -292,7 +292,7 @@ establish live publication. Use the event filters and per-issue concurrency from the [issue workflow](../../workflows/issue-triage.yml). Its job grants -`contents: read`, `issues: read`, and `id-token: write`, and uses a 20-minute +`contents: read`, `issues: read`, and `id-token: write`, and uses a 30-minute timeout. In an external repository remove its local checkout step and change the remaining action call to: @@ -528,7 +528,7 @@ The submission socket/read inactivity timeout is 5 minutes, the cooperative total stream budget remains 15 minutes, and the stream is limited to 8 MiB total and 1 MiB per line. The longer inactivity allowance covers model and orchestration turns that legitimately emit no SSE bytes for more than a minute. -Keep a 30-minute job timeout for team memory as in the example. The nominal +Keep a 30-minute caller job timeout as in the examples. The nominal 3-minute discovery, 1-minute token acquisition, 5-minute request/read inactivity, and 15-minute stream budgets can total 24 minutes. The remaining 6 minutes provide headroom for checkout, source-repository validation, Azure login, diff --git a/.github/workflows/issue-triage.yml b/.github/workflows/issue-triage.yml index f6a9925..ce5554f 100644 --- a/.github/workflows/issue-triage.yml +++ b/.github/workflows/issue-triage.yml @@ -49,7 +49,7 @@ jobs: (github.event_name != 'workflow_dispatch' || github.ref == format('refs/heads/{0}', github.event.repository.default_branch)) runs-on: ubuntu-latest - timeout-minutes: 20 + timeout-minutes: 30 permissions: contents: read issues: read diff --git a/tests/test_issue_triage_workflow.py b/tests/test_issue_triage_workflow.py index eeb7dcc..2437414 100644 --- a/tests/test_issue_triage_workflow.py +++ b/tests/test_issue_triage_workflow.py @@ -44,7 +44,7 @@ def test_caller_is_thin_and_loads_trusted_action(self): self.assertEqual(invoke["with"]["issue-number"], "${{ inputs.issue_number }}") self.assertEqual(self.workflow["permissions"], {}) self.assertEqual(self.job["permissions"], {"contents": "read", "issues": "read", "id-token": "write"}) - self.assertEqual(self.job["timeout-minutes"], "20") + self.assertEqual(self.job["timeout-minutes"], "30") self.assertTrue(all("run" not in step for step in self.job["steps"])) self.assertNotIn("pull_request.head", self.source) diff --git a/tests/test_team_memory_workflow.py b/tests/test_team_memory_workflow.py index 62d996d..2904608 100644 --- a/tests/test_team_memory_workflow.py +++ b/tests/test_team_memory_workflow.py @@ -167,12 +167,14 @@ def test_invocation_action_owns_preflight_and_has_no_artifact_path(self): self.assertTrue(all("${{" not in step["run"] for step in self.action_metadata["runs"]["steps"] if "run" in step)) def test_job_timeout_has_setup_and_receipt_headroom(self): - token_seconds, connection_seconds, stream_seconds = 60, 60, 15 * 60 + token_seconds = 60 + connection_seconds = action.AGENT_STREAM_INACTIVITY_TIMEOUT_SECONDS + stream_seconds = action.AGENT_STREAM_READ_BUDGET_SECONDS phase_seconds = action.DISCOVERY_SECONDS + token_seconds + connection_seconds + stream_seconds self.assertGreaterEqual(int(self.job["timeout-minutes"]) * 60 - phase_seconds, 5 * 60) self.assertEqual(self.job["timeout-minutes"], "30") self.assertIn("30-minute timeout", (ROOT / "docs" / "guide.md").read_text(encoding="utf-8")) - self.assertIn("30-minute job timeout", (ACTION_DIR / "README.md").read_text(encoding="utf-8")) + self.assertIn("30-minute caller job timeout", (ACTION_DIR / "README.md").read_text(encoding="utf-8")) def test_local_caller_loads_only_trusted_action_revision(self): checkout = self.steps[0]