Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/runner_lib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ def _completion_was_unproductive(prior: dict[str, Any] | None) -> bool:
pre-#3433 behavior (treat the completion as terminal) rather than silently loosening the
debounce for every caller that has not been taught to report it.
"""
return bool(prior) and prior.get("productive") is False
return prior is not None and prior.get("productive") is False


def _unproductive_completion_count(prior: dict[str, Any] | None) -> int:
Expand Down
18 changes: 18 additions & 0 deletions tests/scripts/test_runner_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,24 @@ def fail_check_call(
assert Path(clone_env["GIT_ASKPASS"]).exists() is False


@pytest.mark.parametrize(
("prior", "expected"),
[
(None, False),
({}, False),
({"productive": None}, False),
({"productive": True}, False),
({"productive": False}, True),
({"productive": 0}, False),
({"productive": "false"}, False),
],
)
def test_completion_productivity_requires_explicit_false(
prior: dict[str, Any] | None, expected: bool
) -> None:
assert runner_core._completion_was_unproductive(prior) is expected


def _unproductive_result() -> RunnerResult:
"""A run that exits 0 having done nothing — the shape the codex sandbox failure takes."""
return RunnerResult(
Expand Down
Loading