Repository navigation
fix(readers): memory lint, trace subagents and the BenchFlow, Harbor and command cells name a directory they cannot list #1635
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
antonwolfy
wants to merge
6
commits into
intel:main
Choose a base branch
from
antonwolfy:fix/unlistable-root-readers
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+549
−48
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5e23184
fix(memory): memory lint refuses a memory directory it cannot list (#…
antonwolfy 6229669
fix(trace): a subagents directory that cannot be listed is a session …
antonwolfy 19fb83f
fix(harnesses): a jobs or job directory that cannot be listed is the …
antonwolfy 032345a
fix(harnesses): keep the unlistable jobs directory in a timed-out Ben…
antonwolfy d306e4c
fix(harnesses): a command cell lists its output dir without an is_dir…
antonwolfy e017dec
fix(harnesses): a vanished or unreadable reward path is a named error
antonwolfy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
dokimi/changelog.d/20261204_120000_unlistable-root-readers.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| ### Fixed | ||
|
|
||
| - **`memory lint` refuses a memory directory it cannot list.** `read_claude_memory` found the topic files with a glob, which gives nothing for a directory without list permission, so the store linted as an empty one, with no topic files and no findings. It now exits 2 with `<dir>: cannot list the memory directory: <reason>`. A missing or non-directory path still gives `not a directory` ([#1506](https://github.com/intel/dokimi/issues/1506)). | ||
| - **`trace` names a session's `subagents` directory it cannot list.** `subagent_files` listed the transcripts with a glob, so such a directory read as no subagents and their tool calls were missing from the session. It now raises `SessionError` (`cannot read <dir>: <reason>`); `read_session_tree` keeps the parent session's events and records the error on the session, so `trace prefilter` warns on stderr and reports the status `partial`. A session with no `subagents` directory is unchanged ([#1508](https://github.com/intel/dokimi/issues/1508)). | ||
| - **The BenchFlow and Harbor result readers name a jobs or job directory they cannot list.** `rollout_dirs`, `rollout_results` and `read_harbor_job` found the rollouts with globs, which give nothing for such a directory, so the cell read as one that wrote no result (`harbor: no Harbor result.json`). The cell's `metrics.error` is now `benchflow: cannot list <dir>: <reason>` or `harbor: cannot list <dir>: <reason>`, with no reward (after a BenchFlow timeout it follows the timeout error, after `; `); a missing jobs directory still has no rollout. A command cell's output directory is read the same way: a directory under it that cannot be listed gives `solver_error: no verdict: cannot list <dir>: <reason>`, where a reward file in it was missed and the exit code read as the reward. A directory that disappears while the output directory is walked gives the same `cannot list <dir>` error instead of an output directory with no reward, and a reward file that is listed but cannot be read gives `solver_error: no verdict: cannot read <file>: <reason>`. After a BenchFlow timeout, the rollout containers under the job directories that can be listed are still removed when another job directory cannot be listed ([#1509](https://github.com/intel/dokimi/issues/1509)). |
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Copyright (C) 2026 Intel Corporation | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """The rollout files of a BenchFlow or Harbor jobs dir (``<jobs>/<job>/<trial>/...``). | ||
|
|
||
| A missing jobs dir has no rollout. A jobs dir or a job dir that cannot be listed raises its OSError, which names it, | ||
| where a glob gave nothing and the cell read as one that wrote no result (#1509). | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| from pathlib import Path | ||
|
|
||
| from dokimi.digest_entries import children_matching | ||
|
|
||
|
|
||
| def result_files(directory: Path) -> list[Path]: | ||
| """``directory/<child>/result.json`` for each child that holds an entry of that name, as ``directory.glob("*/result.json")`` | ||
| finds them, except that a directory that cannot be listed or a child that cannot be searched raises its OSError.""" | ||
| found = [] | ||
| for child in children_matching(directory, "*"): | ||
| try: | ||
| (child / "result.json").lstat() | ||
| except (FileNotFoundError, NotADirectoryError): | ||
| continue | ||
| found.append(child / "result.json") | ||
| return found | ||
|
|
||
|
|
||
| def rollout_dirs(jobs_dir: Path) -> list[Path]: | ||
| """Every rollout dir (``<job>/<task>__<id>``) under a jobs dir, whether or not it got as far as a ``result.json`` | ||
| (a kill or a hard deadline leaves none).""" | ||
| return sorted(p for job in children_matching(jobs_dir, "*") for p in children_matching(job, "*__*") if p.is_dir()) | ||
|
|
||
|
|
||
| def rollout_results(jobs_dir: Path) -> list[Path]: | ||
| """Every rollout ``result.json`` under a BenchFlow jobs dir, oldest first.""" | ||
| found = [path for job in children_matching(jobs_dir, "*") for path in result_files(job)] | ||
| return sorted(found, key=lambda p: p.stat().st_mtime) | ||
|
|
||
|
|
||
| def harbor_results(jobs_dir: Path) -> tuple[list[Path], bool]: | ||
| """``(<job>/<trial>/result.json files, whether a <job>/result.json exists)`` under a Harbor jobs dir.""" | ||
| jobs = children_matching(jobs_dir, "*") | ||
| return sorted(path for job in jobs for path in result_files(job)), bool(result_files(jobs_dir)) | ||
|
|
||
|
|
||
| def look_for_rollouts(jobs_dir: Path) -> tuple[list[Path], int, str | None]: | ||
| """``(result.json files, rollout dir count, error)``: a jobs or job dir that cannot be listed is the cell's error | ||
| naming it, not a cell with no result.json.""" | ||
| try: | ||
| return rollout_results(jobs_dir), len(rollout_dirs(jobs_dir)), None | ||
| except OSError as exc: | ||
| return [], 0, f"benchflow: {cannot_list(exc, jobs_dir)}" | ||
|
|
||
|
|
||
| def cannot_list(exc: OSError, fallback: Path | None) -> str: | ||
| """``cannot list <dir>: <reason>`` for the OSError of a listing: the directory it names, else ``fallback``.""" | ||
| return f"cannot list {exc.filename or fallback}: {exc.strerror or exc}" |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.