Skip to content

fix(harness): apply an edited max_turns to the scenario a run plays - #126

Closed
KarthikAvinashFI wants to merge 2 commits into
devfrom
fix/th-7985-edits-reach-chat-runs
Closed

KarthikAvinashFI wants to merge 2 commits into
devfrom
fix/th-7985-edits-reach-chat-runs

Conversation

@KarthikAvinashFI

@KarthikAvinashFI KarthikAvinashFI commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Why

A run lays the platform's current scenario edits over the sealed scenario document before playing it (_with_scenario_edits in fi/alk/harness/call_runner.py). The overlay only takes the fields listed in _EDITABLE_FIELDS, and max_turns was not listed. So an edited turn budget reached the run's metadata but never the chat call that reads it.

What changed

File Change
src/fi/alk/harness/call_runner.py _EDITABLE_FIELDS includes max_turns. Voice calls do not read max_turns, so they are unaffected; chat calls (chat_call_runner._conversation_scenario) now use the edited value.
tests/harness/test_scenario_edits.py The overlay test and the chat caller test assert the edited max_turns, plus a persona languages list with two entries.

Tests

Test Scenario it pins
test_edits_replace_only_what_a_call_plays max_turns and a two-language persona are overlaid; tests and instruction stay sealed.
test_a_chat_caller_is_the_edited_persona The chat scenario built from the merged document carries the edited max_turns.

Verified live

Built into a hosted sandbox template with ALK dev and #128. The image carries _EDITABLE_FIELDS = ("background_noise", "max_turns"). An edited max_turns reaches the run's scenario_edits on a chat environment. Voice calls, which do not read max_turns, completed on the new template across two fresh environments.

How to run

pytest tests/harness/test_scenario_edits.py tests/harness/test_call_runner.py tests/harness/test_chat_call_runner.py

Linear

Part of TH-7985

@KarthikAvinashFI KarthikAvinashFI self-assigned this Sep 30, 2026
Base automatically changed from dev to main September 30, 2026 13:09
@KarthikAvinashFI
KarthikAvinashFI changed the base branch from main to dev October 6, 2026 08:44
@KarthikAvinashFI

Copy link
Copy Markdown
Member Author

Folded into #128.

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.

1 participant