Skip to content

Commit 6ae0f40

Browse files
Python: Refresh dependencies and block compromised releases (#9590)
* Python: refresh dependencies and block compromised releases Co-authored-by: Copilot App <[email protected]> Copilot-Session: 511ea24f-5793-44f6-be7a-73fb5f5a278d * Python: fix dependency refresh regressions Co-authored-by: Copilot App <[email protected]> Copilot-Session: 511ea24f-5793-44f6-be7a-73fb5f5a278d * Python: address dependency refresh review Co-authored-by: Copilot App <[email protected]> Copilot-Session: 511ea24f-5793-44f6-be7a-73fb5f5a278d * Python: fix refreshed dependency typing and metadata Co-authored-by: Copilot App <[email protected]> Copilot-Session: 511ea24f-5793-44f6-be7a-73fb5f5a278d --------- Copilot-Session: 511ea24f-5793-44f6-be7a-73fb5f5a278d
1 parent dbca9d8 commit 6ae0f40

38 files changed

Lines changed: 5120 additions & 5800 deletions

File tree

‎.github/workflows/devflow-fix-ci.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ jobs:
148148
- if: ${{ steps.team.outputs.permitted == 'true' }}
149149
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
150150
with:
151-
version: '0.13.1'
151+
version: '0.13.5'
152152
enable-cache: false
153153
- name: Install trusted controller dependencies
154154
if: ${{ steps.team.outputs.permitted == 'true' }}
@@ -231,7 +231,7 @@ jobs:
231231
python-version: '3.13'
232232
- uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
233233
with:
234-
version: '0.13.1'
234+
version: '0.13.5'
235235
enable-cache: false
236236
- name: Install trusted controller dependencies
237237
run: uv sync --frozen --directory "$DEVFLOW_PATH"
@@ -407,7 +407,7 @@ jobs:
407407
python-version: '3.13'
408408
- uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
409409
with:
410-
version: '0.13.1'
410+
version: '0.13.5'
411411
enable-cache: false
412412
- name: Install trusted controller dependencies
413413
run: uv sync --frozen --directory "$DEVFLOW_PATH"

‎.github/workflows/devflow-pr-review.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ jobs:
248248
- name: Set up uv
249249
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
250250
with:
251-
version: "0.13.1"
251+
version: "0.13.5"
252252
enable-cache: auto
253253

254254
- name: Install DevFlow dependencies

‎.github/workflows/issue-triage.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ jobs:
192192
- name: Set up uv
193193
uses: astral-sh/setup-uv@1c37ad07a6a961277cf70c0d37d6f313000f5884 # v10.3.0
194194
with:
195-
version: "0.13.1"
195+
version: "0.13.5"
196196
enable-cache: true
197197

198198
- name: Install DevFlow dependencies

‎python/.pre-commit-config.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ repos:
6262
additional_dependencies: ["bandit[toml]"]
6363
- repo: https://github.com/astral-sh/uv-pre-commit
6464
# uv version.
65-
rev: 0.13.1
65+
rev: 0.13.5
6666
hooks:
6767
# Update the uv lockfile
6868
- id: uv-lock

‎python/packages/ag-ui/agent_framework_ag_ui/_run_common.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,7 @@ def _emit_text(content: Content, flow: FlowState, skip_text: bool = False) -> li
648648
flow.text_delta_count = 0
649649
_open_text_segment(flow, flow.message_id)
650650
events.append(TextMessageStartEvent(message_id=flow.message_id, role="assistant"))
651-
elif flow.accumulated_text and content.text == flow.accumulated_text and (
652-
flow.text_delta_count > 1
653-
):
651+
elif flow.accumulated_text and content.text == flow.accumulated_text and (flow.text_delta_count > 1):
654652
# Guard against full-message replay chunks that can appear after streaming deltas.
655653
# A duplicate equal to the whole accumulated text is only a safe replay signal when
656654
# the text already streamed in more than one chunk. With a single prior chunk the

‎python/packages/ag-ui/tests/ag_ui/golden/test_scenario_workflow.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,10 @@ async def failing(message: Any, ctx: WorkflowContext[Any, str]) -> None:
465465
assert "workflow exploded" not in error.message
466466
records = [record for record in caplog.records if record.name == "agent_framework_ag_ui._workflow_run"]
467467
assert len(records) == 1
468-
assert records[0].exc_info is not None
469-
assert isinstance(records[0].exc_info[1], RuntimeError)
470-
assert records[0].exc_info[2] is not None
468+
exc_info = records[0].exc_info
469+
assert exc_info
470+
assert isinstance(exc_info[1], RuntimeError)
471+
assert exc_info[2] is not None
471472
assert "workflow exploded" in records[0].getMessage()
472473

473474

‎python/packages/core/tests/core/test_observability.py‎

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@
4343
get_function_span,
4444
)
4545

46+
47+
def _span_attributes(span: Any) -> dict[str, Any]:
48+
attributes = span.attributes
49+
return dict(attributes) if attributes is not None else {}
50+
51+
4652
# region Test constants
4753

4854

@@ -2043,7 +2049,8 @@ async def test_enable_instrumentation_controls_message_event_emission(
20432049

20442050
spans = span_exporter.get_finished_spans()
20452051
assert len(spans) == 1
2046-
attributes = spans[0].attributes or {}
2052+
attributes = spans[0].attributes
2053+
assert attributes is not None
20472054
assert (OtelAttr.INPUT_MESSAGES in attributes) is (enable_sensitive_data and bool(semconv))
20482055
assert (OtelAttr.OUTPUT_MESSAGES in attributes) is (enable_sensitive_data and bool(semconv))
20492056

@@ -2528,7 +2535,8 @@ async def test_chat_client_observability_provider_name_under_baseline_semconv(
25282535

25292536
spans = span_exporter.get_finished_spans()
25302537
assert len(spans) == 1
2531-
attributes = spans[0].attributes or {}
2538+
attributes = spans[0].attributes
2539+
assert attributes is not None
25322540
assert OtelAttr.SYSTEM in attributes
25332541
assert OtelAttr.PROVIDER_NAME not in attributes
25342542

@@ -4026,7 +4034,8 @@ def test_capture_messages_baseline_semconv_emits_events_only(span_exporter: InMe
40264034

40274035
spans = span_exporter.get_finished_spans()
40284036
assert len(spans) == 1
4029-
attributes = spans[0].attributes or {}
4037+
attributes = spans[0].attributes
4038+
assert attributes is not None
40304039
assert OtelAttr.INPUT_MESSAGES not in attributes
40314040
mock_emit.assert_called_once()
40324041
assert mock_emit.call_args.kwargs["event_name"] == "gen_ai.user.message"
@@ -4061,7 +4070,8 @@ def test_capture_messages_latest_experimental_emits_span_attribute_only_when_eve
40614070

40624071
spans = span_exporter.get_finished_spans()
40634072
assert len(spans) == 1
4064-
attributes = spans[0].attributes or {}
4073+
attributes = spans[0].attributes
4074+
assert attributes is not None
40654075
input_messages = json.loads(cast(str, attributes[OtelAttr.INPUT_MESSAGES]))
40664076
assert [msg.get("role") for msg in input_messages] == ["user"]
40674077
assert mock_emit.call_count == 0
@@ -4094,7 +4104,8 @@ def test_capture_messages_defaults_emit_both_events_and_span_attribute(span_expo
40944104

40954105
spans = span_exporter.get_finished_spans()
40964106
assert len(spans) == 1
4097-
attributes = spans[0].attributes or {}
4107+
attributes = spans[0].attributes
4108+
assert attributes is not None
40984109
input_messages = json.loads(cast(str, attributes[OtelAttr.INPUT_MESSAGES]))
40994110
assert [msg.get("role") for msg in input_messages] == ["user"]
41004111
mock_emit.assert_called_once()
@@ -4162,7 +4173,8 @@ def test_capture_messages_preserves_custom_finish_reason(span_exporter: InMemory
41624173

41634174
assert mock_emit.call_args.kwargs["body"]["finish_reason"] == "guardrail"
41644175
spans = span_exporter.get_finished_spans()
4165-
attributes = spans[0].attributes or {}
4176+
attributes = spans[0].attributes
4177+
assert attributes is not None
41664178
output_messages = json.loads(cast(str, attributes[OtelAttr.OUTPUT_MESSAGES]))
41674179
assert output_messages[-1]["finish_reason"] == "guardrail"
41684180

@@ -4199,7 +4211,9 @@ def test_capture_messages_exports_native_otel_event(span_exporter: InMemorySpanE
41994211
record = readable_record.log_record
42004212
assert record.event_name == "gen_ai.user.message"
42014213
assert record.body == {"content": "Test"}
4202-
assert dict(record.attributes or {}) == {"gen_ai.system": "test_provider"}
4214+
record_attributes = record.attributes
4215+
assert record_attributes is not None
4216+
assert dict(record_attributes) == {"gen_ai.system": "test_provider"}
42034217
assert record.trace_id == span_context.trace_id
42044218
assert record.span_id == span_context.span_id
42054219

@@ -5749,7 +5763,7 @@ async def before_run(
57495763
agent_spans = [
57505764
span
57515765
for span in spans
5752-
if span.attributes and span.attributes.get(OtelAttr.OPERATION.value) == OtelAttr.AGENT_INVOKE_OPERATION
5766+
if _span_attributes(span).get(OtelAttr.OPERATION.value) == OtelAttr.AGENT_INVOKE_OPERATION
57535767
]
57545768
assert len(agent_spans) == 1
57555769

@@ -5813,13 +5827,13 @@ async def after_run(
58135827
agent_spans = [
58145828
span
58155829
for span in spans
5816-
if span.attributes and span.attributes.get(OtelAttr.OPERATION.value) == OtelAttr.AGENT_INVOKE_OPERATION
5830+
if _span_attributes(span).get(OtelAttr.OPERATION.value) == OtelAttr.AGENT_INVOKE_OPERATION
58175831
]
58185832
assert len(agent_spans) == 1
58195833
chat_spans = [
58205834
span
58215835
for span in spans
5822-
if span.attributes and span.attributes.get(OtelAttr.OPERATION.value) == OtelAttr.CHAT_COMPLETION_OPERATION
5836+
if _span_attributes(span).get(OtelAttr.OPERATION.value) == OtelAttr.CHAT_COMPLETION_OPERATION
58235837
]
58245838
assert len(chat_spans) == 2
58255839

‎python/packages/core/tests/workflow/test_edge.py‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
from agent_framework.observability import EdgeGroupDeliveryStatus, OtelAttr
2929

3030

31+
def _span_attributes(span: Any) -> dict[str, Any]:
32+
attributes = span.attributes
33+
return dict(attributes) if attributes is not None else {}
34+
35+
3136
@dataclass
3237
class MockMessage:
3338
"""A mock message for testing purposes."""
@@ -331,7 +336,7 @@ async def test_single_edge_group_tracing_success(span_exporter: InMemorySpanExpo
331336
assert success is True
332337

333338
spans = span_exporter.get_finished_spans()
334-
edge_group_spans = [s for s in spans if s.attributes and s.attributes.get("edge_group.type") is not None]
339+
edge_group_spans = [s for s in spans if _span_attributes(s).get("edge_group.type") is not None]
335340

336341
assert len(edge_group_spans) == 1
337342

@@ -376,7 +381,7 @@ async def test_single_edge_group_tracing_condition_failure(span_exporter: InMemo
376381
assert success is True # Returns True but condition failed
377382

378383
spans = span_exporter.get_finished_spans()
379-
edge_group_spans = [s for s in spans if s.attributes and s.attributes.get("edge_group.type") is not None]
384+
edge_group_spans = [s for s in spans if _span_attributes(s).get("edge_group.type") is not None]
380385

381386
assert len(edge_group_spans) == 1
382387

@@ -450,7 +455,7 @@ async def test_single_edge_group_tracing_type_mismatch(span_exporter: InMemorySp
450455
assert success is False
451456

452457
spans = span_exporter.get_finished_spans()
453-
edge_group_spans = [s for s in spans if s.attributes and s.attributes.get("edge_group.type") is not None]
458+
edge_group_spans = [s for s in spans if _span_attributes(s).get("edge_group.type") is not None]
454459

455460
assert len(edge_group_spans) == 1
456461

@@ -484,7 +489,7 @@ async def test_single_edge_group_tracing_target_mismatch(span_exporter: InMemory
484489
assert success is False
485490

486491
spans = span_exporter.get_finished_spans()
487-
edge_group_spans = [s for s in spans if s.attributes and s.attributes.get("edge_group.type") is not None]
492+
edge_group_spans = [s for s in spans if _span_attributes(s).get("edge_group.type") is not None]
488493

489494
assert len(edge_group_spans) == 1
490495

@@ -900,7 +905,7 @@ async def test_fan_out_edge_group_tracing_success(span_exporter: InMemorySpanExp
900905
assert success is True
901906

902907
spans = span_exporter.get_finished_spans()
903-
edge_group_spans = [s for s in spans if s.attributes and s.attributes.get("edge_group.type") is not None]
908+
edge_group_spans = [s for s in spans if _span_attributes(s).get("edge_group.type") is not None]
904909

905910
assert len(edge_group_spans) == 1
906911

@@ -956,7 +961,7 @@ async def test_fan_out_edge_group_tracing_with_target(span_exporter: InMemorySpa
956961
assert success is True
957962

958963
spans = span_exporter.get_finished_spans()
959-
edge_group_spans = [s for s in spans if s.attributes and s.attributes.get("edge_group.type") is not None]
964+
edge_group_spans = [s for s in spans if _span_attributes(s).get("edge_group.type") is not None]
960965

961966
assert len(edge_group_spans) == 1
962967

@@ -1126,7 +1131,7 @@ async def test_fan_in_edge_group_tracing_buffered(span_exporter: InMemorySpanExp
11261131
assert success is True
11271132

11281133
spans = span_exporter.get_finished_spans()
1129-
edge_group_spans = [s for s in spans if s.attributes and s.attributes.get("edge_group.type") is not None]
1134+
edge_group_spans = [s for s in spans if _span_attributes(s).get("edge_group.type") is not None]
11301135

11311136
assert len(edge_group_spans) == 1
11321137

@@ -1160,7 +1165,7 @@ async def test_fan_in_edge_group_tracing_buffered(span_exporter: InMemorySpanExp
11601165
assert success is True
11611166

11621167
spans = span_exporter.get_finished_spans()
1163-
edge_group_spans = [s for s in spans if s.attributes and s.attributes.get("edge_group.type") is not None]
1168+
edge_group_spans = [s for s in spans if _span_attributes(s).get("edge_group.type") is not None]
11641169

11651170
assert len(edge_group_spans) == 1
11661171

@@ -1206,7 +1211,7 @@ async def test_fan_in_edge_group_tracing_type_mismatch(span_exporter: InMemorySp
12061211
assert success is False
12071212

12081213
spans = span_exporter.get_finished_spans()
1209-
edge_group_spans = [s for s in spans if s.attributes and s.attributes.get("edge_group.type") is not None]
1214+
edge_group_spans = [s for s in spans if _span_attributes(s).get("edge_group.type") is not None]
12101215

12111216
assert len(edge_group_spans) == 1
12121217

‎python/packages/core/tests/workflow/test_workflow_observability.py‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
)
2222

2323

24+
def _span_attributes(span: Any) -> dict[str, Any]:
25+
attributes = span.attributes
26+
return dict(attributes) if attributes is not None else {}
27+
28+
2429
def _assert_workflow_error_details(
2530
details: WorkflowErrorDetails,
2631
private_error_detail: str,
@@ -228,7 +233,7 @@ async def test_trace_context_handling(span_exporter: InMemorySpanExporter) -> No
228233
# Check that spans were created with proper attributes
229234
spans = span_exporter.get_finished_spans()
230235
# Processing spans now use executor_id as the span name
231-
processing_spans = [s for s in spans if s.attributes and s.attributes.get("executor.id") == "test-executor"]
236+
processing_spans = [s for s in spans if _span_attributes(s).get("executor.id") == "test-executor"]
232237
sending_spans = [s for s in spans if s.name == "message.send"]
233238

234239
assert len(processing_spans) >= 1
@@ -355,7 +360,7 @@ async def test_end_to_end_workflow_tracing(span_exporter: InMemorySpanExporter)
355360
# Should have workflow span, processing spans, and sending spans
356361
# Processing spans now use executor_id as the span name, filter by executor.id attribute
357362
workflow_spans = [s for s in spans if s.name == "workflow.run"]
358-
processing_spans = [s for s in spans if s.attributes and s.attributes.get("executor.id") is not None]
363+
processing_spans = [s for s in spans if _span_attributes(s).get("executor.id") is not None]
359364
sending_spans = [s for s in spans if s.name == "message.send"]
360365
build_spans_after_run = [s for s in spans if s.name == "workflow.build"]
361366

@@ -379,7 +384,7 @@ async def test_end_to_end_workflow_tracing(span_exporter: InMemorySpanExporter)
379384
assert "workflow.completed" in event_names
380385

381386
# Test fan-in span linking: find the aggregator's processing span
382-
aggregator_spans = [s for s in processing_spans if s.attributes and s.attributes.get("executor.id") == "aggregator"]
387+
aggregator_spans = [s for s in processing_spans if _span_attributes(s).get("executor.id") == "aggregator"]
383388
assert len(aggregator_spans) == 1
384389

385390
aggregator_span = aggregator_spans[0]
@@ -388,12 +393,8 @@ async def test_end_to_end_workflow_tracing(span_exporter: InMemorySpanExporter)
388393
assert aggregator_span.links is not None
389394

390395
# Find the sending spans from executor2 and executor3 by checking parent relationships
391-
executor2_processing_spans = [
392-
s for s in processing_spans if s.attributes and s.attributes.get("executor.id") == "executor2"
393-
]
394-
executor3_processing_spans = [
395-
s for s in processing_spans if s.attributes and s.attributes.get("executor.id") == "executor3"
396-
]
396+
executor2_processing_spans = [s for s in processing_spans if _span_attributes(s).get("executor.id") == "executor2"]
397+
executor3_processing_spans = [s for s in processing_spans if _span_attributes(s).get("executor.id") == "executor3"]
397398

398399
# Get span IDs from processing spans
399400
executor2_processing_span_ids = {format(s.context.span_id, "016x") for s in executor2_processing_spans if s.context}
@@ -582,7 +583,9 @@ def test_workflow_span_lifecycle_exceptions_are_not_failures(
582583
assert len(spans) == 1
583584
span = spans[0]
584585
assert span.status.status_code != trace.StatusCode.ERROR
585-
assert not span.attributes or OtelAttr.ERROR_TYPE not in span.attributes
586+
attributes = span.attributes
587+
if attributes is not None:
588+
assert OtelAttr.ERROR_TYPE not in attributes
586589
assert all(event.name != "exception" for event in span.events)
587590

588591

‎python/packages/devui/agent_framework_devui/ui/assets/index.css‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)