Skip to content

update it so it only save voice input#2465

Open
WenjinFu wants to merge 3 commits intomainfrom
only-save-voice-input
Open

update it so it only save voice input#2465
WenjinFu wants to merge 3 commits intomainfrom
only-save-voice-input

Conversation

@WenjinFu
Copy link
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
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 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 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 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

codecov bot commented Mar 12, 2026

Codecov Report

❌ Patch coverage is 44.92754% with 38 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/providers/conversation_history_provider.py 40.35% 34 Missing ⚠️
src/runtime/cortex.py 66.66% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Python code robotics Robotics code changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants