Skip to content

fix(memory_persistent): prevent double-forward of questions and answers (#1682 to stage) - #2353

Merged
asclearuc merged 1 commit into
stagefrom
fix/stage-preventDefault-1
Sep 18, 2026
Merged

asclearuc merged 1 commit into
stagefrom
fix/stage-preventDefault-1

Conversation

@asclearuc

@asclearuc asclearuc commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary (stage)

  • writeQuestions/writeAnswers explicitly forwarded via self.instance.write*() without calling preventDefault(), so the engine's automatic default action also ran afterward, delivering every question and answer twice
  • For questions this was worse than a plain duplicate: enrichment happens on a deep copy, so downstream received one copy with memory_context attached and one without
  • Added return self.preventDefault() on every explicit-forward path in both methods (all six exits). preventDefault() raises, and that is what suppresses the engine's default forward, so it is the last statement on each path. The _make_instance test fixture stubs preventDefault so the unit tests can call the handlers directly; delivery counts are checked in nodes/test/test_lane_forward_once_nodes.py, whose stub raises like the real one.

Type

fix

Testing

  • Tests added or updated
  • Tested locally
  • ./builder test passes

Ran ./builder nodes:test (not the full ./builder test) via the real compiled engine: 2162 passed, 64 skipped, 0 failed.

Checklist

  • Commit messages follow conventional commits
  • No secrets or credentials included
  • Wiki updated (if applicable)
  • Breaking changes documented (if applicable) — N/A, no breaking changes

Linked Issue

Fixes #1638

…rs (#1682)

* fix(memory_persistent): prevent double-forward of questions and answers

* test(memory_persistent): assert preventDefault is called on explicit forwards

* docs(memory_persistent): note preventDefault() unreachability and test stub caveat

* fix(memory_persistent): cover all six exits with delivery-count tests

- Every exit of `writeQuestions` and `writeAnswers` now ends in `return self.preventDefault()`. The separate `return` after `preventDefault()` could never run, because `preventDefault()` raises.
- `test_node.py`: two tests for the invalid `session_id` paths, which no test reached before. Removing `preventDefault()` from either path now fails a test.
- `test_lane_forward_once_nodes.py`: six delivery-count cases, one per exit (no store, invalid session, normal path), under the engine's forward rule. On the normal path, only the enriched or stored copy reaches downstream, never the original.
- Docstrings in `IInstance.py` now document their arguments.

---------

Co-authored-by: Alexandru Sclearuc <asclearuc@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (2)
  • develop
  • release/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 0fdcdc1b-b4be-47a9-8a28-131b713c4341

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@github-actions github-actions Bot added the module:nodes Python pipeline nodes label Sep 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor
🤖 Internal: Discord sync marker

Auto-managed by the Discord notification workflow. Stores the linked Discord message ID and forum thread ID. Do not edit or delete.

@asclearuc asclearuc changed the title fix(memory_persistent): prevent double-forward of questions and answers (#1682) fix(memory_persistent): prevent double-forward of questions and answers (#1682 to stage) Sep 18, 2026
@asclearuc
asclearuc merged commit 7b3b617 into stage Sep 18, 2026
23 of 24 checks passed
@asclearuc
asclearuc deleted the fix/stage-preventDefault-1 branch September 18, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:nodes Python pipeline nodes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants