Skip to content

update it so it only save voice input#2465

Merged
openminddev merged 15 commits intomainfrom
only-save-voice-input
Mar 12, 2026
Merged

update it so it only save voice input#2465
openminddev merged 15 commits intomainfrom
only-save-voice-input

Conversation

@WenjinFu
Copy link
Copy Markdown
Contributor

Overview

Only save the voice input to the history based on the history length.

@WenjinFu WenjinFu requested a review from a team as a code owner March 12, 2026 00:41
Copilot AI review requested due to automatic review settings March 12, 2026 00:41
@WenjinFu WenjinFu requested a review from a team as a code owner March 12, 2026 00:41
@github-actions github-actions Bot added robotics Robotics code changes python Python code labels Mar 12, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the LLM history tracking to prefer a cleaner, conversation-style history by focusing on voice/ASR input and enforcing a maximum history length via truncation.

Changes:

  • Extract only voice/ASR inputs per tick for the user history entry.
  • Store a simplified assistant history entry composed of spoken text (and selected parsed response fields).
  • Replace summarization-trigger behavior with direct history truncation to history_length.

Comment thread src/providers/llm_history_manager.py Outdated
Comment on lines +334 to +337
else:
formatted_inputs = (
f"User: {self.agent_name} received no voice input this cycle."
)
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

When no voice/ASR input is present, this generates a placeholder user message ("received no voice input this cycle"). Given the PR goal (“only save voice input”), consider not creating/storing any user history entry for cycles without voice input (or gate placeholder storage behind an explicit debug flag).

Copilot uses AI. Check for mistakes.
Comment on lines 375 to 379
if (
self.history_manager.config.history_length > 0
and len(self.history_manager.history)
> self.history_manager.config.history_length
):
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

history_length is Optional[int] (see LLMConfig.history_length), but this code compares it to 0. If it is ever None, this will raise TypeError. Please guard with is not None (or coerce to an int) before doing comparisons/arithmetic, similar to the existing truncation logic in start_summary_task’s callback.

Copilot uses AI. Check for mistakes.
Comment thread src/providers/llm_history_manager.py Outdated
Comment on lines +352 to +356
speak_parts = []
for action in response.actions:
atype = action.type.lower()
if atype == "speak" and action.value:
speak_parts.append(action.value)
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

This change stops recording non-verbal actions into assistant history (only speak and parsed JSON with a response field are kept). If that’s intended, consider removing the now-unused ACTION_MAP constant to avoid dead code; otherwise, consider retaining a structured action summary so the history still reflects what the agent did.

Copilot uses AI. Check for mistakes.
Comment thread src/providers/llm_history_manager.py Outdated
Comment on lines 323 to 327
# Only extract voice (ASR) input for clean conversation history
voice_input = ""
for input_type, input_info in self.io_provider.inputs.items():
if input_info.tick == current_tick:
logging.debug(f"LLM: {input_type} (tick #{input_info.tick})")
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

There are existing pytest unit tests covering LLMHistoryManager.update_history formatting and history-length behavior. With the new voice-only input extraction, those tests should be updated and new cases added (voice present vs absent, truncation) to prevent regressions.

Copilot generated this review using guidance from repository custom instructions.
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@WenjinFu WenjinFu requested a review from a team as a code owner March 12, 2026 18:49
@github-actions github-actions Bot added the config Configuration files label Mar 12, 2026
WenjinFu and others added 8 commits March 12, 2026 11:50
Introduce a guard flag (_stopped) and early-return in _poll to allow disabling incoming voice handling; add a stop() method that logs, sets the flag, and clears stored messages. Import logging and tighten formatted_latest_buffer typing; remove a side-effecting io_provider.add_input call from formatted_latest_buffer. Add comprehensive unit tests for initialization, polling behavior, raw_to_text, formatted buffer output, sliding-window semantics, stop behavior, and edge cases.
@github-actions github-actions Bot added the tests Test files label Mar 12, 2026
@openminddev openminddev merged commit ddf51f1 into main Mar 12, 2026
6 checks passed
@openminddev openminddev deleted the only-save-voice-input branch March 12, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Configuration files python Python code robotics Robotics code changes tests Test files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants