Address review feedback on add_subtask_response script#173
Merged
shuheng-liu merged 2 commits intoApr 22, 2026
Conversation
- Fix docstring example to reference add_subtask_response.json (not pi05_subtask.json, which does not exist). - Replace module-level logging.basicConfig with init_logging() called inside the main entrypoint, matching the project-wide convention used by train.py, inference.py, calculate_value.py, etc. - Remove personal path from the example config; use /path/to/local/dataset like the tutorial docs. - Make parquet writes atomic via tmp file + os.replace so a crash mid-write cannot corrupt the source parquet. - Switch warnings.warn to logger.warning for operational events (missing files, length mismatches) and emit a warning when an existing 'response' column is overwritten. - Use slice assignment in _build_response_array and round() instead of int() for boundary mapping to avoid floating-point drift (e.g. 2.5 * 30 = 74.999... truncating to 74). - Tighten type hints on subtasks parameter. - Add unit tests for _build_response_array covering empty subtasks, zero-length episodes, whole-episode coverage, boundary split, pre-first-subtask gap, last-subtask extension, unsorted input, beyond-length warning, clamping, and fp-drift rounding. https://claude.ai/code/session_01WnAY2eqQqw6aRQqKS5jvGC
Pre-commit hook flagged a long-line reformat in test_zero_length_episode. https://claude.ai/code/session_01WnAY2eqQqw6aRQqKS5jvGC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Addresses review feedback on #163. Targets
feat/subtask_addition_scriptso the fixes land inside that PR.configs/examples/add_subtask_response.json(the file actually shipped), not the non-existentpi05_subtask.json.logging.basicConfig(...)withinit_logging()called inside the main entrypoint. Matches the dominant convention acrosssrc/opentau/scripts/(train.py,inference.py,calculate_value.py, etc.).configs/examples/add_subtask_response.json; use/path/to/local/datasetlike the tutorial docs..tmpsibling +os.replace) so a crash mid-write can't corrupt the source parquet.warnings.warn→logger.warningfor operational events (missing files, length mismatches) and emit a warning when an existingresponsecolumn is silently overwritten._build_response_array: use slice assignment and switchint()→round()for boundary mapping to avoid floating-point drift (e.g.2.5 * 30 = 74.999…truncating to 74 instead of 75).list[dict]→list[dict[str, float | str]].tests/scripts/test_add_subtask_response.pycovering: empty subtasks, zero-length episode, whole-episode coverage, boundary split, pre-first-subtask gap, last-subtask extension, unsorted input, beyond-length skip + warning, end-frame clamping, fp-drift rounding, and simultaneous-time edge case.How it was tested
tests/scripts/test_add_subtask_response.pywith unit tests for_build_response_array.How to checkout & try? (for the reviewer)
python src/opentau/scripts/add_subtask_response.py \ --config_path=configs/examples/add_subtask_response.jsonChecklist
https://claude.ai/code/session_01WnAY2eqQqw6aRQqKS5jvGC