Skip to content

Start without AYON settings; only ayon:// URIs stay unresolved - #112

Merged
antirotor merged 2 commits into
ynput:enhancement/featuriing-memcachedfrom
SunriseProductions:up/no-ayon-env-soft-init
Nov 5, 2026
Merged

antirotor merged 2 commits into
ynput:enhancement/featuriing-memcachedfrom
SunriseProductions:up/no-ayon-env-soft-init

Conversation

@DexterSchenk

Copy link
Copy Markdown
Contributor

Changelog Description

If AYON_API_KEY, AYON_SERVER_URL or AYON_PROJECT_NAME is unset, the resolver no longer makes every USD operation in the process fail. It logs one warning and carries on: plain paths resolve normally, and ayon:// URIs stay unresolved.

Additional review information

getAyonApiFromEnv() threw out of the ResolverContextCache constructor. Because this is the primary resolver, any stage operation then raised RuntimeError, even Usd.Stage.CreateInMemory() or opening a local .usda. We hit it with a standalone OpenUSD build in a shell where the AYON variables weren't set.

  • The constructor catches the failure, logs a single TF_WARN naming the variables, and leaves m_ayon empty.
  • getAsset() returns an ayon:// URI unresolved when there's no connection, the same as any failed lookup. It doesn't fall into the plain-path branch, which would anchor it to the working directory. batchWarm() skips the AYON request.
  • getAyonApiFromEnv() checks the variables before printing them. Streaming a null char* to std::cout is undefined behaviour, and in libstdc++ it sets badbit and silences every later write to std::cout.

Relation to #103: #103 makes a missing site ID throw from getAyonApiFromEnv(). Without this PR, that would also fail every stage operation in the process. With it, a missing site ID gives the same single warning and only ayon:// resolution stops.

Testing notes:

Tested on our fork, where this change sits on top of #104, #108, #109, #110 and #106 (same diff), with a standalone OpenUSD 25.05 / Python 3.9 build:

  1. Unset AYON_API_KEY, AYON_SERVER_URL and AYON_PROJECT_NAME.
  2. Usd.Stage.CreateInMemory(), open a plain .usda file, and usdcat it: all work, and a single warning is printed (before: RuntimeError on each).
  3. Ar.GetResolver().Resolve("ayon://…") returns the URI unchanged, as for a missing asset.
  4. A layer with an ayon:// sublayer opens and reports "Could not load sublayer".
  5. With the variables set, resolution is unchanged: numbered, hero and missing URIs, memcached sets and hits, miss markers, ClearCache/DeleteFromCache.

With AYON_API_KEY, AYON_SERVER_URL or AYON_PROJECT_NAME unset, getAyonApiFromEnv() threw out of the
ResolverContextCache constructor. The resolver is the primary resolver, so every stage operation in the
process failed, even Usd.Stage.CreateInMemory() or opening a plain local file.

The constructor now catches that, warns once (TF_WARN) and carries on without an AYON connection.
getAsset() returns an ayon:// URI unresolved when there is none (as on any failed lookup, not anchored
as a file path), and batchWarm() skips the AYON request; plain paths resolve as normal.

getAyonApiFromEnv() also checks the variables before printing them: streaming a null char* to std::cout
is undefined behaviour and in libstdc++ sets badbit, silencing every later write to std::cout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YRNAzpFt5VwUwBTHRbRQRm
@antirotor
antirotor requested review from antirotor and a balanced review from Copilot and removed request for Copilot November 5, 2026 15:07
@antirotor antirotor added the type: bug Something isn't working label Nov 5, 2026

Copilot AI 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.

🟢 Approval recommended

No active review issues were identified in the changes allowing the resolver to operate without AYON environment settings.

No open issues 🎉

What changed in this PR

This PR lets the USD resolver operate without AYON environment settings, preserving plain-path operations while leaving unresolved ayon:// lookups unresolved.

Changes:

  • Catch AYON initialization failures and emit a warning instead of failing resolver construction.
  • Skip AYON lookup and batch requests when no API connection is available.
  • Validate required environment variables before logging them to avoid streaming null pointers.
File Description
src/​AyonUsdResolver/​helpers/​ayonApiGet.cpp Validate required variables before logging and clarify the missing-settings error.
src/​AyonUsdResolver/​cache/​resolverContextCache.cpp Handle initialization failures and guard AYON requests when no connection exists.

Review effort: Balanced

@antirotor
antirotor merged commit cfdf827 into ynput:enhancement/featuriing-memcached Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants