From 1f4eaec88a469e1bae3706f33f0fd87dc591fc89 Mon Sep 17 00:00:00 2001 From: Teknium <127238744+teknium1@users.noreply.github.com> Date: Wed, 22 Jul 2026 11:04:49 -0700 Subject: [PATCH] test(cron): assert no-rotation tip resolution is a finalize no-op With compression.in_place defaulting True the cron session id never rotates; get_compression_tip returns the input id. Pin that the salvaged #67188 fix titles/ends the ORIGINAL cron session in that path (and for falsy tip returns), i.e. zero behavior change when no compression rotation happened. Also maps colingreig's contributor email for attribution CI. --- contributors/emails/colin@colingreig.com | 1 + tests/cron/test_scheduler.py | 35 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 contributors/emails/colin@colingreig.com diff --git a/contributors/emails/colin@colingreig.com b/contributors/emails/colin@colingreig.com new file mode 100644 index 000000000000..9599d601801c --- /dev/null +++ b/contributors/emails/colin@colingreig.com @@ -0,0 +1 @@ +colingreig diff --git a/tests/cron/test_scheduler.py b/tests/cron/test_scheduler.py index bf99f4153ad3..ee666317b48a 100644 --- a/tests/cron/test_scheduler.py +++ b/tests/cron/test_scheduler.py @@ -1205,6 +1205,41 @@ class TestRunJobSessionPersistence: tip_session_id, "cron_complete" ) + @pytest.mark.parametrize("tip_value", ["__same__", None, ""]) + def test_run_job_no_rotation_finalizes_original_session_id( + self, tmp_path, tip_value + ): + """No-op path: with compression.in_place defaulting True, the session + id never rotates. get_compression_tip returns the input id (or a + falsy value); title + end_session must target the ORIGINAL cron id — + byte-for-byte the pre-fix behavior.""" + job = { + "id": "no-rotation-job", + "name": "No rotation", + "prompt": "hello", + } + + with self._run_job_patches(tmp_path) as (fake_db, mock_agent_cls): + if tip_value == "__same__": + fake_db.get_compression_tip.side_effect = ( + lambda session_id: session_id + ) + else: + fake_db.get_compression_tip.return_value = tip_value + + success, _output, _final_response, error = run_job(job) + + assert success is True + assert error is None + original_session_id = mock_agent_cls.call_args.kwargs["session_id"] + fake_db.get_compression_tip.assert_called_once_with(original_session_id) + assert ( + fake_db.set_session_title.call_args.args[0] == original_session_id + ) + fake_db.end_session.assert_called_once_with( + original_session_id, "cron_complete" + ) + @pytest.mark.parametrize( ("agent_session_id", "expected_suffix"), [("agent-live-tip", "agent-live-tip"), ("", "original")],