Skip to content

feat(artifacts): the run envelope names the dokimi commit that wrote it - #1541

Merged
antonwolfy merged 10 commits into
intel:mainfrom
antonwolfy:fix/commit-in-envelope
Dec 3, 2026
Merged

antonwolfy merged 10 commits into
intel:mainfrom
antonwolfy:fix/commit-in-envelope

Conversation

@antonwolfy

@antonwolfy antonwolfy commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A report from a main install says dokimi_version: 0.2.0, as one from the v0.2.0 release does, and names no commit, so the artifact does not say which dokimi wrote it or whether two reports are comparable. On main at 00a761c, dokimi repo scan <tree> --out repo-readiness.json --json writes {"schema_version": "repo_readiness.v1", "run_id": ..., "dokimi_version": "0.2.0", ...} and a cli_output.v1 document whose summary holds only dokimi_version; git_commit() does not cover it, as it returns None for an installed package.

The envelope of every run artifact now carries dokimi_commit after dokimi_version: the vcs_info.commit_id of the installed distribution's PEP 610 direct_url.json when its vcs is git, it is 40 hex digits and that install is the package that runs (a checkout run in an environment with another dokimi installed does not take the installed one's commit), else the HEAD of the git checkout a source tree runs from when that checkout tracks the tree's pyproject.toml (a source archive extracted under another repository gives null) and the HEAD is 40 digits (a --object-format=sha256 checkout gives null; novelty provenance still records any HEAD), else null (an install from an index). A --json document carries it as summary.dokimi_commit and report summary shows its first 12 digits, so the job summary of repo-eval.yml names it too. The issue's other options (a dev version on main, a VCS-derived version, a line in the workflow) are not taken: the first two change the version every consumer compares or the build backend, the third covers one workflow only.

Closes #1531

Changes

  • dokimi/dokimi_commit.py (new, foundation layer): dokimi_commit() (cached for the process), install_commit() (the PEP 610 record; no file, read_text returning None, bad JSON, a file that is not UTF-8, a dir_info record, a vcs other than git, no vcs_info, a non-string or non-40-hex commit_id and PackageNotFoundError are all None, nothing logged above debug), checkout_commit() (the raw HEAD, found with process.git_env_unpinned(); the envelope takes it through _own_checkout_commit(), which keeps only 40 digits) and source_root(); install_commit() also gives None when the distribution's dokimi directory is not the one this module was imported from. No subprocess runs when the install record names a commit.
  • novelty/provenance.py: git_commit() keeps its behaviour and output; its checkout lookup moved into checkout_commit() so that artifacts can use it without importing a higher layer (novelty is above artifacts).
  • artifacts.py: ENVELOPE_KEYS gains dokimi_commit; envelope() returns {"run_id", "dokimi_version", "dokimi_commit"} for a run kind, typed dict[str, str | None]. Readers of ENVELOPE_KEYS keep it out of what they hash or compare: headroom and novelty_atoms already do through the constant; runner/plan.py's _UNHASHED names it, so a plan's plan_digest does not change with the commit.
  • Schemas: the 51 run-kind schemas (agent_run included, which main added after the first head) declare dokimi_commit as an optional string | null (40 lower-case hex digits; the pattern ends with (?![\s\S]) as run_id's does). Edited in place: this only widens them, so no schema version changes. The nested dokimi_version of catalog_eval and docs_run is not an envelope and is untouched. cli_output.v1 declares summary.dokimi_commit and report_summary.v1 an optional dokimi_commit per check row.
  • cli_output.py: the summary of every --json document carries dokimi_commit; a summary argument naming dokimi_version or dokimi_commit does not replace them.
  • report/summary.py: a row carries dokimi_commit when its document names one; the Markdown shows written by dokimi commit with the first 12 digits above the table, and nothing when no document names one. dokimi_commit is left out of the scalar comparison of two summaries, as dokimi_version is.
  • datasets_export.py: exported rows gain a dokimi_commit column (test_datasets_export requires every ENVELOPE_KEYS entry in a row).
  • Docs: benchmarking-and-comparison.md (the envelope), run-directories.md, skill-novelty.md (analysis_digest leaves it out), the artifacts.py docstrings. Changelog fragment (Added).
  • Tests: test_dokimi_commit.py (the resolver with importlib.metadata.distribution patched, repo scan writing both files, report summary); test_run_envelope.py (key order, null and known commit, schema refusals, the plan digest); test_novelty_provenance.py (git_commit() still gives the checkout's HEAD). Existing tests that pinned the envelope's first three keys now pin the first four: test_run_envelope.py (two), test_writers_save_artifact.py, test_writers_save_artifact_rest.py, test_eval_writers_save_artifact.py, test_runs_rundir.py (also its exact run.json record); test_import_architecture.py lists the new module in the foundation layer.

Risk

Every run artifact and every --json document gains a dokimi_commit key (null for an install from an index). A reader that checks an exact key list of an artifact sees one more key; one that follows the schemas is unaffected, as the key is never required and files written before still validate. Writers now run git rev-parse HEAD once per process in a source checkout (the same call novelty provenance makes); an install from a VCS URL or an index runs no subprocess. datasets export rows gain a column.

Five writers that stamp their own dokimi_version outside the envelope (catalog scan rows, the run manifest, scorecards, the checker block, sweep rows) still record no commit, and two of them compare dokimi_version to decide a --resume: left to #1540, since recording the commit there changes resume behaviour.

Merging with open PRs: #1416 and #1190 change the dokimi.utils import lines of cli_output.py and artifacts.py and conflict with this branch in cli_output.py; #1249 conflicts with main alone in test_import_architecture.py and is its own to rebase. #1527, #1522, #1521, #1515, #1413 and #1406 merge cleanly with this branch.

Testing

On a Linux review host, at 8a62581 (on main badfd39):

  • make ci-local: 38 passed, 0 failed, 16 skipped (docker, micromamba, semgrep, jobs conditional on the PR event or other Python versions). The pytest step: 34510 passed, 28 skipped.
  • codecov's two uncovered lines (dokimi_commit.py 103-104, the OSError branch of _installed_here) are covered by test_an_install_whose_package_directory_cannot_be_located_is_not_the_running_ones, whose distribution's locate_file raises; with that handler changed to another exception type in a copy it fails (PermissionError).
  • main merged in (one conflict, novelty/provenance.py: main's git_commit body and tomllib import against the move into dokimi_commit.py; the delegation is kept). checkout_commit now builds its git environment with main's process.git_env_unpinned() instead of its own copy. test_git_commit_ignores_an_inherited_git_dir now runs from a project checkout and asserts that the project's HEAD is found with a foreign GIT_DIR set (it passed before with None as well); with process.GIT_ENV in a copy it fails.
  • A source archive extracted under another git repository gives dokimi_commit null: checkout_commit requires the checkout to track the pyproject.toml of dokimi's root. test_a_source_archive_under_another_repository_names_no_commit fails with that check removed in a copy.
  • The merge of main brought the agent_run kind, whose schema did not declare dokimi_commit: test_every_run_kind_schema_declares_the_same_envelope[agent_run] failed on the merged tree and passes with f3f30f2; with the old agent_run.v1.json restored in a copy it fails again.
  • The new and changed tests on main's code (with the new module added so that they import): test_dokimi_commit.py 2 failed, 18 passed (KeyError: 'dokimi_commit'); test_run_envelope.py 58 failed, 95 passed; test_runs_rundir.py 1 failed, 66 passed; test_writers_save_artifact.py 13 failed, 6 passed; test_writers_save_artifact_rest.py 3 failed, 17 passed; test_eval_writers_save_artifact.py 6 failed, 5 passed (each on the envelope's key list).
  • 22 mutants, one break per copy, each fails a test: the install record ignored, no checkout fallback, any string taken as a commit, a trailing newline or upper case taken, the checkout read before the record, no cache, a missing record logged as a warning, the envelope writing null, plan_digest hashing the commit, report summary comparing it, showing 13 digits, omitting it or always printing the line, the --json summary without it, the arms schema accepting a newline or refusing null, datasets export without the column, ENVELOPE_KEYS without it, and three on git_commit() (returns None, source root one level off or None).
  • Two more mutants, each fails its test: the checkout HEAD returned without the 40-digit check (test_a_sha256_checkout_names_no_commit_but_novelty_still_reads_its_hash, on a real git init --object-format=sha256 repository), and the installed record read without comparing the package directory (test_an_install_of_another_dokimi_is_not_the_running_ones_commit).
  • Three more mutants, each fails its test: a vcs_info with vcs hg, svn or none still accepted (test_a_record_of_another_vcs_names_no_commit), direct_url.json read outside the guard (test_a_record_that_is_not_utf8_gives_none_and_never_raises, whose distribution raises UnicodeDecodeError), and a caller's summary merged over the two keys (test_a_summary_cannot_override_which_dokimi_wrote_the_document).
  • dokimi repo scan <tree> --out r.json --json on a source checkout writes dokimi_commit in r.json, in data and in summary (the checkout's HEAD).
  • Not run: the other Python versions (3.11, 3.12, 3.14), a real pip install from a VCS URL (the PEP 610 record is mocked), the Windows and docker legs.

Open questions

None.

Revert

A plain revert removes the key from new artifacts and the module. Artifacts already written keep dokimi_commit; the reverted schemas (additionalProperties: false) would refuse those files, so readers of such files should keep the schema change.

Checklist

  • Tests added/updated and pytest passes
  • ruff, mypy, and schema checks pass
  • Docs updated (or N/A) — see the docs-drift checklist in CONTRIBUTING.md
  • Self-reviewed per "Before opening a PR" in AGENTS.md (the author's own diff read and the mutation job run; the REVIEW.md pass is left to the reviewer)
  • Each new raise/exit and test names the doc, contract or issue it traces to
  • No ad-hoc run artifacts committed
  • New files carry the SPDX license header (or are exempt in .github/.licenserc.yaml)

…it (intel#1531)

A report from a main install said `dokimi_version: 0.2.0`, as one from the v0.2.0 release does, and named no commit, so a reader could not tell which dokimi wrote it.

The envelope now carries `dokimi_commit` after `dokimi_version`: the `vcs_info.commit_id` of the installed distribution's PEP 610 `direct_url.json` when it is 40 hex digits, else the HEAD of the git checkout a source tree runs from, else `null`. It is resolved once per process in the new foundation module `dokimi.dokimi_commit`, which also holds the checkout lookup `novelty` provenance's `git_commit()` now calls, so `artifacts` can use it without importing a higher layer. A missing or unusable record is `None`, never an error, and no git process runs when the install record names a commit.

Every run-kind schema declares the key as an optional `string | null`, so an artifact written before still validates. `plan_digest` leaves it out with the rest of the envelope, as `headroom` and `novelty view` already do through `ENVELOPE_KEYS`, and `datasets export` rows gain the column. A `--json` document carries it as `summary.dokimi_commit`, and `report summary` shows its first 12 digits above the table and leaves it out of the scalar comparison of two summaries.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@antonwolfy
antonwolfy requested a review from a team as a code owner December 2, 2026 16:36
@antonwolfy antonwolfy self-assigned this Dec 2, 2026
Copilot AI balanced review requested due to automatic review settings December 2, 2026 16:38
@exai-bot

exai-bot commented Dec 2, 2026 •

Copy link
Copy Markdown

OpenCodeReview: Commit 8a62581 was not reviewed. This PR has reached its review limit (6 reviews).

CI at `8a62581`: 6 still running, 20 passing, 3 skipped
Check Status
Mutation of changed lines still running
Test Linux Python 3.14 still running
Test Linux Wheels Python 3.14 still running
Tests (py3.14) still running
Windows smoke test (py3.13) still running
self / repo tasks check fix-degrade-pre still running

To review this commit: re-request review from exai-bot in the Reviewers list.

Last review (0ca2406): no findings

Open threads from the bot: 0

Comment thread dokimi/dokimi/dokimi_commit.py Resolved
Comment thread dokimi/dokimi/dokimi_commit.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

2 open issues
What changed in this PR

Adds dokimi_commit to run artifacts and CLI JSON output so reports can identify the exact dokimi commit that wrote them (especially for main installs where dokimi_version may match released versions), closing #1531.

Changes:

  • Introduces a commit resolver (dokimi_commit()) that prefers PEP 610 direct_url.json commit IDs, otherwise falls back to the source checkout HEAD.
  • Extends the artifact run envelope and many run-kind schemas to include optional dokimi_commit (string | null).
  • Propagates dokimi_commit into --json documents and report summary output; updates tests/docs accordingly.
File Description
dokimi/​dokimi/​artifacts.py Adds dokimi_commit to run envelope keys and writes it for run-kind artifacts.
dokimi/​dokimi/​cli_output.py Adds summary.dokimi_commit to CLI JSON envelope summary.
dokimi/​dokimi/​dokimi_commit.py New resolver for dokimi commit via PEP 610 or checkout HEAD.
dokimi/​dokimi/​novelty/​provenance.py Reuses shared source-root/checkout commit lookup for git_commit().
dokimi/​dokimi/​report/​summary.py Captures per-document commit and renders commit prefixes in markdown summary.
dokimi/​dokimi/​runner/​plan.py Ensures plan_digest ignores dokimi_commit like other envelope fields.
dokimi/​dokimi/​datasets_export.py Adds dokimi_commit column to exported dataset rows.
dokimi/​dokimi/​commands/​headroom.py Documents that headroom digest excludes the envelope including dokimi_commit.
dokimi/​dokimi/​schemas/​cli_output.v1.json Allows and documents summary.dokimi_commit.
dokimi/​dokimi/​schemas/​report_summary.v1.json Adds optional per-check dokimi_commit field (when present).
dokimi/​dokimi/​schemas/​arms.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​answers.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​catalog_eval.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​checklist.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​cross_judge.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​dashboard.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​delivery.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​docling_sources.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​docs_run.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​effective_instructions.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​eval.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​eval_coverage.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​explore_runs.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​grounding.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​guidance_reach.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​headroom.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​judge_validity.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​judge_wording.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​leak.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​matrix_rollup.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​novelty.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​novelty_atoms.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​novelty_retest.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​opportunities.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​pairwise.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​persona_analysis.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​personas.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​plan.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​plugin_delta.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​question_panel.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​question_quality.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​ragas.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​reach_matrix.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​redteam.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​repo_budget.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​repo_environment.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​repo_hits_judged.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​repo_readiness.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​report_qa.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​result.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​run.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​run_context.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​security_report.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​skill_coverage.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​skill_discovery.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​skill_evidence.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​subject_scorecard.v2.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​task_inspect.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​task_runs.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​dokimi/​schemas/​tool_preference.v1.json Adds optional envelope key dokimi_commit with strict pattern.
dokimi/​tests/​test_dokimi_commit.py New tests for commit resolution, repo scan output, and report summary rendering.
dokimi/​tests/​test_eval_writers_save_artifact.py Updates envelope key order assertions to include dokimi_commit.
dokimi/​tests/​test_import_architecture.py Registers new foundation-layer module dokimi.dokimi_commit.
dokimi/​tests/​test_novelty_provenance.py Ensures git_commit() still returns checkout HEAD after refactor.
dokimi/​tests/​test_run_envelope.py Adds envelope commit tests, schema validation checks, and digest invariants.
dokimi/​tests/​test_runs_rundir.py Updates run.json expectations to include dokimi_commit.
dokimi/​tests/​test_writers_save_artifact.py Updates envelope key order assertions to include dokimi_commit.
dokimi/​tests/​test_writers_save_artifact_rest.py Updates envelope key order assertions to include dokimi_commit.
dokimi/​docs/​benchmarking-and-comparison.md Documents dokimi_commit semantics and its inclusion/exclusion rules.
dokimi/​docs/​run-directories.md Documents run.json envelope now includes dokimi_commit.
dokimi/​docs/​skill-novelty.md Updates analysis_digest description to exclude dokimi_commit.
dokimi/​changelog.d/​20261202_120000_dokimi-commit-in-envelope.md Changelog entry for new envelope field and propagation points.

Review effort: Lite

Comment thread dokimi/dokimi/cli_output.py Resolved
Comment thread dokimi/dokimi/dokimi_commit.py Resolved
… only the install that runs

Settles two review points on intel#1541.

A checkout made with `git init --object-format=sha256` has a 64-digit HEAD, which the run-kind and CLI schemas refuse, so `save_artifact` failed on it. The envelope now takes the checkout HEAD only when it is 40 digits; novelty provenance still records the raw HEAD.

The PEP 610 record of the installed distribution described the installed package even when a checkout was run in an environment that has another dokimi installed. `install_commit` now reads the record only when the distribution's `dokimi` package is the directory this module was imported from; otherwise the checkout's HEAD is used.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@codecov-commenter

codecov-commenter commented Dec 2, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.49%. Comparing base (badfd39) to head (8a62581).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1541      +/-   ##
==========================================
- Coverage   96.50%   96.49%   -0.01%     
==========================================
  Files         539      540       +1     
  Lines       72177    72237      +60     
  Branches    12445    12451       +6     
==========================================
+ Hits        69655    69706      +51     
- Misses       1545     1550       +5     
- Partials      977      981       +4     
Files with missing lines Coverage Δ
dokimi/dokimi/artifacts.py 96.07% <100.00%> (+0.07%) ⬆️
dokimi/dokimi/cli_output.py 100.00% <100.00%> (ø)
dokimi/dokimi/commands/headroom.py 98.90% <ø> (ø)
dokimi/dokimi/datasets_export.py 85.05% <ø> (ø)
dokimi/dokimi/dokimi_commit.py 100.00% <100.00%> (ø)
dokimi/dokimi/novelty/provenance.py 100.00% <100.00%> (ø)
dokimi/dokimi/report/summary.py 95.19% <100.00%> (+0.17%) ⬆️
dokimi/dokimi/runner/plan.py 100.00% <100.00%> (ø)

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread dokimi/dokimi/dokimi_commit.py Resolved
…raising, and not overridable by a summary

Settles the three review threads on intel#1541. A CLI summary can no longer replace dokimi_version or dokimi_commit: envelope() puts them first and drops those two keys from the caller's summary. install_commit() accepts a commit_id only when vcs_info.vcs is "git". The direct_url.json read moves into the guarded block, so a file that is not UTF-8 (UnicodeDecodeError is a ValueError) gives None instead of an exception that stops artifact writing and CLI JSON output.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
main added the agent_run kind after this PR's last head, and its schema declares run_id and dokimi_version but not dokimi_commit, so test_every_run_kind_schema_declares_the_same_envelope[agent_run] failed on the merged tree. The schema now declares the key as every other run kind does.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
Signed-off-by: Anton Volkov <antonwolfy@gmail.com>

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change class: ARCHITECTURAL (head efb4625)

  • Contract: changed. errors dokimi/dokimi/dokimi_commit.py:79; api dokimi/dokimi/artifacts.py:envelope
  • Responsibility: changed. delegate _source_root in dokimi/dokimi/novelty/provenance.py; delegate git_commit in dokimi/dokimi/novelty/provenance.py
  • Dependency: none
  • Review depth: design read: new dependency/responsibility, ask for rationale
  • Coverage gaps: none

1 new must-fix finding. Provenance is carried through the artifact and CLI envelopes. A source archive under a caller Git tree can be stamped with the caller’s commit.

# Finding Severity Provenance Evidence
1 A source archive can stamp the caller’s commit must-fix introduced Reproduced on the head. Compared with the merge base.

Checked the diff, input edges, and focused offline Linux tests (merged: 512 passed in 19.76s).

Comment thread dokimi/dokimi/dokimi_commit.py Resolved
…ckout tracks dokimi's pyproject.toml

A source archive has no .git, and extracted under another repository it read that repository's HEAD as the commit of dokimi. checkout_commit now requires the checkout to track the pyproject.toml of the dokimi root (git ls-files --error-unmatch) and gives None otherwise; this settles review comment 4776274892 and also corrects novelty's git_commit.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@antonwolfy

Copy link
Copy Markdown
Contributor Author

(commented) ### Change class: ARCHITECTURAL (head efb4625)

@napetrov (#1541 (review)): The review body only recaps its single finding, which is the thread 4776274892 above (fixed in 712627c).

@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Mutation of changed lines

⚠️ Not a clean result: some breaks or tests were left out

At 8a62581: 25 caught · 0 missed · 8 inconclusive · 1 timed out · 46 not tried in time

This is not a clean result:

  • 46 breaks were not tried before the time budget ran out
  • 12 more breaks of covered changed lines were over the limit and not tried
  • 75 candidate test files were not run
  • 2 changed lines were not mutated

Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary.

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change class: ARCHITECTURAL (head 712627c)

  • Contract: changed. errors dokimi/dokimi/dokimi_commit.py:83; api dokimi/dokimi/artifacts.py:envelope
  • Responsibility: changed. delegate _source_root in dokimi/dokimi/novelty/provenance.py; delegate git_commit in dokimi/dokimi/novelty/provenance.py
  • Dependency: none
  • Review depth: design read: new dependency/responsibility, ask for rationale
  • Coverage gaps: none

0 new must-fix findings. Nothing to fix in this round. The archive probe now returns a null Dokimi commit inside an unrelated checkout. The original finding is fixed.

Checked the diff, input edges, and focused offline Linux tests (merged: 514 passed in 19.94s). The original archive probe uses a real local Git checkout.

  • Fixed in 712627c7. The nested source archive now has no commit. Earlier thread

@napetrov napetrov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change class: ARCHITECTURAL (head 712627c)

  • Contract: changed. errors dokimi/dokimi/dokimi_commit.py:83; api dokimi/dokimi/artifacts.py:envelope
  • Responsibility: changed. delegate _source_root in dokimi/dokimi/novelty/provenance.py; delegate git_commit in dokimi/dokimi/novelty/provenance.py
  • Dependency: none
  • Review depth: design read: new dependency/responsibility, ask for rationale
  • Coverage gaps: none

Verified the archive provenance fix and ran 567 focused tests against current main. Required checks and the Linux Python 3.14 source and wheel suites passed. The separate source-checkout CI job was interrupted by runner shutdown.

Conflict in dokimi/dokimi/novelty/provenance.py: main added a `tomllib` import and its own `git_commit` body (an unpinned git env, `process.git_env_unpinned()`), while this branch moved `_source_root` and the checkout lookup into `dokimi_commit.py`. Resolved by keeping the branch's delegation (`source_root`, `checkout_commit`) and dropping the `tomllib` import it no longer needs; the next commit makes `checkout_commit` use main's `git_env_unpinned()`.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
…git_env_unpinned

Main now has `process.git_env_unpinned()`, the git environment without GIT_DIR and the other repository overrides, which is what `checkout_commit` built by hand. Use it and drop the duplicate (merge-main point of the review of intel#1541); the behaviour is unchanged.

`test_git_commit_ignores_an_inherited_git_dir` only asserted that the result differed from the foreign HEAD, which a `None` also satisfies once the checkout must own pyproject.toml. It now runs from a real project checkout and asserts that the project's own HEAD is found with a foreign GIT_DIR set.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@antonwolfy

Copy link
Copy Markdown
Contributor Author

(commented) ### Change class: ARCHITECTURAL (head 712627c)

@napetrov (#1541 (review)): No change asked. Re-checked at the merged head: the nested source archive still gives dokimi_commit null (test_a_source_archive_under_another_repository_names_no_commit), and the dokimi_commit.py tests pass after merging main.

@antonwolfy

Copy link
Copy Markdown
Contributor Author

(approved) ### Change class: ARCHITECTURAL (head 712627c)

@napetrov (#1541 (review)): No change asked. The interrupted source-checkout job is the runner's shutdown (see the ci:Tests (py3.14) check); make ci-local on the merged head (0ca2406) passes the full suite: 34509 passed, 28 skipped. This round merged main (one conflict in novelty/provenance.py, kept the delegation to dokimi_commit.py) and made checkout_commit use main's process.git_env_unpinned() in 0ca2406.

@antonwolfy
antonwolfy requested a review from exai-bot December 3, 2026 11:12
…t._installed_here

Settles the codecov concern: lines 103 and 104 of dokimi_commit.py (the OSError branch of `_installed_here`) ran in no test. The new test makes `locate_file` raise and checks that the install record is not trusted and the checkout's HEAD answers.

Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
@antonwolfy

Copy link
Copy Markdown
Contributor Author

Review points answered at 8a62581; CI is green.

No review of this head yet from exai-bot.

@antonwolfy
antonwolfy merged commit adbc208 into intel:main Dec 3, 2026
30 checks passed
@antonwolfy
antonwolfy deleted the fix/commit-in-envelope branch December 3, 2026 12:55
vlad-perevezentsev added a commit to vlad-perevezentsev/dokimi that referenced this pull request Dec 3, 2026
Main's intel#1541 added dokimi_commit to the run envelope that save_artifact
writes, so the saved answers file had a key the in-memory adapter
output has not. The test now strips artifacts.ENVELOPE_KEYS instead of
naming run_id and dokimi_version.

Refs intel#228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
napetrov pushed a commit that referenced this pull request Dec 4, 2026
…ner (#1542)

* fix(gate,eval): a judged retrieval miss counts as a miss

A question whose context arm got no document is unusable in the trust
gate's zero-score fraction and an empty retrieval in the diagnosis only
while it is left unjudged. Judged (`eval score --judge-placeholder`, an
arms run read through the arms adapter, and `evaluate`/`benchmark` once
they answer through ArmRunner, #228 step 4c), its context score is the
plain prompt's: a 60 passed the zero check, and a delta of 0 or more was
diagnosed `docs_helped`.

Count every miss (`retrieval_hit: false`) as unusable in the zero-score
fraction, scored or not, and diagnose a judged miss `empty_retrieval`
whatever its delta. The thresholds are unchanged.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(pipeline): evaluate and benchmark answer and judge through ArmRunner

#228 step 4c. `evaluate` and `benchmark run|batch` answered with the
Answerer and judged with `Judge.evaluate_answers` (Stack P), and gave
other numbers than `arms run` on the same questions. The pipeline now
answers each question in a baseline arm and a docs arm through
ArmRunner, judges them with the same runner, and writes `answers.v1`
and `eval.v1` through the arms adapter (#1148), so their readers stay as
they are (`orchestrator/arm_answering.py`).

This changes numbers (parity rows D2, D4 prompts, D5 and D9's pairs now
shared): ArmRunner's prompts; a question with no document gets a judged
plain-prompt answer instead of the unjudged placeholder; the judge sees
each arm's whole material. Both files carry method version 4;
`answers generate` and `eval score` stay on version 3 until step 6.

- The questions answered so far are kept in `<answers stem>.partial.json`
  (#1004) until the answers file is saved; a crash names the file.
- A run-wide stop saves the answers with their `terminated` block and
  judges nothing, as before.
- `--judge-placeholder` on `evaluate`/`benchmark run` has no effect and
  warns; `--debug-retrieval` copies the docs arm's retrieval counts into
  `retrieval_metadata`.

Test-narrowed: the pipeline no longer reads an answers file back to judge it (the runner that answered judges), so the tests of the stamp it read from one (wrapped, unstamped, malformed, a stale file) have no code left; the pipeline's own stamp is tested in test_the_pipeline_stamps_its_answers_and_eval_with_the_current_version, eval score keeps its stamp tests.
Test-narrowed: evaluate writes no placeholder any more, so the tests that it judges one with --judge-placeholder and leaves it unjudged without are replaced by test_evaluate_judges_a_retrieval_miss_with_or_without_the_flag and test_judge_placeholder_flag_has_no_effect_on_the_pipeline_and_says_so.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(pipeline): a failed checkpoint save fails its run, not a batch

The pipeline's checkpoint was `arms run`'s `_Partial`, whose failed save
exits 2. ArmRunner re-raises it, and `benchmark batch` records a failed
library only on an Exception: one library whose partial file could not
be written ended the whole batch, without its summary.

`pipeline_checkpoint` makes the same file with a save that raises an
OSError naming it, so `evaluate` fails as it did on an unwritable answers
file (exit 1), and `benchmark batch` fails that library and goes on.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(pipeline): a failed answers save names the partial file too

The note that names `<answers stem>.partial.json` was printed only when
answering failed. A failure after every answer was paid for, in the
adapter or in writing the answers file, left the partial file unnamed,
where `arms run` names it on the same failure.

The note now covers everything up to the saved answers file.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(eval): eval score warns that a v4 answers file meets the v3 judge

`eval score pointwise` stamps the eval with the answers file's method
version. On a file `evaluate`/`benchmark` wrote (version 4, judged there
through ArmRunner with each arm's whole material), its judge is still
`Judge.evaluate_answers` (200-character doc snippets, #228 D5), so two
evals of the same answers say 4 with different judge inputs.

The stamp stays the answers' own, which is what it records; the command
now warns that its scores are not comparable with the run's own eval.
Step 6 moves this judge onto the shared stack.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(eval): the diagnosis reads a miss as the trust gate does

The diagnosis had its own test for a retrieval miss, twice: a doc source
of `fallback_none`, `none` or none at all, or no docs. The trust gate
reads `retrieval_hit` (`records._retrieval_hit`): a `fallback_none` or
`none` doc source, or no `retrieved_docs`. A docs answer with no
`doc_source` key was a hit for the gate and a miss for the diagnosis,
so a delta of +10 was `empty_retrieval` and a delta of -3 too.

One `_missed`, the gate's test, now decides both branches: that answer
is `docs_helped` or classified by its relevance.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(pipeline): the judge step prints its progress again

`Judge.evaluate_answers` printed the judge, a line per question and the
averages. Through ArmRunner the step printed "Judging answers..." and
then nothing: a long judge step was silent, and a judge failure showed
only in the log.

The pipeline hands ArmRunner the judge behind a wrapper that prints
`[i/n] <question id> ✓ <score>` per judged answer, or ✗ and the reason,
after the `Evaluating N answers with judge: P/M` line; the averages over
the pairs close the step, as before. ArmRunner (arms run) is unchanged.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(gate): a miss with only one arm scored counts in the zero check

ArmRunner judges the two arms apart, so a retrieval miss can keep its
context score while its baseline judge call fails. Such a row was in
neither the both-arms rows nor the unjudged misses, and the zero-score
check left it out: 10 scored hits and 3 such misses read 0/10, not
3/13.

Count a recorded miss outside the both-arms rows when either arm has a
score or the row has an error.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(eval): the pipeline's eval names its judge protocol

evaluate and benchmark now judge through ArmRunner, which stamps the
arms run with judge_context, but the arms adapter dropped it from the
eval.v1 file. An eval score re-judgement of the same answers (the v3
judge, 200-char snippets) then carried the same method_version 4 and
no protocol either, and model_compare pooled the two.

Carry judge_context into the adapted eval and declare it in eval.v1:
the pipeline's eval says treatment_material.v1, the re-judgement
stays unstamped, and model_compare's judge-protocol check refuses the
pair.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* test(gate): pin a miss whose baseline answer failed in the zero check

A miss whose baseline answer failed keeps its context score and has
no error in the eval row (the answers file records it), so only the
context-score clause of _unpaired_miss counts it. The test now covers
that shape beside the failed baseline judge call.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(pipeline): judge progress names the question the runner judged

The progress lines of the judge step looked the question id up by its
text, so two questions with the same text both printed the last one's
id. ArmRunner.judge now takes an on_score callback that gets the
record's question id, the arm and the score after each judge call, and
the pipeline prints its progress from there instead of wrapping the
judge.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* test(pipeline): the adapter parity test skips the whole run envelope

Main's #1541 added dokimi_commit to the run envelope that save_artifact
writes, so the saved answers file had a key the in-memory adapter
output has not. The test now strips artifacts.ENVELOPE_KEYS instead of
naming run_id and dokimi_version.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(pipeline): evaluate and benchmark keep their ask questions

The arms adapter left ask questions out of the answers and eval
payloads, which #1406 meant for a run whose arms file keeps them. The
pipeline saves no arms file, and it drops its checkpoint once the
answers file is saved, so an ask question's replies and ask-rubric
grades were paid for and lost. Before #228 step 4c the answerer and
the judge kept these rows, stamped expected_outcome: ask, and the
readers leave them out of the headline.

The adapter keeps them so, and the judge step prints how many it left
out of its averages, as Judge.evaluate_answers did.

Refs #228
Test-narrowed: to_binary keeps ask rows now, so test_to_binary_leaves_ask_questions_out_of_both_payloads is replaced by test_to_binary_keeps_ask_questions_stamped_in_both_payloads and the pipeline test test_an_ask_question_keeps_its_rows_and_stays_out_of_the_averages.

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

---------

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

repo scan: a report from a main install names dokimi 0.2.0 and no commit, so the artifact does not say which dokimi wrote it

5 participants