GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — fix(tracing): fail open temporal span activities by danielmillerp · Pull Request #437 · scaleapi/scale-agentex-python Conversation
|
| Filename | Overview |
|---|---|
| src/agentex/lib/adk/_modules/tracing.py | Adds fail-open exception handling for Temporal activity errors in start_span and end_span, with cancellation re-propagation and a bounded dropped-metric counter. |
| src/agentex/lib/sdk/state_machine/state_machine.py | Fixes reset_to_initial_state to guard span usage with span is not None, matching the existing pattern in step(); no logic changes beyond the null guard. |
| tests/lib/adk/test_tracing_module.py | Adds six new tests covering start/end fail-open, context-manager short-circuit, unexpected-error propagation, and cancellation propagation for both start and end paths. |
| tests/lib/test_state_machine.py | New regression test confirming reset_to_initial_state completes successfully and skips end_span when start_span returns None. |
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[start_span / end_span called] --> B{in_temporal_workflow?}
B -- No --> C[Call _tracing_service directly\nraises on error]
B -- Yes --> D[execute_activity via ActivityHelpers]
D -- Success --> E[Return Span]
D -- ActivityError / TemporalTimeoutError --> F{is_cancelled_exception?}
F -- Yes --> G[Re-raise — workflow cancellation\nmust propagate]
F -- No --> H[workflow.logger.warning + metric]
H --> I{start_span or end_span?}
I -- start_span --> J[Return None\nfail open]
I -- end_span --> K[Return original span\nfail open]
J --> L[Callers guard span is not None\nbefore mutating or calling end_span]
K --> M[Caller receives original span\nworkflow continues]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[start_span / end_span called] --> B{in_temporal_workflow?}
B -- No --> C[Call _tracing_service directly\nraises on error]
B -- Yes --> D[execute_activity via ActivityHelpers]
D -- Success --> E[Return Span]
D -- ActivityError / TemporalTimeoutError --> F{is_cancelled_exception?}
F -- Yes --> G[Re-raise — workflow cancellation\nmust propagate]
F -- No --> H[workflow.logger.warning + metric]
H --> I{start_span or end_span?}
I -- start_span --> J[Return None\nfail open]
I -- end_span --> K[Return original span\nfail open]
J --> L[Callers guard span is not None\nbefore mutating or calling end_span]
K --> M[Caller receives original span\nworkflow continues]
Reviews (2): Last reviewed commit: "fix(tracing): fail open temporal span ac..." | Re-trigger Greptile
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
fe7a153 to
fa5d4a9
Compare
|
Addressed the Greptile nullable-span finding in fa5d4a9. The issue was that adk.tracing.start_span(...) can now fail open and return None, but StateMachine.reset_to_initial_state() was still mutating span.output unconditionally. Updated reset to mirror step(): initialize span = None and only set output / call end_span when a span was actually created. Added regression coverage in tests/lib/test_state_machine.py for the reset path where start_span returns None. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
fa5d4a9 to
c88b9eb
Compare
c88b9eb to
e90a03e
Compare
|
Added the span-drop metric nit in e90a03e. On Temporal tracing activity fail-open, we now emit replay-safe workflow metrics via workflow.metric_meter(): agentex.tracing.temporal_span_activity.dropped with event_type=start or event_type=end. Cancellation still propagates and is not counted as a dropped span. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.