Skip to content

Fix skill call counts and source links in the AI Model tab - #76541

Merged
pierrejeambrun merged 6 commits into
apache:mainfrom
astronomer:skills-tab-review-followups
Nov 6, 2026
Merged

pierrejeambrun merged 6 commits into
apache:mainfrom
astronomer:skills-tab-review-followups

Conversation

@pierrejeambrun

@pierrejeambrun pierrejeambrun commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

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.

  • Calls that never ran were counted. A run_skill_script the reviewer denied, or one interrupted by a crash and replayed on a durable retry, showed up as a call. Only tool returns with outcome == "success" count now.
  • async with agent: erased the counts. The agent enters the toolset instance itself as well as the copy for_run hands the run; the original never sees a run, exited last and overwrote the counts with calls: {}. Only an instance that served a run publishes now. That is decided in get_tools rather than for_run, because pydantic-ai's DynamicToolset (what AgentOperator wraps a toolset factory in) never calls for_run on the toolset it builds.
  • A seeded message_history brought 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's run_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 under calls_by_run, and calls totals 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.
  • An empty repository failed the task. repo.head.commit raises on a repository with no commits, and the error was reported as a failed clone. The commit is None there and the section says no skills were found.
  • Links broke for remotes on a custom port or ssh:// without a user. https:// and ssh:// remotes are parsed with new URL() (an HTTPS port is kept, an SSH port is dropped since the web UI is not on it); the regex only handles git@host:path.
  • An empty skills list hid the section, which looked the same as a run without the toolset. It now says "No skills found in the toolset's sources."
  • The badge tooltip was mouse-only. The badge is a focusable button with an aria-label, like StatBox's info button.
  • Docs mention the skills section in the offloaded-XCom caveat, and the tests kaxil pointed out now check the reverse location order and that the failed push was attempted.

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 main and on this branch:

Task main This PR
async with agent: around a run that loads sql-style-guide calls: {} load_skill: 1
load_skill itself needs approval; reviewer approves load_skill: 1 load_skill: 1
Toolset passed as a factory, toolsets=[lambda ctx: AgentSkillsToolset(...)] load_skill: 1 load_skill: 1
Load row-counter, reviewer rejects run_skill_script load_skill: 1, run_skill_script: 1 load_skill: 1
Seeded with the transcript of a task that loaded sql-style-guide, loads nothing load_skill: 1 calls: {}
GitSkills on an empty repository task fails: Failed to clone ...: Reference at 'refs/heads/master' does not exist succeeds, empty list

The existing skills Dag (approval pause, durable retry, full replay) still shows load_skill: 1 for each task.

Screenshots

main This PR
Sources with no skills
Remotes https://gitlab.corp.com:8443/... and ssh://gitlab.com:2222/... (the port link 404s on main and the ssh:// one has none)
Tabbing on from the Cost info button (main skips the badge)

Was generative AI tooling used to co-author this PR?
  • Yes — Claude Code (Opus 5.5)

Generated-by: Claude Code (Opus 5.5) following the guidelines

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
@pierrejeambrun
pierrejeambrun marked this pull request as ready for review November 5, 2026 13:43
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.
@bbovenzi
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
pierrejeambrun merged commit 92fa9b3 into apache:main Nov 6, 2026
85 checks passed
@pierrejeambrun
pierrejeambrun deleted the skills-tab-review-followups branch November 6, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants