Skip to content

fix: nest dialogue prompt keys and lock each conversation - #342

Merged
lazyxeon merged 1 commit into
mainfrom
cursor/dialogue-prompt-lock-def8
Oct 16, 2026
Merged

lazyxeon merged 1 commit into
mainfrom
cursor/dialogue-prompt-lock-def8

Conversation

@lazyxeon

@lazyxeon lazyxeon commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Description

Rebased onto main c798c9db (#345), which names local_sim in the README. That is the closed-vocabulary lint failure on d249aacc.

Dialogue prompts use PromptContext::set_path, so speaker.name and player_emotion.* nest for Handlebars. started_at / last_activity are started_turn / last_turn. Each conversation is Arc<Mutex<ActiveConversation>>, held for the whole generate_response step.

The other three failures on d249aacc are the tracked editor parity red, not this diff:

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Security enhancement

Security Considerations

  • Does this PR introduce new dependencies? If yes, have they been vetted for security issues?
  • Does this PR modify how user input is handled? If yes, has it been validated/sanitized?
  • Does this PR change authentication or authorization mechanisms?
  • Does this PR access sensitive data or modify how it's stored?
  • Does this PR introduce new network communication or modify existing protocols?

No new dependencies and no new network path. generate_response still uses the injected client and stays off the sim tick.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings
  • I have run security checks (cargo audit, cargo deny) locally

Do not merge.

Open in Web Open in Cursor 

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 2b0a65f4-8412-46dc-9bec-b6fab717eb5f
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@cursor
cursor Bot force-pushed the cursor/dialogue-prompt-lock-def8 branch 2 times, most recently from f370b3f to d249aac Compare October 16, 2026 18:38
Handlebars reads speaker.name and player_emotion as nested paths, so the
prompt builder stores them with set_path. started_turn and last_turn replace
the zeroed clock fields. generate_response holds a per-conversation mutex
for the whole update so concurrent calls cannot clobber turn metadata.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/dialogue-prompt-lock-def8 branch from d249aac to 2a489f5 Compare October 16, 2026 20:07
@lazyxeon
lazyxeon marked this pull request as ready for review October 16, 2026 20:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T20:55:38.664691Z 2a489f5 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lazyxeon
lazyxeon merged commit 7318eb3 into main Oct 16, 2026
29 of 32 checks passed
@lazyxeon
lazyxeon deleted the cursor/dialogue-prompt-lock-def8 branch October 16, 2026 20:42

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2a489f5a83

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1602 to 1605
conversation.metadata.last_turn = conversation.metadata.turn_count as u64;
conversation.metadata.turn_count += 1;
conversation.emotional_state =
self.blend_emotional_states(&conversation.emotional_state, &response.emotional_tone);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Delay state mutation until memory persistence succeeds

When RagPipeline::add_memory fails—for example because the embedding client or vector store returns an error—generate_response now returns Err after mutating the mutex-protected conversation in place, so turn_count, last_turn, and the emotional state record a response that the caller was told failed, while success metrics remain unchanged. Before this change, those cloned fields were only written back after memory storage succeeded; move these mutations after the fallible RAG write or roll them back on error.

Useful? React with 👍 / 👎.

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