Skip to content

fix: tracing count, TS evaluator template, revision data validation, …#4336

Draft
Charan-place wants to merge 5 commits into
Agenta-AI:release/v0.99.8from
Charan-place:fix/batch-issues-4318-3807-3771
Draft

fix: tracing count, TS evaluator template, revision data validation, …#4336
Charan-place wants to merge 5 commits into
Agenta-AI:release/v0.99.8from
Charan-place:fix/batch-issues-4318-3807-3771

Conversation

@Charan-place
Copy link
Copy Markdown
Contributor

Summary

Fixes four critical issues across tracing, TypeScript evaluation, revision validation, and exception handling:

Changed Files

File Changes Issue
api/oss/src/apis/fastapi/tracing/router.py Count logic on line 238 #4318
sdks/python/agenta/sdk/engines/running/templates.py TS template v0 & v1 (type safety) #3807
sdks/python/agenta/sdk/models/workflows.py Added ConfigDict(extra='forbid') #4315
api/oss/src/core/queries/dtos.py Added ConfigDict(extra='forbid') #4315
api/oss/src/core/testsets/dtos.py Added ConfigDict(extra='forbid') #4315
api/oss/src/core/shared/exceptions.py str null check #3771

Technical Details

#4318 - Tracing Ingest Count

Before: count=len(links) + len(dropped) included rejected spans
After: count=len(links) reflects only accepted/published spans
Impact: Accurate span count metrics in observability UI

#3807 - TypeScript Evaluator Template

Before: Implicit type coercion caused TS2322 type errors
After: Explicit let result: number | null = evaluate(...)
Impact: Fixes Daytona runtime parse failures on TypeScript evaluation

#4315 - Revision Data Validation

Before: Unknown fields silently dropped from commit payloads
After: All RevisionData classes use model_config = ConfigDict(extra="forbid")
Impact: Early detection of stale/malformed payloads (422 vs silent corruption)

#3771 - EntityCreationConflict Defensive

Before: for key, value in self.conflict.items() crashed if conflict was None
After: Guarded with if self.conflict: check
Impact: Safe error rendering in UI even with incomplete context

Test Plan

  1. Tracing (Tracing ingest: OTelLinksResponse.count over-counts and writes a removed dropped field #4318) — Run workflow generating spans; verify OTel count matches accepted spans only
  2. TypeScript Evaluator (Evaluator 500 when running Exact Match (TypeScript) preset #3807) — Execute TS evaluator; verify numeric result (no 500 error)
  3. Revision Data Validation (Revisions commit endpoints silently discard unknown fields in data #4315) — Submit commit with unknown field; verify 422 error
  4. EntityCreationConflict (Creating app with existing slug returns 500 #3771) — Trigger duplicate creation; verify clean error rendering

Backward Compatibility

jp-agenta and others added 3 commits May 14, 2026 18:32
…conflict safety

Closes Agenta-AI#4318 — tracing ingest count no longer includes dropped spans
Closes Agenta-AI#3807 — TypeScript evaluator templates use explicit number | null type
Closes Agenta-AI#4315 — revision data models use extra=forbid to reject unknown fields
Closes Agenta-AI#3771 (defensive) — EntityCreationConflict.__str__ guards against None conflict

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 14, 2026

@Charan-place is attempting to deploy a commit to the agenta projects Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. Bug Report Something isn't working python Pull requests that update Python code labels May 14, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9cb19130-7cf8-4bda-afb1-02dce829e01a

📥 Commits

Reviewing files that changed from the base of the PR and between e2d3932 and 3b765ba.

📒 Files selected for processing (1)
  • api/oss/src/apis/fastapi/tracing/router.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/oss/src/apis/fastapi/tracing/router.py

📝 Walkthrough

Summary by CodeRabbit

Bug Fixes

  • Corrected span ingestion metrics to report only successfully processed spans
  • Strengthened model/request validation to reject unexpected or extra fields across multiple API DTOs
  • Improved entity-creation error messages to omit empty/conflicting details when none exist
  • Fixed evaluator result handling to correctly treat non-finite/null values in runtime evaluations

Walkthrough

Applies validation and robustness fixes: Pydantic DTOs now forbid extra fields, exception stringification guards against None conflicts, tracing ingest count returns only ingested links, and evaluator TypeScript templates normalize numeric results more safely.

Changes

Validation and Robustness Improvements

Layer / File(s) Summary
DTO extra field validation enforcement
api/oss/src/core/queries/dtos.py, api/oss/src/core/testsets/dtos.py, sdks/python/agenta/sdk/models/workflows.py
QueryRevisionData, TestsetRevisionData, and WorkflowRevisionData now include Pydantic model_config = ConfigDict(extra="forbid") to reject unrecognized input fields during validation.
Exception handling robustness
api/oss/src/core/shared/exceptions.py
EntityCreationConflict.str wraps conflict key/value iteration in a presence check, preventing iteration errors when conflict is None.
Tracing response accuracy
api/oss/src/apis/fastapi/tracing/router.py
OTelLinksResponse count changed from len(links) + len(dropped) to len(links) so the count reflects only successfully ingested links; dropped is still returned separately.
Evaluator result type safety
sdks/python/agenta/sdk/engines/running/templates.py
v0 and v1 TypeScript evaluator templates updated to declare result as `number

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 60.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main fixes: tracing count, TypeScript evaluator template, and revision data validation across multiple files.
Description check ✅ Passed The description comprehensively details all four fixes with issue numbers, files affected, technical details, test plan, and backward compatibility notes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@junaway junaway changed the base branch from main to release/v0.99.8 May 15, 2026 08:06
@jp-agenta jp-agenta marked this pull request as draft May 15, 2026 08:07
@jp-agenta jp-agenta marked this pull request as ready for review May 15, 2026 08:08
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 15, 2026
@jp-agenta
Copy link
Copy Markdown
Member

Hi @Charan-place,

Thank you for this contribution.
Let's wait for checks to pass before we can merge. 🚀

p.s. Next time, please leave a comment on the issues you tackle to indicate that you are taking it on.

@jp-agenta
Copy link
Copy Markdown
Member

Also @Charan-place,

Please add the demo videos.

@Charan-place
Copy link
Copy Markdown
Contributor Author

Charan-place commented May 15, 2026 via email

@jp-agenta jp-agenta marked this pull request as draft May 15, 2026 11:07
@Charan-place
Copy link
Copy Markdown
Contributor Author

Hello Team,
It seems the PR is Draft. Do you want me to add anything ? Or is it the issue in the PR merge Agenta Team?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Report Something isn't working lgtm This PR has been approved by a maintainer python Pull requests that update Python code size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants