Skip to content

Skip bundle-backed code functions + surface skip detail location#22

Merged
Doug Guthrie (dpguthrie) merged 4 commits into
mainfrom
feat/skip-bundle-code-functions
Jun 8, 2026
Merged

Skip bundle-backed code functions + surface skip detail location#22
Doug Guthrie (dpguthrie) merged 4 commits into
mainfrom
feat/skip-bundle-code-functions

Conversation

@dpguthrie

Copy link
Copy Markdown
Collaborator

Problem

Code-based scorers (and any bundled code function) migrate "successfully" but land broken. When you push a code function, the build pipeline compiles a bundle and uploads it to object storage; the function payload only references it (bundle_id + location + a truncated preview). The migration copies that reference verbatim, so in the destination the bundle_id points at the source org's storage and the function can't be invoked.

Can we just copy the bundle? No. The compiled bundle is an output of the push/eval build pipeline; there's no API to download a built bundle and re-upload it as a new bundle in the destination org, and the function object doesn't contain the code (only a preview). So bundle-backed code functions genuinely can't be recreated by the tool.

What this does

Skip only the un-migratable ones. Code functions come in two flavors (per the functions API):

  • inline (function_data.data.type == "inline") — carries its full code + runtime_context; the runtime executes it directly. Migrates fine; kept.
  • bundle/sandbox — references a build artifact that isn't retrievable. Skipped.

FunctionMigrator now detects function_data.type == "code" with data.type != "inline" and skips it, recorded as MigrationResult(skipped=True, skip_reason="code_bundle_not_migratable") so it shows in the skip summary (not as a failure) and logs each skipped function's name/slug so you know what to re-push manually. Inline code functions and all other types are unaffected.

This applies to any bundled code function (scorers, tools, tasks) — the bundle problem is the same regardless of function_type.

Tests

  • _is_code_bundle_function detection: bundle ✅ skipped, inline ✅ kept, prompt/global/sandbox/missing-data covered.
  • migrate_batch: a mix of [bundle, inline, prompt] → bundle skipped with the reason and never sent to the create endpoint; inline + prompt migrate normally.
  • Full unit suite: 301 passing.

🤖 Generated with Claude Code

Doug Guthrie (dpguthrie) and others added 2 commits June 8, 2026 15:29
A code function (function_data.type == "code") can be backed by either inline
source (function_data.data.type == "inline") or a compiled bundle/sandbox
artifact. The inline variant carries its full code and migrates fine, but the
bundle variant only references an artifact produced by the push/eval build
pipeline — that artifact isn't exposed by the API and can't be recreated in
the destination, so migrating it yields a function with a dangling bundle_id
that can't be invoked.

FunctionMigrator now detects bundle-backed code functions and skips them,
recording a MigrationResult(skipped=True, skip_reason="code_bundle_not_migratable")
so they appear in the skip summary (not as failures) and logging each one's
name/slug so it can be re-pushed to the destination manually. Inline code
functions and all other function types are unaffected.

Adds tests for the detection and the migrate_batch skip/keep behavior.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Failures are printed inline in the console summary, but skips were only shown
as counts — so users couldn't tell *what* was skipped without knowing to open
migration_report.json. Rather than duplicate the (potentially large) per-item
list in the console, print a pointer when anything was skipped: the count plus
the report path and the JSON location (detailed_breakdown.skipped) where each
skipped item is recorded with its name and skip_reason.

Applies to all skips (already-migrated, unresolved-dependency, and the new
code_bundle_not_migratable). Adds tests for the pointer shown/hidden cases.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dpguthrie Doug Guthrie (dpguthrie) changed the title Skip bundle-backed code functions during migration Skip bundle-backed code functions + surface skip detail location Jun 8, 2026
@dpguthrie

Copy link
Copy Markdown
Collaborator Author

Added a second commit: the console summary now points to where per-item skip detail lives when anything is skipped.

Failures already print inline in the summary, but skips only showed as counts — users couldn't tell what was skipped without knowing to open migration_report.json. Rather than duplicate the (potentially large) list in the console, it now prints the count plus the report path and JSON location:

2 resource(s) skipped — per-item detail (name + reason) in:
  /…/checkpoints/migration_report.json  →  "detailed_breakdown.skipped"

Applies to all skip reasons (already-migrated, unresolved-dependency, and the new code_bundle_not_migratable), not just functions. Tests included; 303 unit tests green.

Doug Guthrie (dpguthrie) and others added 2 commits June 8, 2026 15:54
Add an explicit README callout (Resource Types) explaining that code
functions backed by a compiled bundle — e.g. code-based scorers/tools/tasks
pushed via `braintrust push` or an eval — cannot be migrated (the API only
exposes a bundle reference, not the code, and there's no re-upload path), so
they are skipped and recorded in migration_report.json with
skip_reason="code_bundle_not_migratable". Users should re-push them manually.
Inline code functions and all other function types migrate normally.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Print the full per-item report location regardless of whether anything was
skipped — it's general drill-in info (migrated / skipped / failed detail), not
specific to skips. The Skipped count is already shown in the summary table, so
the pointer no longer repeats it; it just points to migration_report.json.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dpguthrie Doug Guthrie (dpguthrie) merged commit efa7f8c into main Jun 8, 2026
1 check passed
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