Skip to content

Commit dd6f92f

Browse files
committed
fix: repair google adk py39 tests and misc runners
1 parent b81d018 commit dd6f92f

11 files changed

Lines changed: 81 additions & 35 deletions

File tree

.github/workflows/generate_workflows.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,9 @@
2525
batch_size=4,
2626
parallelism=4,
2727
)
28-
generate_misc_workflow(tox_ini_path, workflows_directory_path)
28+
generate_misc_workflow(
29+
tox_ini_path,
30+
workflows_directory_path,
31+
runner=arc_runner_label,
32+
)
2933
generate_contrib_workflow(workflows_directory_path)

.github/workflows/generate_workflows_lib/src/generate_workflows_lib/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,13 @@ def generate_contrib_workflow(
356356
def generate_misc_workflow(
357357
tox_ini_path: Path,
358358
workflow_directory_path: Path,
359+
runner="ubuntu-latest",
359360
) -> None:
360361
_generate_workflow(
361362
get_misc_job_datas(get_tox_envs(tox_ini_path)),
362363
"misc",
363364
workflow_directory_path,
365+
runner=runner,
364366
)
365367

366368

@@ -445,6 +447,7 @@ def generate_extension_misc_workflow(
445447
tox_ini_path: Path,
446448
workflow_directory_path: Path,
447449
additional_config_path: Path,
450+
runner="ubuntu-latest",
448451
) -> None:
449452
loongsuite_envs = get_loongsuite_tox_envs(additional_config_path)
450453
if not loongsuite_envs:
@@ -455,6 +458,7 @@ def generate_extension_misc_workflow(
455458
"loongsuite_misc",
456459
"loongsuite_misc",
457460
workflow_directory_path,
461+
runner=runner,
458462
)
459463

460464

.github/workflows/generate_workflows_lib/src/generate_workflows_lib/loongsuite_misc.yml.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
{{ job_data }}:
3838
name: LoongSuite {{ job_data }}
39-
runs-on: ubuntu-latest
39+
runs-on: {{ runner }}
4040
timeout-minutes: 30
4141
{%- if job_data == "generate-workflows" %}
4242
if: |

.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ name: Misc {{ file_number }}
55

66
on:
77
push:
8-
branches-ignore:
9-
- 'release/*'
10-
- 'otelbot/*'
8+
branches:
9+
- main
1110
pull_request:
1211

1312
permissions:
@@ -36,7 +35,7 @@ jobs:
3635

3736
{{ job_data }}:
3837
name: {{ job_data }}
39-
runs-on: ubuntu-latest
38+
runs-on: {{ "ubuntu-latest" if job_data == "docker-tests" else runner }}
4039
timeout-minutes: 30
4140
{%- if job_data == "generate-workflows" %}
4241
if: |

.github/workflows/generate_workflows_loongsuite.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,8 @@
2929
control_runner=arc_runner_label,
3030
)
3131
generate_extension_misc_workflow(
32-
tox_ini_path, workflows_directory_path, tox_loongsuite_ini_path
32+
tox_ini_path,
33+
workflows_directory_path,
34+
tox_loongsuite_ini_path,
35+
runner=arc_runner_label,
3336
)

.github/workflows/loongsuite_misc_0.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535

3636
check-license-header:
3737
name: LoongSuite check-license-header
38-
runs-on: ubuntu-latest
38+
runs-on: loongsuite-python-arc
3939
timeout-minutes: 30
4040
steps:
4141
- name: Checkout repo @ SHA - ${{ github.sha }}
@@ -54,7 +54,7 @@ jobs:
5454

5555
generate-loongsuite:
5656
name: LoongSuite generate-loongsuite
57-
runs-on: ubuntu-latest
57+
runs-on: loongsuite-python-arc
5858
timeout-minutes: 30
5959
steps:
6060
- name: Checkout repo @ SHA - ${{ github.sha }}

.github/workflows/misc_0.yml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ name: Misc 0
55

66
on:
77
push:
8-
branches-ignore:
9-
- 'release/*'
10-
- 'otelbot/*'
8+
branches:
9+
- main
1110
pull_request:
1211

1312
permissions:
@@ -35,7 +34,7 @@ jobs:
3534

3635
spellcheck:
3736
name: spellcheck
38-
runs-on: ubuntu-latest
37+
runs-on: loongsuite-python-arc
3938
timeout-minutes: 30
4039
steps:
4140
- name: Checkout repo @ SHA - ${{ github.sha }}
@@ -73,7 +72,7 @@ jobs:
7372

7473
docs:
7574
name: docs
76-
runs-on: ubuntu-latest
75+
runs-on: loongsuite-python-arc
7776
timeout-minutes: 30
7877
if: |
7978
github.event.pull_request.user.login != 'otelbot[bot]' && github.event_name == 'pull_request'
@@ -94,7 +93,7 @@ jobs:
9493

9594
generate:
9695
name: generate
97-
runs-on: ubuntu-latest
96+
runs-on: loongsuite-python-arc
9897
timeout-minutes: 30
9998
steps:
10099
- name: Checkout repo @ SHA - ${{ github.sha }}
@@ -116,7 +115,7 @@ jobs:
116115

117116
generate-workflows:
118117
name: generate-workflows
119-
runs-on: ubuntu-latest
118+
runs-on: loongsuite-python-arc
120119
timeout-minutes: 30
121120
if: |
122121
!contains(github.event.pull_request.labels.*.name, 'Skip generate-workflows')
@@ -141,7 +140,7 @@ jobs:
141140

142141
shellcheck:
143142
name: shellcheck
144-
runs-on: ubuntu-latest
143+
runs-on: loongsuite-python-arc
145144
timeout-minutes: 30
146145
steps:
147146
- name: Checkout repo @ SHA - ${{ github.sha }}
@@ -160,7 +159,7 @@ jobs:
160159

161160
precommit:
162161
name: precommit
163-
runs-on: ubuntu-latest
162+
runs-on: loongsuite-python-arc
164163
timeout-minutes: 30
165164
steps:
166165
- name: Checkout repo @ SHA - ${{ github.sha }}
@@ -179,7 +178,7 @@ jobs:
179178

180179
typecheck:
181180
name: typecheck
182-
runs-on: ubuntu-latest
181+
runs-on: loongsuite-python-arc
183182
timeout-minutes: 30
184183
steps:
185184
- name: Checkout repo @ SHA - ${{ github.sha }}

instrumentation-loongsuite/loongsuite-instrumentation-agno/src/opentelemetry/instrumentation/agno/utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import json
1818
from dataclasses import asdict, is_dataclass
19-
from typing import Any, Mapping, Sequence
19+
from typing import Any, Dict, Mapping, Optional, Sequence
2020

2121
from opentelemetry.util.genai.extended_semconv.gen_ai_extended_attributes import (
2222
GEN_AI_SESSION_ID,
@@ -87,7 +87,7 @@ def _to_dict(value: Any) -> dict[str, Any] | None:
8787
return None
8888

8989

90-
def _mapping_from_any(value: Any) -> dict[str, Any]:
90+
def _mapping_from_any(value: Any) -> Dict[str, Any]:
9191
data = _to_dict(value)
9292
if data is not None:
9393
return data
@@ -100,7 +100,7 @@ def _mapping_from_any(value: Any) -> dict[str, Any]:
100100
return {}
101101

102102

103-
def _first_text(*values: Any) -> str | None:
103+
def _first_text(*values: Any) -> Optional[str]:
104104
for value in values:
105105
if value is None:
106106
continue
@@ -110,7 +110,7 @@ def _first_text(*values: Any) -> str | None:
110110
return None
111111

112112

113-
def _extract_skill_metadata(value: Any) -> dict[str, Any]:
113+
def _extract_skill_metadata(value: Any) -> Dict[str, Any]:
114114
data = _mapping_from_any(value)
115115
if not data:
116116
return {}

instrumentation-loongsuite/loongsuite-instrumentation-agno/tests/test_agno.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,36 @@ def test_agno_skill_tool_invocation_captures_skill_attributes():
254254
assert invocation.skill_version == "1.2.3"
255255

256256

257+
def test_agno_non_skill_tool_invocation_ignores_skill_like_payload():
258+
fn = Function.from_callable(lambda skill_name: f"loaded {skill_name}")
259+
fn.name = "get_weather"
260+
function_call = FunctionCall(
261+
function=fn,
262+
arguments={"skill_name": "code-review"},
263+
call_id="call_regular_1",
264+
)
265+
266+
invocation = create_tool_invocation(function_call)
267+
update_tool_invocation_from_response(
268+
invocation,
269+
SimpleNamespace(
270+
result={
271+
"skill_name": "code-review",
272+
"frontmatter": {
273+
"description": "Review code for quality and security.",
274+
"metadata": {"version": "1.2.3"},
275+
},
276+
}
277+
),
278+
)
279+
280+
assert invocation.tool_name == "get_weather"
281+
assert invocation.skill_name is None
282+
assert invocation.skill_id is None
283+
assert invocation.skill_description is None
284+
assert invocation.skill_version is None
285+
286+
257287
def test_streaming_agent_finishes_agent_and_model_spans(
258288
span_exporter: InMemorySpanExporter,
259289
):

instrumentation-loongsuite/loongsuite-instrumentation-google-adk/src/opentelemetry/instrumentation/google_adk/internal/_plugin.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import timeit
2727
from contextvars import ContextVar, Token
2828
from dataclasses import asdict, is_dataclass
29-
from typing import Any, Dict, List, Mapping, Optional
29+
from typing import Any, Dict, List, Mapping, Optional, Tuple
3030

3131
from google.adk.agents.base_agent import BaseAgent
3232
from google.adk.agents.callback_context import CallbackContext
@@ -62,7 +62,7 @@
6262
_SKILL_LOAD_TOOL_NAMES = {"load_skill", "load_skill_resource"}
6363

6464

65-
def _mapping_from_any(value: Any) -> dict[str, Any]:
65+
def _mapping_from_any(value: Any) -> Dict[str, Any]:
6666
if value is None:
6767
return {}
6868
if isinstance(value, Mapping):
@@ -88,7 +88,7 @@ def _mapping_from_any(value: Any) -> dict[str, Any]:
8888
return {}
8989

9090

91-
def _first_text(*values: Any) -> str | None:
91+
def _first_text(*values: Any) -> Optional[str]:
9292
for value in values:
9393
if value is None:
9494
continue
@@ -98,7 +98,7 @@ def _first_text(*values: Any) -> str | None:
9898
return None
9999

100100

101-
def _extract_skill_metadata(value: Any) -> dict[str, Any]:
101+
def _extract_skill_metadata(value: Any) -> Dict[str, Any]:
102102
data = _mapping_from_any(value)
103103
if not data:
104104
return {}
@@ -602,7 +602,7 @@ async def before_tool_callback(
602602
self,
603603
*,
604604
tool: BaseTool,
605-
tool_args: dict[str, Any],
605+
tool_args: Dict[str, Any],
606606
tool_context: ToolContext,
607607
) -> None:
608608
"""
@@ -646,9 +646,9 @@ async def after_tool_callback(
646646
self,
647647
*,
648648
tool: BaseTool,
649-
tool_args: dict[str, Any],
649+
tool_args: Dict[str, Any],
650650
tool_context: ToolContext,
651-
result: dict,
651+
result: Dict[str, Any],
652652
) -> None:
653653
"""
654654
End Tool execution - finish execute_tool span.
@@ -674,7 +674,7 @@ async def on_tool_error_callback(
674674
self,
675675
*,
676676
tool: BaseTool,
677-
tool_args: dict[str, Any],
677+
tool_args: Dict[str, Any],
678678
tool_context: ToolContext,
679679
error: Exception,
680680
) -> Optional[dict]:
@@ -832,7 +832,7 @@ def _llm_key(
832832
def _tool_key(
833833
self,
834834
tool: BaseTool,
835-
tool_args: dict[str, Any],
835+
tool_args: Dict[str, Any],
836836
tool_context: ToolContext,
837837
) -> str:
838838
invocation_context = getattr(tool_context, "_invocation_context", None)
@@ -848,7 +848,7 @@ def _find_active_llm_invocation(
848848
self,
849849
callback_context: CallbackContext,
850850
llm_request: Optional[LlmRequest] = None,
851-
) -> tuple[Optional[str], Optional[LLMInvocation]]:
851+
) -> Tuple[Optional[str], Optional[LLMInvocation]]:
852852
context_request_key = _ACTIVE_LLM_REQUEST_KEY.get()
853853
if context_request_key:
854854
invocation = self._active_llm_invocations.get(context_request_key)
@@ -915,7 +915,7 @@ def _is_mock_placeholder(value: Any) -> bool:
915915

916916
@staticmethod
917917
def _mock_has_explicit_attrs(
918-
value: Any, attr_names: tuple[str, ...]
918+
value: Any, attr_names: Tuple[str, ...]
919919
) -> bool:
920920
value_dict = getattr(value, "__dict__", {})
921921
return any(attr_name in value_dict for attr_name in attr_names)

0 commit comments

Comments
 (0)