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
20 changes: 11 additions & 9 deletions .github/actions/issuelens/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down Expand Up @@ -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 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,
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
Expand Down
8 changes: 6 additions & 2 deletions .github/actions/issuelens/issuelens_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
MAX_PUSH_COMMITS = 1000
MAX_BATCH_PRS = 100
DISCOVERY_SECONDS = 180
AGENT_STREAM_INACTIVITY_TIMEOUT_SECONDS = 300
Comment thread
chagong marked this conversation as resolved.
Resolved
AGENT_STREAM_READ_BUDGET_SECONDS = 900
ASSOCIATION_BATCH_SIZE = 20
COORDINATOR_REPOSITORY = "microsoft/IssueLens"
DISPATCH_WORKFLOW = ".github/workflows/team-memory-post-merge.yml"
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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":
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/issue-triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_issue_triage_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
13 changes: 10 additions & 3 deletions tests/test_team_memory_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -505,10 +507,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)
Expand Down Expand Up @@ -591,12 +596,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)

Expand Down
Loading