Skip to content

fix: surface resolved model ids for dynamic models in execution logs … - #942

Merged
omeraplak merged 1 commit into
mainfrom
fix/dynamic-model-name
Jan 15, 2026
Merged

fix: surface resolved model ids for dynamic models in execution logs …#942
omeraplak merged 1 commit into
mainfrom
fix/dynamic-model-name

Conversation

@omeraplak

@omeraplak omeraplak commented Jan 15, 2026

Copy link
Copy Markdown
Member

…and spans

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

What is the new behavior?

fixes (issue)

Notes for reviewers


Summary by cubic

Ensure execution logs and tracing spans show the resolved model ID for dynamic models instead of the generic "dynamic", improving observability and error context.

  • Bug Fixes
    • Pass the resolved model to getModelName to surface modelId in logs and spans.
    • getModelName now accepts a model or string and returns model.modelId (falls back to "unknown").
    • Error logs use the computed modelName to avoid the "dynamic" placeholder.

Written for commit 2035c5e. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • Improved execution logs and spans to display resolved model IDs for dynamic models, enhancing observability and debugging visibility.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot

changeset-bot Bot commented Jan 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2035c5e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@voltagent/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Jan 15, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

A changelog entry documents a patch release that improves observability by surfacing resolved model IDs for dynamic models in execution logs and spans. The Agent class's getModelName method now accepts an optional model parameter, and call sites are updated to pass the resolved model for more accurate logging.

Changes

Cohort / File(s) Summary
Changelog Updates
\.changeset/bright-singers-fold\.md
Added patch release notes documenting fix to surface resolved model IDs for dynamic models in execution logs and spans
Agent Observability
packages/core/src/agent/agent\.ts
Updated getModelName(model?) method signature to accept optional LanguageModel | string parameter; updated multiple call sites in generateText and streamText methods to pass resolved model for improved observability and more accurate model ID logging

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A model's true name, now shining bright,
Dynamic or static, we log it right,
Through spans and logs, the IDs flow,
Better tracing paths for all to know! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Description check ⚠️ Warning The description is largely incomplete with required sections left blank (current/new behavior, linked issues, test/doc/changeset confirmation), though an auto-generated summary provides context about the fix. Complete the PR checklist by checking boxes for changesets (already added) and confirming tests/docs. Fill in 'What is the current behavior?' and 'What is the new behavior?' sections with concrete details.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: surfacing resolved model IDs for dynamic models in execution logs and spans, matching the changeset entry and code modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ab39d68 and 2035c5e.

📒 Files selected for processing (2)
  • .changeset/bright-singers-fold.md
  • packages/core/src/agent/agent.ts
🧰 Additional context used
📓 Path-based instructions (1)
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: Maintain type safety in TypeScript-first codebase
Never use JSON.stringify; use the safeStringify function instead, imported from @voltagent/internal

Files:

  • packages/core/src/agent/agent.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Test cli
  • GitHub Check: Test libsql
  • GitHub Check: Test core
  • GitHub Check: Build (Node 22)
  • GitHub Check: Build (Node 24)
  • GitHub Check: Build (Node 20)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (8)
packages/core/src/agent/agent.ts (7)

558-564: LGTM! Resolved model correctly passed to getModelName.

The resolved model from prepareExecution is now passed to getModelName(model), ensuring the actual model ID (e.g., gpt-4o) is surfaced in logs and spans rather than "dynamic" for dynamic model configurations.


957-963: LGTM! Consistent with generateText pattern.

The streamText method now correctly passes the resolved model to getModelName(model) for accurate model identification in logs and spans.


1102-1106: LGTM! Error logging uses resolved model name.

The onError callback correctly uses the modelName variable captured from the closure (defined at line 963), ensuring error logs include the actual resolved model ID.


1680-1686: LGTM! Consistent pattern in generateObject.

The deprecated generateObject method now also correctly passes the resolved model to getModelName(model).


1915-1921: LGTM! Consistent pattern in streamObject.

The deprecated streamObject method follows the same pattern for resolving model names.


2009-2015: LGTM! Consistent error logging pattern.

The onError callback correctly uses the modelName variable captured from the closure.


4172-4189: LGTM! Backward-compatible enhancement to getModelName.

The updated method signature with the optional model parameter is:

  • Backward compatible: Existing callers without arguments continue to work
  • Type-safe: Handles both string and LanguageModel types appropriately
  • Consistent fallback: Returns "unknown" when modelId is absent, matching existing behavior

The implementation correctly prioritizes the passed model over the instance's this.model, enabling accurate logging for dynamic model configurations.

.changeset/bright-singers-fold.md (1)

1-5: LGTM! Changeset correctly describes the patch.

The changeset format is valid and the patch release type is appropriate for this observability improvement.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

@ghost

This comment has been minimized.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying voltagent with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2035c5e
Status: ✅  Deploy successful!
Preview URL: https://2bde1117.voltagent.pages.dev
Branch Preview URL: https://fix-dynamic-model-name.voltagent.pages.dev

View logs

@omeraplak
omeraplak merged commit c992dac into main Jan 15, 2026
23 checks passed
@omeraplak
omeraplak deleted the fix/dynamic-model-name branch January 15, 2026 04:43
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.

1 participant