Skip to content

remove params from anyInputs - #1199

Merged
isamu merged 1 commit into
receptron:mainfrom
isamu:fixAnyInputs
Aug 14, 2025
Merged

isamu merged 1 commit into
receptron:mainfrom
isamu:fixAnyInputs

Conversation

@isamu

@isamu isamu commented Aug 14, 2025 •

Copy link
Copy Markdown
Member

Exclude params from anyInputs judgment

Summary by CodeRabbit

  • Bug Fixes
    • Improved data readiness detection for computed nodes by excluding configuration parameters from availability checks, preventing premature or stalled executions.
    • Ensured stable behavior when inputs are missing by treating them as empty, reducing edge-case errors and improving reliability.

@isamu
isamu requested a review from snakajima August 14, 2025 10:28
@coderabbitai

coderabbitai Bot commented Aug 14, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The data readiness check in ComputedNode.checkDataAvailability was modified to exclude the params field from inputs. The method now defaults inputs to {} if undefined, filters out params, calls graph.resultsOf on the cleaned inputs, flattens the results, and checks for any non-undefined value to determine readiness.

Changes

Cohort / File(s) Summary
Graph node readiness logic
packages/graphai/src/node.ts
Updated checkDataAvailability to ignore inputs.params when assessing readiness, default inputs to {}, call resultsOf on cleaned inputs, flatten results, and use some(result !== undefined). No public API signature changes.

Sequence Diagram(s)

sequenceDiagram
  participant CN as ComputedNode
  participant G as Graph

  CN->>CN: inputs || {}
  CN->>CN: cleanInput = omit(inputs, 'params')
  CN->>G: resultsOf(cleanInput)
  G-->>CN: results[]
  CN->>CN: readiness = flatten(results).some(r !== undefined)
  CN-->>CN: return readiness
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~7 minutes

Poem

I twitch my whiskers, nose a-nudge,
Params aside, I will not judge—
I sniff the inputs, neat and clean,
Seek any hint of data seen.
A hop, a check: is something there?
If yes, I thump—proceed with flair! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@isamu
isamu merged commit 1c714d6 into receptron:main Aug 14, 2025

@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

🧹 Nitpick comments (2)
packages/graphai/src/node.ts (2)

241-241: Nit: prefer underscore-prefixed alias for unused binding to appease linters.

Some ESLint/TS configs ignore unused variables when they start with an underscore. Using _params (or similar) is less likely to trip no-unused-vars.

-const { params: __, ...cleanInput } = this.inputs ?? {};
+const { params: _params, ...cleanInput } = this.inputs ?? {};

241-245: Add unit tests for anyInput + params exclusion.

Recommend adding coverage to lock this behavior:

  • anyInput=true, inputs contain both params and a non-params source: becomes ready when non-params value arrives; params alone does not.
  • anyInput=true, inputs only under params: does not become ready (or, if you adopt the optional refactor, is not blocked by params-only pendings).

I can draft targeted tests that set up minimal graphs to assert these cases. Want me to open a follow-up PR with tests?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these settings in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d520c4d and 87af8b5.

📒 Files selected for processing (1)
  • packages/graphai/src/node.ts (1 hunks)
🔇 Additional comments (2)
packages/graphai/src/node.ts (2)

241-245: Change aligns with PR objective: params excluded from anyInput readiness.

This correctly ignores the params field when deciding readiness for anyInput nodes. Defaulting to {} prevents destructuring on undefined. The flatten + non-undefined check keeps previous semantics for determining availability.


242-245: Confirm whether null should count as “available.”

Currently, readiness treats null as available (only filters out undefined). If the intended semantics are “must be non-nullish,” consider using result != null. If null is a valid, intentional value, the current check is correct.

If null should not trigger readiness:

-  .some((result) => result !== undefined);
+  .some((result) => result != null);

Comment on lines +241 to 245
const { params: __, ...cleanInput } = this.inputs ?? {};
return Object.values(this.graph.resultsOf(cleanInput))
.flat()
.some((result) => result !== undefined);
}

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.

💡 Verification agent

🧩 Analysis chain

Risk: anyInput nodes that only have inputs under params may never become ready.

When anyInput is true, removePending clears all pendings only if checkDataAvailability() returns true. Since params are now excluded from that check, a node whose inputs are all under params will never satisfy checkDataAvailability(), yet its pendings still include the params-derived sources (built from inputs2dataSources(data.inputs)). That combination can leave the node stuck.

Consider also excluding params from pendings construction for anyInput nodes so that “params-only” inputs don’t block scheduling:

  • Option A (recommended): Build dataSources/pending sources from inputs with params removed when anyInput is true.

For example (outside the changed lines, in the constructor where dataSources are built):

// After: this.inputs = data.inputs;
const { params: _p, ...inputsExcludingParams } = (data.inputs ?? {}) as Record<string, unknown>;
const inputsForSources = this.anyInput ? inputsExcludingParams : (data.inputs ?? {});
this.dataSources = [
  ...(Object.keys(inputsForSources).length ? inputs2dataSources(inputsForSources).flat(10) : []),
  ...(this.agentId ? [parseNodeName(this.agentId)] : []),
  ...(data.passThrough ? inputs2dataSources(data.passThrough).flat(10) : []),
];

To help assess whether this would affect existing graphs, you can scan for anyInput nodes whose inputs appear to be params-only:


🏁 Script executed:

#!/usr/bin/env bash
# Heuristic search for anyInput nodes that might rely only on `params`
# This is approximate; please manually review matches.

rg -n --no-heading -C 8 'anyInput\s*:\s*true' \
  | rg -n -C 8 'inputs\s*:\s*\{[^}]*params' \
  | sed -n '1,200p'

Length of output: 105


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "=== Show packages/graphai/src/node.ts (first 400 lines) ==="
sed -n '1,400p' packages/graphai/src/node.ts || true

echo
echo "=== Search for occurrences of anyInput ==="
rg --line-number --hidden --no-ignore 'anyInput' || true

echo
echo "=== Search for inputs2dataSources, dataSources, pendings, removePending, checkDataAvailability, resultsOf ==="
rg --line-number --hidden --no-ignore 'inputs2dataSources|dataSources|pendings|removePending|checkDataAvailability|resultsOf' || true

echo
echo "=== Grep for constructor in node.ts to show how dataSources/pendings are built ==="
rg --line-number "constructor" packages/graphai/src/node.ts -n -S || true
sed -n '1,240p' packages/graphai/src/node.ts || true
# show remainder if file longer
sed -n '241,520p' packages/graphai/src/node.ts || true

Length of output: 260039


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "=== packages/graphai/src/validators/relation_validator.ts ==="
sed -n '1,240p' packages/graphai/src/validators/relation_validator.ts || true

Length of output: 4171


Fix anyInput readiness check: checkDataAvailability ignores params and doesn't use anyInput flag

Short summary:

  • I inspected packages/graphai/src/node.ts and packages/graphai/src/validators/relation_validator.ts.
  • data.params is not currently added to dataSources/pending (the params line in the constructor is commented out), so the original “params-derived pendings” risk is unlikely with the current constructor.
  • However, checkDataAvailability strips a params key from this.inputs but calls this.graph.resultsOf(cleanInput) WITHOUT passing the anyInput flag. For anyInput nodes this mismatch can prevent removePending from clearing pendings when it should.

Places to review:

  • packages/graphai/src/node.ts
    • constructor: dataSources build (params line is commented out)
    • checkDataAvailability() (current lines ~240-245)
    • removePending() (current lines ~255-263)
  • packages/graphai/src/validators/relation_validator.ts (there is a commented-out params block for validation)

Recommended fix (minimal, recommended)

  • Make checkDataAvailability honor the anyInput semantics by passing this.anyInput into resultsOf:

Replace current checkDataAvailability with:

private checkDataAvailability() {
  const { params: __, ...cleanInput } = this.inputs ?? {};
  return Object.values(this.graph.resultsOf(cleanInput, this.anyInput))
    .flat()
    .some((result) => result !== undefined);
}

Optional defensive change (only if you want to be explicit about params not blocking anyInput nodes)

  • If you prefer to ensure pendings never include params-derived sources for anyInput nodes, adjust dataSources construction in the constructor to build sources from inputs with params removed when this.anyInput is true (as in the original suggestion). This is optional because the current constructor already does not include data.params in dataSources.

Reasoning / verification

  • I confirmed constructor currently omits data.params from dataSources (it's commented out), so pendings are built from inputs/passThrough/agent only.
  • The actionable bug is the missing anyInput flag in checkDataAvailability which causes removePending(this.nodeId) to clear pendings only when resultsOf(cleanInput) (with default anyInput=false) reports data — this can incorrectly keep anyInput nodes waiting.

Tag:

🤖 Prompt for AI Agents
In packages/graphai/src/node.ts around lines 241 to 245, checkDataAvailability
strips params from this.inputs but calls this.graph.resultsOf(cleanInput)
without honoring the node's anyInput flag; update the call to pass this.anyInput
into resultsOf (i.e., this.graph.resultsOf(cleanInput, this.anyInput)) so
anyInput nodes are checked correctly and removePending can clear pendings as
intended.

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.

2 participants