Skip to content

fix: get_niagara_info reports 0 emitters when called with systemPath#495

Open
FlyAndNotDown wants to merge 1 commit into
ChiR24:devfrom
kindem-s-study-room:fix/niagara-info-readonly-default-asset-override
Open

fix: get_niagara_info reports 0 emitters when called with systemPath#495
FlyAndNotDown wants to merge 1 commit into
ChiR24:devfrom
kindem-s-study-room:fix/niagara-info-readonly-default-asset-override

Conversation

@FlyAndNotDown

Copy link
Copy Markdown

Summary

get_niagara_info (and validate_niagara_system) can report an empty result for a valid Niagara System when the caller passes the asset via systemPath. The query returns emitterCount: 0 with an empty emitters array even though the system has emitters.

Root cause is in the TypeScript layer, not the native bridge.

Changes

  • Add a read-only bypass in handleEffectAuthoringAction for get_niagara_info and validate_niagara_system.
  • These actions no longer trigger ensureDefaultNiagaraAuthoringAssets() default-asset injection; they only mirror the caller-supplied path across assetPath/systemPath before dispatching.
  • CHANGELOG updated under [Unreleased].

Root Cause

get_niagara_info and validate_niagara_system are listed in EFFECT_AUTHORING_ACTIONS, so they run through handleEffectAuthoringAction, which is designed for authoring actions (add_*_module, etc.). That handler fills in default assets when a path is unset:

if (!mutableArgs.systemPath) { mutableArgs.systemPath = defaultAssets.systemPath; }
...
if (!mutableArgs.assetPath)  { mutableArgs.assetPath  = defaultAssets.systemPath; }

The native GetNiagaraInfo handler resolves its target as AssetPath.IsEmpty() ? SystemPath : AssetPath — i.e. assetPath wins. So when a caller passes only systemPath, the empty assetPath gets overwritten with the freshly-created, empty default system, and the native handler inspects that empty system instead of the requested one.

Calling the same action with assetPath already worked, which confirms the issue is the default-asset override path rather than the C++ handler.

Reproduction

  1. Pick any Niagara System asset that has one or more emitters.
  2. Call manage_effect with:
    { "action": "get_niagara_info", "systemPath": "/Game/Path/To/YourSystem.YourSystem" }
  3. Before fix: emitterCount: 0, empty emitters, userParameterCount: 0.
  4. Call again using assetPath instead of systemPath → correct result. After fix: both systemPath and assetPath return the correct emitter list.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Testing

  • Tested with Unreal Engine (version: 5.7)
  • Tested MCP client integration
  • npm run build / tsc --noEmit pass
  • npm run test:smoke passes

Pre-Merge Checklist

  • Code follows project style guidelines
  • Self-reviewed the code
  • Updated CHANGELOG under [Unreleased]
  • CI passes

get_niagara_info and validate_niagara_system run through
handleEffectAuthoringAction, which injects ensureDefaultNiagaraAuthoringAssets()
defaults into systemPath/assetPath when a field is unset. The native
GetNiagaraInfo handler resolves its target as assetPath-first, so a caller
passing only systemPath had its empty assetPath overwritten with the throwaway
default system and the query reported emitterCount: 0 for a valid asset.

Read-only query actions now bypass default-asset injection and only mirror the
caller-supplied path across assetPath/systemPath before dispatching.
@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for your first Pull Request! We love contributions. Please ensure you have signed off your commits and followed the contribution guidelines.

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Fixed Niagara query actions so valid assets now return the correct system and emitter data when a path is provided.
    • get_niagara_info and validate_niagara_system now use the caller-supplied asset/system path consistently, avoiding empty emitter results and incorrect emitterCount: 0 responses.

Walkthrough

get_niagara_info and validate_niagara_system are now identified as read-only query actions via a new NIAGARA_READONLY_QUERY_ACTIONS set. When either is invoked, handleEffectAuthoringAction normalizes assetPath and systemPath to the caller-supplied value and returns early, skipping default-system injection. CHANGELOG updated accordingly.

Changes

Niagara Read-Only Query Path Fix

Layer / File(s) Summary
Read-only query guard and path normalization
src/tools/handlers/effect/effect-niagara-actions.ts, CHANGELOG.md
Defines NIAGARA_READONLY_QUERY_ACTIONS set with get_niagara_info and validate_niagara_system. In handleEffectAuthoringAction, when the action is in that set, resolves queryPath from mutableArgs.assetPath or mutableArgs.systemPath, overwrites both path fields with it, dispatches manage_niagara_authoring, and returns early—bypassing all subsequent default-parameter injection. CHANGELOG entry added under Unreleased → Fixed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

🐇 A path was passed, but defaults crept in,
Injecting a ghost where no ghost should begin.
Now query actions step lightly ahead,
With caller-supplied paths used faithfully instead.
No phantom emitters, no count of zero—
The path you provide makes each asset a hero! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately highlights the main Niagara systemPath fix.
Description check ✅ Passed The description covers summary, root cause, changes, reproduction, testing, and type of change; only the Related Issues section is missing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/tools/handlers/effect/effect-niagara-actions.ts`:
- Around line 76-83: The readonly Niagara action branch in
effect-niagara-actions.ts is using a generic assetPath-first fallback that can
overwrite a valid systemPath for validate_niagara_system. Update the path
selection logic in the NIAGARA_READONLY_QUERY_ACTIONS handling to use
action-specific precedence, matching the validation rules used by the Niagara
authoring handlers, and only mirror the chosen field into the other one after
selecting the correct target path for the current action. Refer to the
NIAGARA_READONLY_QUERY_ACTIONS block and executeAutomationRequest call to keep
the query routed to the intended asset or system path.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1c22edfd-2316-48df-b607-a4d07aafdeda

📥 Commits

Reviewing files that changed from the base of the PR and between d49b158 and 492ceb6.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • src/tools/handlers/effect/effect-niagara-actions.ts

Comment on lines +76 to +83
if (NIAGARA_READONLY_QUERY_ACTIONS.has(action)) {
const queryPath = (mutableArgs.assetPath ?? mutableArgs.systemPath) as string | undefined;
if (queryPath) {
mutableArgs.assetPath = queryPath;
mutableArgs.systemPath = queryPath;
}
return executeAutomationRequest(tools, 'manage_niagara_authoring', mutableArgs) as Promise<Record<string, unknown>>;
}

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Use action-specific path precedence before mirroring fields.

Line 77 always prefers assetPath; for validate_niagara_system, that can overwrite a valid systemPath when both are provided and differ, causing validation/query against the wrong target.

Suggested fix
 if (NIAGARA_READONLY_QUERY_ACTIONS.has(action)) {
-  const queryPath = (mutableArgs.assetPath ?? mutableArgs.systemPath) as string | undefined;
+  const assetPath = typeof mutableArgs.assetPath === 'string' ? mutableArgs.assetPath : undefined;
+  const systemPath = typeof mutableArgs.systemPath === 'string' ? mutableArgs.systemPath : undefined;
+  const queryPath =
+    action === 'validate_niagara_system'
+      ? (systemPath ?? assetPath)
+      : (assetPath ?? systemPath);
   if (queryPath) {
     mutableArgs.assetPath = queryPath;
     mutableArgs.systemPath = queryPath;
   }
   return executeAutomationRequest(tools, 'manage_niagara_authoring', mutableArgs) as Promise<Record<string, unknown>>;
 }

Based on learnings from src/tools/handlers/niagara/niagara-authoring-handlers.ts:298-306, these two actions validate different required fields (assetPath vs systemPath).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (NIAGARA_READONLY_QUERY_ACTIONS.has(action)) {
const queryPath = (mutableArgs.assetPath ?? mutableArgs.systemPath) as string | undefined;
if (queryPath) {
mutableArgs.assetPath = queryPath;
mutableArgs.systemPath = queryPath;
}
return executeAutomationRequest(tools, 'manage_niagara_authoring', mutableArgs) as Promise<Record<string, unknown>>;
}
if (NIAGARA_READONLY_QUERY_ACTIONS.has(action)) {
const assetPath = typeof mutableArgs.assetPath === 'string' ? mutableArgs.assetPath : undefined;
const systemPath = typeof mutableArgs.systemPath === 'string' ? mutableArgs.systemPath : undefined;
const queryPath =
action === 'validate_niagara_system'
? (systemPath ?? assetPath)
: (assetPath ?? systemPath);
if (queryPath) {
mutableArgs.assetPath = queryPath;
mutableArgs.systemPath = queryPath;
}
return executeAutomationRequest(tools, 'manage_niagara_authoring', mutableArgs) as Promise<Record<string, unknown>>;
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/tools/handlers/effect/effect-niagara-actions.ts` around lines 76 - 83,
The readonly Niagara action branch in effect-niagara-actions.ts is using a
generic assetPath-first fallback that can overwrite a valid systemPath for
validate_niagara_system. Update the path selection logic in the
NIAGARA_READONLY_QUERY_ACTIONS handling to use action-specific precedence,
matching the validation rules used by the Niagara authoring handlers, and only
mirror the chosen field into the other one after selecting the correct target
path for the current action. Refer to the NIAGARA_READONLY_QUERY_ACTIONS block
and executeAutomationRequest call to keep the query routed to the intended asset
or system path.

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.

1 participant