Skip to content
Merged
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
10 changes: 8 additions & 2 deletions plugins/codex-trajectory/tests/test_read_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,18 @@ def limit_in_thread(limit: int) -> int:
assert sessions.jsonl_byte_limit() == sessions.MAX_JSONL_TOTAL_BYTES


@pytest.mark.parametrize("unrelated_first", [True, False])
def test_task_budget_does_not_expand_unrelated_metadata_reads(
codex_home: Path, monkeypatch: pytest.MonkeyPatch
codex_home: Path, monkeypatch: pytest.MonkeyPatch, unrelated_first: bool
) -> None:
unrelated = write_rollout(
codex_home / "sessions" / "rollout-other.jsonl", rollout_events("other-task")
)
selected = codex_home / "sessions" / "2026" / "rollout-alpha.jsonl"
# Discovery uses mtime, which can tie on Windows. Exercise both scan orders
# explicitly instead of assuming the file just created will appear first.
paths = [unrelated, selected] if unrelated_first else [selected, unrelated]
monkeypatch.setattr(projection, "session_files", lambda include_archived: paths)
original = projection.first_session_metadata
limits: list[int] = []

Expand All @@ -221,7 +227,7 @@ def metadata(path: Path) -> dict[str, Any]:
"get_codex_trajectory", {"sessionId": "session-alpha", "maxReadBytes": 3_000_000_000}
)
assert result["structuredContent"]["session"]["id"] == "session-alpha"
assert limits and all(limit == sessions.MAX_JSONL_TOTAL_BYTES for limit in limits)
assert limits == ([sessions.MAX_JSONL_TOTAL_BYTES] if unrelated_first else [])


def test_read_limit_schema_exposed_only_on_selected_task_reads() -> None:
Expand Down
Loading