Repository navigation
fix(agent): Await Response pauses on every Loop iteration - #16794
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthrough
ChangesFillup Value Clearing
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant UserFillUp
participant InputElements
Caller->>UserFillUp: Invoke with merged inputs
alt No merged inputs
UserFillUp->>UserFillUp: Call _clear_form_values
UserFillUp->>InputElements: Clear eligible values
else Supplied answer
UserFillUp->>InputElements: Set input and output values
end
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
agent/component/fillup.py (1)
117-134: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd logging for the new clearing flow.
The new
_clear_form_valuesguard is a new runtime flow (clearing stale form values on re-entry inside a Loop). No log statement is emitted when clearing occurs, making it difficult to diagnose loop-iteration pause issues in production. As per coding guidelines, new flows in**/*.pyfiles should add logging.♻️ Proposed addition of a debug log
def _invoke(self, **kwargs): ... merged_inputs = self._merge_runtime_inputs(kwargs.get("inputs", {})) if not merged_inputs: + logging.debug("UserFillUp %s: no fresh inputs, clearing retained form values", self.component_name) self._clear_form_values() for k, v in merged_inputs.items(): ... def _clear_form_values(self): for field in self.get_input_elements().values(): if isinstance(field, dict): field["value"] = None🤖 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 `@agent/component/fillup.py` around lines 117 - 134, Add a debug log for the new clearing path in UserFillUp processing: when merged_inputs is empty and _clear_form_values is called, emit a log message so loop re-entry can be diagnosed in production. Update the fillup.py flow around _clear_form_values and the merged_inputs guard to log that stale form values are being cleared before waiting again, using the existing logging pattern in the component.Source: Coding guidelines
🤖 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.
Nitpick comments:
In `@agent/component/fillup.py`:
- Around line 117-134: Add a debug log for the new clearing path in UserFillUp
processing: when merged_inputs is empty and _clear_form_values is called, emit a
log message so loop re-entry can be diagnosed in production. Update the
fillup.py flow around _clear_form_values and the merged_inputs guard to log that
stale form values are being cleared before waiting again, using the existing
logging pattern in the component.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 682eefa6-5d2e-45a2-bc1c-3960097c95ec
📒 Files selected for processing (2)
agent/component/fillup.pytest/testcases/test_web_api/test_canvas_app/test_fillup_unit.py
There was a problem hiding this comment.
Pull request overview
This PR fixes the Python agent runtime behavior where an Await Response (UserFillUp) node inside a Loop would only pause on the first iteration and then silently reuse the previous iteration’s answers. It does this by clearing retained form values when the node is entered without any fresh runtime inputs, so the canvas wait-check sees the form as unsatisfied and pauses again.
Changes:
- Clear
UserFillUpinput field values on entry when no fresh runtime inputs are provided, forcing re-prompting on loop re-entry. - Add unit tests validating that stale values are cleared on re-entry and that supplied answers are preserved/applied.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| agent/component/fillup.py | Clears retained UserFillUp form values when entered without new inputs so the canvas wait-check pauses on each loop iteration. |
| test/testcases/test_web_api/test_canvas_app/test_fillup_unit.py | Adds unit tests covering stale-value clearing on re-entry and preservation when a new answer is supplied. |
78370d8 to
d4011a7
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16794 +/- ##
=======================================
Coverage 93.16% 93.16%
=======================================
Files 10 10
Lines 717 717
Branches 118 118
=======================================
Hits 668 668
Misses 29 29
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A UserFillUp (Await Response) node inside a Loop only paused on the first iteration. Because the component object is reused across iterations, its form field values persisted from the previous answer, so the canvas wait-check saw them as satisfied and skipped the pause on later iterations. Clear the retained form values when a UserFillUp is entered without a fresh user answer so it waits for input again on every iteration.
Optional file inputs are treated as satisfied when empty, so clearing them on re-entry would not force a re-prompt and would only drop a previously uploaded file. Skip them in _clear_form_values to avoid unexpected data loss.
3565799 to
7656e2e
Compare
A single-input UserFillUp (Await Response) node auto-filled its field from the initial user query (sys.query) and continued without pausing, unlike multi-input forms which correctly wait. The initial-query consumption is only meaningful for the entry Begin node, so restrict it to Begin and make every mid-flow Await Response pause for a fresh user response. Rebased onto main (which already contains the Loop-iteration fix infiniflow#16794); the Begin-based tests are combined with the existing loop tests.
What
An Await Response (
UserFillUp) node placed inside a Loop now pauses and waits for a fresh user response on every iteration, instead of only on the first one.Problem
When a
UserFillUpnode lives inside aLoop, it only paused for input on the first iteration. On subsequent iterations the loop ran straight through, silently reusing the answer the user gave the first time.Root cause is in
UserFillUp._invoke/ the canvas wait-check (agent/canvas.py). The wait-check decides whether to pause by callingCanvas._is_input_field_satisfiedon the node's form fields — a field counts as satisfied as soon as itsvalueis notNone:The same component object is reused across loop iterations, and
UserFillUp._invokewrites the answer intoself._param.inputs[...]["value"]viaset_input_value. Nothing cleared those values when the node was re-entered for the next iteration, so:Noneansweranswer(stale)Fix
When a
UserFillUpis entered without a fresh user answer (merged_inputsis empty), clear the retained form values so the wait-check treats the form as unsatisfied and pauses again:merged_inputsis non-empty → values applied normally, nothing cleared.Nonevalues, so clearing is a no-op there.Beginoverrides_invokeand is unaffected.Tests
Added to
test/testcases/test_web_api/test_canvas_app/test_fillup_unit.py:test_user_fillup_clears_stale_values_on_reentry_without_answer— a retained value is cleared on a fresh entry with no answer (loop re-entry).test_user_fillup_keeps_values_when_answer_supplied— a supplied answer is applied and not cleared.All unit tests pass and
ruff checkis clean.Scope
This targets the Python agent runtime (
agent/). It is independent of any other in-flight Await Response change.