Skip to content

Fix Selected Response Bug - #274

Merged
sadrasabouri merged 27 commits into
devfrom
selected-response-bug
Nov 10, 2026
Merged

sadrasabouri merged 27 commits into
devfrom
selected-response-bug

Conversation

@sepandhaghighi

@sepandhaghighi sepandhaghighi commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Reference Issues/PRs

#243

What does this implement/fix? Explain your changes

  • Test system modified
  • Selected response bug fixed
  • Prompt class remove_response method modified
  • Prompt class clear_responses method modified
  • Prompt class select_response method modified
  • Prompt class update_responses method modified

Any other comments?

@sepandhaghighi sepandhaghighi added this to the memor-v1.5 milestone Oct 23, 2026
@sepandhaghighi sepandhaghighi self-assigned this Oct 23, 2026
@sepandhaghighi sepandhaghighi added the bug Something isn't working label Oct 23, 2026
@codacy-production

codacy-production Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 30 complexity · 6 duplication

Metric Results
Complexity 30
Duplication 6

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@codecov-commenter

codecov-commenter commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.75%. Comparing base (5230eb4) to head (959a661).
⚠️ Report is 1 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #274      +/-   ##
==========================================
+ Coverage   98.73%   98.75%   +0.02%     
==========================================
  Files          12       12              
  Lines        2123     2154      +31     
  Branches      201      211      +10     
==========================================
+ Hits         2096     2127      +31     
  Misses          6        6              
  Partials       21       21              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sepandhaghighi
sepandhaghighi marked this pull request as ready for review November 5, 2026 23:20
@sepandhaghighi

Copy link
Copy Markdown
Member Author

@sadrasabouri

This pull request is now ready for your review 💯

Comment thread memor/params.py Outdated
INVALID_DATETIME_MESSAGE = "Invalid value. `{parameter_name}` must be a datetime object that includes timezone information."
INVALID_TEMPLATE_MESSAGE = "Invalid template. It must be an instance of `PromptTemplate` or `PresetPromptTemplate`."
INVALID_RESPONSE_MESSAGE = "Invalid response. It must be an instance of `Response`."
INVALID_RESPONSE_IDENTIFIER_MESSAGE = "Invalid response identifier. It must be a non-negative integer index or a valid UUIDv4 response ID."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer:

Invalid response identifier. It must be a non-negative integer index or a valid response ID.

UUIDv4 is too technical term for an error message.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in 959a661

Comment thread memor/prompt.py
Comment on lines +348 to +350
else:
if len(self.responses) > 0 and isinstance(self.responses[0], Response):
format_kwargs.update({"response": self.responses[0].to_json()})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand the relatedness of this change. Is this related to the response id issue or a separate bug fix?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, we only used an index to select a response. The default selected_response was the first one in the list. Now that we use a message ID for this purpose, the default selected response is None. This will lead to failures of some templates that use the term response. To make Memor backward-compatible and ensure a smoother flow, I added this if-else statement to the render method.

@sadrasabouri
sadrasabouri merged commit bdd48cc into dev Nov 10, 2026
28 checks passed
@sadrasabouri
sadrasabouri deleted the selected-response-bug branch November 10, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants