Skip to content

[eval][cli] fix: harden source digest, rubric parsing, and secret redaction - #458

Open
JoyboyBrian wants to merge 4 commits into
mainfrom
brian/fix-digest-rubric-redact
Open

JoyboyBrian wants to merge 4 commits into
mainfrom
brian/fix-digest-rubric-redact

Conversation

@JoyboyBrian

@JoyboyBrian JoyboyBrian commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What

  • source_digest (osmosis_ai/source_scan.py) length-prefixes extra, each relative path, and each file's contents before hashing, so different source trees can no longer hash the same byte stream (previously {"ab": b"c"} and {"a": b"bc"} produced the same digest).
  • extract_assistant_content (osmosis_ai/eval/rubric/dataset.py) skips non-dict entries in messages, so a row like {"messages": [1]} reports the usual line-numbered CLIError instead of raising AttributeError with a traceback.
  • Secret redaction (osmosis_ai/platform/cli/secret_redact.py) routes string values, dict keys, and redact_secret_text through one helper that replaces the whole string with [REDACTED] when the marker would join its neighbours into the secret again (for example "]]]" with the secret "]]" previously became "[REDACTED]]"), and with an empty string when the secret is part of the marker itself (for example "RE"). redact_provided_secrets now replaces all secrets in each string and checks the result against all of them, so one secret's marker cannot rebuild another ("yx" with secrets "]x" and "y" previously became "[REDACTED]x").
  • One regression test per fix.

Why

These came out of writing "fuzz test as spec" style properties for pure-Python trust-boundary functions: the digest should be injective over source trees, rubric loading should fail only with CLIError, and redacted output should never contain the secret. Each property was violated by a small, concrete input.

The digest collision matters most: the same digest keys the Harbor bundle wheel cache, pins the resume lock of named local eval runs, and is recorded as source_digest in uploaded eval manifests, so a collision could reuse a stale bundle or let a run resume across a code change.

Compatibility: digest values change for every project. The Harbor bundle cache misses once and rebuilds. A named local eval run created by an earlier SDK refuses to resume after upgrading, reporting that the rollout source changed. Newly uploaded manifests carry the new digest values. No public API changes; I did not mark this [BREAKING], but the release notes should mention the resume impact.

How to Test

  • uv run pytest tests/unit/eval/local tests/unit/test_packaging.py tests/unit/test_rubric_cli_command.py tests/unit/platform/cli/test_secret_redact.py tests/unit/rollout/test_harbor_backend.py → 754 passed.
  • After the marker follow-up: uv run pytest tests/unit/platform/cli tests/unit/cli → 1528 passed.
  • uv run ruff check . and uv run ruff format --check . → pass.
  • uv run ty check --error-on-warning osmosis_ai/ → pass.
  • git diff --check origin/main...HEAD → clean.
  • Full pytest -n 4 --dist worksteal locally: 3733 passed, 11 failed, all in tests/unit/test_dependency_security.py::test_wheel_verifier_checks_allowed_versions. My local environment has stale installed osmosis-ai metadata from before [misc] fix: require patched certifi and uv trust stores #457 (uv<0.13,>=0.9.7), which the wheel verifier reads; unrelated to this diff, CI builds fresh metadata. test_a_second_interrupt_during_server_shutdown_cuts_its_grace_short failed once under xdist and passed on rerun.
  • Not run locally: uv run --no-editable pyright --verifytypes osmosis_ai --ignoreexternal (no public API changes); left to the typecheck-pyright CI job.

Checklist

  • PR title follows [module] type: description format
    (labels are derived from it automatically — no need to add them by hand)
  • ruff check . and ruff format --check . pass
  • ty check --error-on-warning osmosis_ai/ passes; uv run --no-editable pyright --verifytypes osmosis_ai --ignoreexternal has no unexpected errors (see CONTRIBUTING.md for the Harbor baseline)
  • pytest passes (new tests added if applicable)
  • Public API changes are documented
  • No secrets or credentials included

…action

- source_digest length-prefixes extra, paths, and contents, so trees such as {"ab": "c"} and {"a": "bc"} no longer share a digest. Digest values change: the Harbor bundle cache misses once, and named local eval runs created by an earlier SDK refuse to resume.
- Rubric datasets skip non-dict entries in "messages" and report a CLIError with the line number instead of raising AttributeError.
- Secret redaction replaces the whole string when the "[REDACTED]" marker would join its neighbours into the secret again.
@JoyboyBrian
JoyboyBrian requested a review from BaiqingL as a code owner October 23, 2026 03:37
@github-actions github-actions Bot added bug Something isn't working cli CLI related eval Eval/Rubric evaluation labels Oct 23, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-23T03:40:19.940184Z 3cc78d7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 6 files

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread osmosis_ai/platform/cli/secret_redact.py Outdated
Comment thread osmosis_ai/eval/rubric/dataset.py
Comment thread osmosis_ai/platform/cli/secret_redact.py Outdated
@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

A secret that is part of "[REDACTED]" (for example "RE") survives any marker-based replacement, so the fallback returns an empty string in that case.

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 6 files

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread osmosis_ai/platform/cli/secret_redact.py Outdated
Redacting one secret at a time let a later secret's marker rebuild an earlier one (secrets "]x" and "y" turned "yx" into "[REDACTED]x"). Each string is now replaced for all secrets and then checked against all of them before the fallback applies.

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 6 files

Heads up: you’re close to your included review allowance. Set a flex budget so reviews don’t pause.

View guided diff | Turn on auto-fix | Re-trigger cubic

Comment thread osmosis_ai/platform/cli/secret_redact.py
Values under "value", "secret" and "secret_value" were set to a bare "[REDACTED]", so a secret contained in the marker (for example "RE") still appeared there. They now go through the same check as other redacted strings.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cli CLI related eval Eval/Rubric evaluation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant