Skip to content

Harden questionnaire engines: parsing and shutdown guarantees#250

Open
gut-puncture wants to merge 3 commits into
google-deepmind:mainfrom
gut-puncture:codex/harden-questionnaire-engines-parsing-and-shutdown
Open

Harden questionnaire engines: parsing and shutdown guarantees#250
gut-puncture wants to merge 3 commits into
google-deepmind:mainfrom
gut-puncture:codex/harden-questionnaire-engines-parsing-and-shutdown

Conversation

@gut-puncture

@gut-puncture gut-puncture commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • harden next_acting parsing in both questionnaire engines
    • trim whitespace
    • drop empty tokens
    • preserve order and duplicate valid names
    • filter unknown names with explicit warning logs
  • guarantee executor cleanup in both questionnaire run_loop methods on all exit paths
  • add dedicated regression tests for parsing behavior and cleanup on early-return/exception paths

Refinement pass

This update keeps behavior unchanged while making the implementation more maintainable:

  • extracted shared parser logic into concordia/environment/engines/questionnaire_utils.py
  • refactored each engine's run_loop into a thin orchestration wrapper plus _run_loop_impl
  • replaced the nested parallel-task closure with a focused private helper method (_process_question_task)
  • updated tests to validate shared logging contract and added a focused helper test module

Why

The previous version worked but still duplicated parsing logic and had deeply nested loop control in both engines. This pass keeps the same behavior while making control flow and contracts easier to reason about and review.

Testing

  • . .venv/bin/activate && python -m pytest -q concordia/environment/engines/questionnaire_utils_test.py
  • . .venv/bin/activate && python -m pytest -q concordia/environment/engines/sequential_questionnaire_test.py concordia/environment/engines/parallel_questionnaire_test.py
  • . .venv/bin/activate && python -m pytest -q concordia/environment/engines/sequential_test.py concordia/environment/engines/simultaneous_test.py
  • . .venv/bin/activate && python -m pylint --errors-only concordia/environment/engines/sequential_questionnaire.py concordia/environment/engines/parallel_questionnaire.py concordia/environment/engines/questionnaire_utils.py concordia/environment/engines/sequential_questionnaire_test.py concordia/environment/engines/parallel_questionnaire_test.py concordia/environment/engines/questionnaire_utils_test.py

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