Skip to content

feat: Simulation upgrades - #120

Open
TEJASNARAYANS wants to merge 4 commits into
mainfrom
simulation-upgrades
Open

feat: Simulation upgrades#120
TEJASNARAYANS wants to merge 4 commits into
mainfrom
simulation-upgrades

Conversation

@TEJASNARAYANS

Copy link
Copy Markdown
Contributor

What Changed?

Briefly describe what this PR changes.

Why?

Explain the problem this solves and why this approach was chosen.

How to Test?

List clear steps for reviewers to verify the change.

Release Label

Select one semantic version bump intent for this PR:

  • major - breaking change, next release bumps major version
  • minor - backward-compatible feature, next release bumps minor version
  • fix - backward-compatible bug fix, next release bumps patch version
  • No label (defaults to patch release)

If you do not have permission to apply labels, mention the intended release label here and a maintainer will set it.

Checklist

  • I have read the CONTRIBUTING.md guide.
  • My code follows the project's style guidelines.
  • I have added tests that prove my fix is effective or my feature works.
  • I have updated documentation where needed.

@TEJASNARAYANS TEJASNARAYANS added the fix Fix version release label Aug 27, 2026
@TEJASNARAYANS

Copy link
Copy Markdown
Contributor Author

@greptile-apps

@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown

Greptile Summary

This PR substantially expands voice-agent simulations with structured test-agent templates, persona ambient audio, persona-aware evaluator suites, turn gating, recording alignment, and updated worker scheduling.

  • Adds reusable and persona-specific ambient-noise uploads, previews, mixing, and telephony integration.
  • Adds structured test-agent prompts and first-message behavior across backend and frontend workflows.
  • Expands evaluator suites to support persona/scenario combinations and updates result navigation.
  • Revises voice bridges, recording behavior, production-turn gating, and provider/model configuration.
  • Moves evaluator cron dispatch onto the usage queue and adds related migrations and tests.

Confidence Score: 3/5

The PR should not merge until ambient uploads reject oversized bodies before loading them completely into API-worker memory.

Both newly added upload handlers apply the 10 MiB limit only after an unbounded read, leaving authenticated requests able to consume excessive process memory.

Files Needing Attention: app/api/v1/routes/personas.py

Security Review

The new ambient-audio upload endpoints enforce their 10 MiB limit only after reading the complete multipart file, allowing an authenticated Enterprise user to cause excessive API-worker memory consumption with an oversized request.

Important Files Changed

Filename Overview
app/api/v1/routes/personas.py Adds ambient library and persona-audio APIs, but both upload paths read oversized files fully before enforcing the configured limit.
app/services/audio/ambient_catalog.py Adds platform and custom ambient resolution with validated API write paths; no reachable tenant or traversal failure was established.
app/services/audio/ambient_mixer.py Adds decoding, resampling, looping, and volume-controlled ambient mixing used by simulation runtimes.
app/services/evaluators/evaluator_suite_service.py Expands suite materialization and rotation around persona/scenario combinations.
app/services/testing/test_agent_template.py Introduces normalized structured test-agent templates and deterministic prompt assembly.
app/services/webrtc_bridge/production_turn_gate.py Adds production-agent turn buffering and gating behavior with focused test coverage.
app/services/voice_agent/audio_recorder.py Extends recording and timing behavior for upgraded simulation and telephony audio flows.
app/workers/config.py Routes evaluator cron dispatch through the usage worker topology with corresponding deployment and scheduling changes.
frontend/src/pages/personas/PersonaAmbientPanel.tsx Adds persona ambient-source selection, upload, preview, and volume controls.
frontend/src/pages/agents/components/TestAgentTemplateEditor.tsx Adds structured editing for test-agent prompt sections and opening-message modes.

Reviews (1): Last reviewed commit: "feat: updating recording issues" | Re-trigger Greptile

Comment on lines +787 to +789
file_bytes = await file.read()
try:
extension = validate_ambient_upload_bytes(file_bytes, filename=filename)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 security Upload limit applied late

When an authenticated Enterprise user submits an oversized ambient-audio file, await file.read() loads the complete file before the 10 MiB validation runs, causing excessive API-worker memory consumption or process termination. The same issue occurs in upload_persona_ambient_audio at lines 1255–1258.

How this was verified: Both upload handlers perform an unbounded read before checking the configured maximum, and the repository defines no earlier request-body limit.

@greptile-apps

greptile-apps Bot commented Aug 29, 2026

Copy link
Copy Markdown

Too many files changed for review (140 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

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

Labels

fix Fix version release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant