Repository navigation
Fix skill call counts and source links in the AI Model tab - #76541
Merged
pierrejeambrun merged 6 commits intoNov 6, 2026
Merged
Conversation
Follow-up to the review of apache#76309. The skills section could show calls that never ran (denied or interrupted ones, or ones made by the task that seeded the message history), lose every count when the agent was entered with `async with agent:`, fail the task for a repository with no commits, break links for remotes on a custom port, hide itself when the sources held no skills, and keep its details out of reach of the keyboard.
pierrejeambrun
added a commit
to astronomer/airflow
that referenced
this pull request
Nov 5, 2026
pierrejeambrun
added a commit
to astronomer/airflow
that referenced
this pull request
Nov 5, 2026
pierrejeambrun
added a commit
to astronomer/airflow
that referenced
this pull request
Nov 5, 2026
pierrejeambrun
added a commit
to astronomer/airflow
that referenced
this pull request
Nov 5, 2026
pierrejeambrun
added a commit
to astronomer/airflow
that referenced
this pull request
Nov 5, 2026
pierrejeambrun
added a commit
to astronomer/airflow
that referenced
this pull request
Nov 5, 2026
pierrejeambrun
added a commit
to astronomer/airflow
that referenced
this pull request
Nov 5, 2026
pierrejeambrun
added a commit
to astronomer/airflow
that referenced
this pull request
Nov 5, 2026
pierrejeambrun
added a commit
to astronomer/airflow
that referenced
this pull request
Nov 5, 2026
1 task done
pierrejeambrun
marked this pull request as ready for review
November 5, 2026 13:43
pierrejeambrun
requested review from
Lee-W,
ashb,
gopidesupavan and
kaxil
as code owners
November 5, 2026 13:43
kaxil
reviewed
Nov 5, 2026
The history-length boundary lost a skill call approved after a pause, since its call sits in the resumed run's history while its return is in the run itself; it also shifted when a history processor trimmed the transcript. Two prefixed toolsets with the same skill name each counted the same calls, so adding their publishes doubled them.
pydantic-ai's DynamicToolset, which AgentOperator also wraps a toolset factory in, never calls for_run on the toolset it builds, so the run id set there left such a toolset unable to publish; get_tools sees every run. A run that made no call to a skill no longer adds an empty entry, so the XCom does not grow with every resume.
kaxil
reviewed
Nov 5, 2026
kaxil
approved these changes
Nov 5, 2026
bbovenzi
approved these changes
Nov 5, 2026
bbovenzi
enabled auto-merge (squash)
November 5, 2026 18:25
A toolset function is wrapped in DynamicToolset, which calls it again on each model step by default, so the repository is cloned and the skills XCom pushed once per step rather than once per run.
pierrejeambrun
disabled auto-merge
November 6, 2026 10:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #76309, addressing the review comments that landed after it merged. Each one made the Skills section of the AI Model tab show something other than what the run did, which defeats its purpose of tracing an agent's behaviour back to the skills it used.
run_skill_scriptthe reviewer denied, or one interrupted by a crash and replayed on a durable retry, showed up as a call. Only tool returns withoutcome == "success"count now.async with agent:erased the counts. The agent enters the toolset instance itself as well as the copyfor_runhands the run; the original never sees a run, exited last and overwrote the counts withcalls: {}. Only an instance that served a run publishes now. That is decided inget_toolsrather thanfor_run, because pydantic-ai'sDynamicToolset(whatAgentOperatorwraps a toolset factory in) never callsfor_runon the toolset it builds.message_historybrought another task's calls. The counts covered the whole conversation, so a skill an earlier task loaded showed as loaded here, next to this task's clone commit. A call now counts only when its return is in a message stamped with this agent run'srun_id; calls are still matched across the whole transcript, so a skill call approved after a pause (made in the paused run, returned in the resumed one) counts once. The counts of each run that made calls are kept undercalls_by_run, andcallstotals them: a second toolset of the same run replaces its run's entry rather than adding to it, and an earlier run of the try (before an approval pause or a review regeneration) keeps its own.repo.head.commitraises on a repository with no commits, and the error was reported as a failed clone. The commit isNonethere and the section says no skills were found.ssh://without a user.https://andssh://remotes are parsed withnew URL()(an HTTPS port is kept, an SSH port is dropped since the web UI is not on it); the regex only handlesgit@host:path.aria-label, likeStatBox's info button.A run resumed from an approval pause, or a review regeneration, clones the repository again, so the entry shows the commit of the latest run; the docs say so.
End-to-end (abm, real model)
A Dag with one task per scenario, run on
mainand on this branch:mainasync with agent:around a run that loadssql-style-guidecalls: {}load_skill: 1load_skillitself needs approval; reviewer approvesload_skill: 1load_skill: 1toolsets=[lambda ctx: AgentSkillsToolset(...)]load_skill: 1load_skill: 1row-counter, reviewer rejectsrun_skill_scriptload_skill: 1, run_skill_script: 1load_skill: 1sql-style-guide, loads nothingload_skill: 1calls: {}GitSkillson an empty repositoryFailed to clone ...: Reference at 'refs/heads/master' does not existThe existing skills Dag (approval pause, durable retry, full replay) still shows
load_skill: 1for each task.Screenshots
mainhttps://gitlab.corp.com:8443/...andssh://gitlab.com:2222/...(the port link 404s onmainand thessh://one has none)mainskips the badge)Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5.5) following the guidelines