Skip to content

test(observability): document telegram-rag-agent-invoke/-stream spans (fix red contract gate)#2298

Open
yastman wants to merge 1 commit into
devfrom
fix/span-inventory-drift-agent-stream
Open

test(observability): document telegram-rag-agent-invoke/-stream spans (fix red contract gate)#2298
yastman wants to merge 1 commit into
devfrom
fix/span-inventory-drift-agent-stream

Conversation

@yastman
Copy link
Copy Markdown
Owner

@yastman yastman commented May 29, 2026

This pull request was created by @kiro-agent on behalf of @yastman 👻

Comment with /kiro fix to address specific feedback or /kiro all to address everything.
Learn about Kiro autonomous agent


Summary

Fixes 2 contract-suite failures present on clean devmake test / the contract gate is currently red for everyone.

Root cause

Supervisor agent-loop recovery wrappers were added to telegram_bot/bot.py:

  • telegram-rag-agent-stream (_astream_supervisor_with_recovery)
  • telegram-rag-agent-invoke (_ainvoke_supervisor_with_recovery)

Both are @observe(capture_input=False, capture_output=False, as_type="agent") but were never registered in tests/observability/trace_contract.yaml, so two contracts failed:

  • test_span_coverage_contract::test_all_observed_spans_accounted_for — every capture_input=False span must be in sensitive_spans.
  • test_trace_families_contract::test_no_undocumented_observe_spans — every @observe name must appear in the spans: inventory.

(Confirmed pre-existing: reproduced on clean dev with my unrelated work stashed.)

Fix

Register both spans in trace_contract.yaml (docs/inventory only, no production code changed):

  • sensitive_spans: — added next to telegram-rag-supervisor (capture disabled).
  • spans.supervisor_recovery: — new group so the reverse undocumented-span check passes.

Testing

  • pytest tests/contract/test_span_coverage_contract.py tests/contract/test_trace_families_contract.py → 210 passed (was 2 failed).
  • pytest tests/contract/1422 passed, 2 skipped, 3 xfailed (full gate green again).
  • YAML validated; existing groups (history_graph, voice_tools) intact.

verify:repo-only — no Docker/runtime validation required.

… (fixes contract suite drift)

The contract suite failed on clean dev (2 failures, reproduced with a stashed
worktree) after supervisor agent-loop recovery wrappers were added to
telegram_bot/bot.py:
  - telegram-rag-agent-stream  (_astream_supervisor_with_recovery)
  - telegram-rag-agent-invoke  (_ainvoke_supervisor_with_recovery)
both @observe(capture_input=False, capture_output=False, as_type='agent') but
not registered in tests/observability/trace_contract.yaml.

Two contracts were red:
  - test_span_coverage_contract::test_all_observed_spans_accounted_for
    (capture_input=False spans must be in sensitive_spans)
  - test_trace_families_contract::test_no_undocumented_observe_spans
    (every @observe name must be in the spans: inventory)

Fix: register both spans in trace_contract.yaml —
  - sensitive_spans: (capture disabled), next to telegram-rag-supervisor;
  - spans.supervisor_recovery: new group so the reverse undocumented-span
    check passes.
No production code changed.

Verified: full tests/contract/ now green (1422 passed, was 2 failed);
YAML groups intact (history_graph/voice_tools unchanged).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants