Skip to content

fix: resolve cortex_skill dir with flags.PROJECT_DIR for dbt Fusion - #35

Merged
Matts52 merged 1 commit into
Matts52:mainfrom
mattsenicksigma:fix/cortex-skill-fusion-path
Sep 25, 2026
Merged

Matts52 merged 1 commit into
Matts52:mainfrom
mattsenicksigma:fix/cortex-skill-fusion-path

Conversation

@mattsenicksigma

Copy link
Copy Markdown
Contributor

Closes #32.

Problem

cortex_skill__resolve_skill_dir() (in macros/relations/cortex_skill/create.sql) returns a path built from model['original_file_path'], which is relative to the project root. dbt Core sets its process cwd to the project root when executing the PUT, so the relative path resolves fine there — but dbt Fusion does not, so the PUT fails with:

[Snowflake] 264006: file does not exist: [models/agents/agents_schema_skill/*]

Fix

Build an absolute path from flags.PROJECT_DIR ~ '/' ~ model['original_file_path'][:-4] instead. flags.PROJECT_DIR is populated in both dbt Core and dbt Fusion, whereas model['root_path'] resolves to an empty string under Fusion (per the issue report), so it isn't a viable alternative.

Also updated the doc comments in the same file that described the old relative-path behavior.

Test plan

  • Reviewed the change compiles the same PUT statement shape, just with an absolute local path prefix
  • Matches the fix the issue reporter said they tested locally and confirmed resolves the problem
  • Repo has no unit tests for this macro; the existing integration_tests CI (DuckDB compile of agent_*/example_mcp_* models) doesn't currently select the skill fixture, so this fix isn't independently re-verified by CI — flagging for the maintainer to confirm against a real Fusion run if desired

🤖 Generated with Claude Code

…loses Matts52#32)

dbt Fusion doesn't set the process cwd to the project root when executing
PUT statements, so the relative path from model['original_file_path'] fails
with "file does not exist" even though the directory is present.
flags.PROJECT_DIR is populated in both dbt Core and Fusion (unlike
model['root_path'], which resolves empty under Fusion), so build the
absolute path from that instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Matts52
Matts52 merged commit 3a8b661 into Matts52:main Sep 25, 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.

cortex_skill PUT fails on dbt Fusion: relative path not resolved

2 participants