Skip to content

fix(evaluations): the graded agent no longer sees who graded it (abilityai/trinity-enterprise#781) - #3936

Merged
vybe merged 3 commits into
devfrom
AndriiPasternak31/ent781
Oct 26, 2026
Merged

vybe merged 3 commits into
devfrom
AndriiPasternak31/ent781

Conversation

@AndriiPasternak31

@AndriiPasternak31 AndriiPasternak31 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes abilityai/trinity-enterprise#781

Evaluation reads expose an admin grader’s username or email to machine principals and shared non-operators. Reuse the evaluation integration branch’s allowlist projection: exact non-person names remain visible, other supported evaluator forms reduce to their kind, and unrecognised bare values become unknown. Human owners and admins retain the full evaluator through JWT or their own user-scoped key.

Storage and write behaviour are unchanged. Adopt the issue regression verbatim, test all three GET routes, and extend the census across statically named calls to the known admin and Workspace writer APIs.

Known limitation: arbitrary admin judge and checks dictionaries retain their current visibility. The evaluation integration branch withholds judge from machines; it does not generally sanitize arbitrary admin checks. Record Andrii’s chosen tracking/disposition before publication.

Deliberate divergence from the integration branch: redact_evaluator adds one marked dev-only guard: a kind is shown only when it is an identity-free token ([a-z0-9_-]+), and anything else reads unknown, so a stored [email protected]:admin cannot leak the address as its kind. When feature/agent-behavioral-eval reaches dev, the merge must keep this guard (or carry it into that branch's copy).

Merging feature/agent-behavioral-eval into dev later:

  • src/backend/routers/evaluations.py, first conflict (imports): keep both from services.agent_service.helpers import accessible_agent_names, narrow_to_agent and from services import evaluation_read_service. Dropping the first makes all three GET routes raise NameError.
  • src/backend/services/evaluation_read_service.py: take the integration copy, then re-insert the # --- DEV-ONLY GUARD (ent#781 security review): begin … end block (and its _IDENTITY_FREE_KIND regex) immediately after kind, sep, _ = name.partition(":") in redact_evaluator.
  • tests/unit/test_937_projection.py: take theirs; it is a strict superset of this file. tests/unit/test_937_ent781_census.py: keep this census (four sites, three writer APIs) and add any driver the integration's writers need. Keep tests/unit/test_ent781_read_routes.py.

Validation:

  • Targeted set (test_937_projection, test_937_ent781_census, test_ent781_read_routes, test_ent366_workspace_ratings, test_206_agent_evaluations, test_ent872_fleet_reach, test_ent499_problem_report, test_3521_problem_report_comment): 285 passed under pytest-randomly seeds 11 and 22. The three new files alone: 115 passed.
  • Seeded unit island (tests/unit, seed 12345, -m "not slow", before the round-2 guard): 28003 passed, 4 failed, 21 errors. All 25 are pre-existing and environmental, with the same 4 + 21 on a clean dev copy. The 4 are test_ent679_payments_pin_parity, where the local venv's package versions are older than the image pins. The 21 are the test_ec_operator_queue_* fixtures, which require a DB path containing trinity-unit-tests; with one, those files pass (156 passed).
  • Backend unit tier, CI's command on Python 3.13.7 (clean snapshot: no .env, no submodules), seed 12345, on the final tree including the round-2 guard: 27980 passed, 0 failed, 0 errors, including test_937_ent781_census 23, test_937_projection 16, test_ent781_read_routes 76 and test_ent366_workspace_ratings 47. Across that cross-branch run the only red is a pre-existing timing flake on unmodified dev (test_ent879_aauth_resource_route, seed 67890; 8 of 2000 isolated repeats fail), on no branch.
  • tests/lint_sys_modules.py and tests/lint_root_test_placement.py: OK.

Regression evidence (red on clean dev, before the fix): 56 of 85 behavioural cases fail, every one on the disclosed grader address. No case fails on a 401/404, import or fixture error.

  • test_937_projection.py: test_a_machine_never_learns_which_admin_graded_it 2/2 red (AssertionError: admin:[email protected]), and test_admin_grade_reads_as_the_kind_to_a_non_operator_human 1/1 red.
  • test_937_ent781_census.py::test_no_writer_names_its_grader_to_a_machine: 8/16 red (the two admin-writer sites × four machine readers). The 8 workspace/operator cases are green controls.
  • test_ent781_read_routes.py: 45/56 red. That includes test_read_routes_hide_admin_identity 9/9, where each GET returns 200 with ['admin:[email protected]'].
  • The malformed-kind cases (round 2): 16/20 red without the guard, with the 4 controls green. Removing only the guard on a scratch copy turns exactly those 16 red.
  • Reverting only the router on a scratch copy re-reds the same 56, plus the ent366 bare-name pin.
  • The census's structural guard (test_every_call_site_has_a_driver) and its 6 negative controls (an unregistered site, a second call in a registered function, a removed site, an empty inventory, malformed source and undecodable source) are green. They are guards, not red evidence.

Journey Impact: none — repairs grader visibility on existing evaluation reads; adds no journey or product workflow.

…ityai/trinity-enterprise#781)

Evaluation reads project the evaluator through an allowlist: an operator reads the full grader, a machine or non-operator reader gets only the kind. The redaction leaf is byte-identical to the integration branch's, plus a guard that rejects a malformed kind so an address can never ride through the kind field.

@dolho dolho 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.

Thanks, this is a clean fix. The two-prefix denylist becomes a single allowlist projection in evaluation_read_service.redact_evaluator, and every read path picks it up through _to_response. I checked that the router is the only place evaluator is read and served on dev, so the fix covers every read path.

Verification on my side: the targeted set passes (172). Reverting only the router turns 77 cases red, and disabling only the kind-grammar guard turns exactly 16 red, which matches your evidence. The new tests drive the real routes and writers rather than pinning source text.

A few small follow-ups, none blocking:

  • The body uses Refs abilityai/trinity-enterprise#781. Please switch to Fixes abilityai/trinity-enterprise#781 for traceability; ent#781 will still need a manual status-in-dev after merge, since it is in the other tracker.
  • The body still has the draft line "Record ... tracking/disposition before publication." Please file or link an issue for the unredacted judge/checks dictionaries and replace that line with the reference.
  • The DEV-ONLY guard depends on whoever merges feature/agent-behavioral-eval keeping it. A note on ent#937 or on that branch's PR would make it harder to lose.
  • For the record: a bare tier0 evaluator now reads unknown. No current writer emits it, so this seems fine.

Approving.

@vybe

vybe commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

merge-train 2026-10-26: pushed b467a231a to this branch — a merge of dev resolving the two append conflicts left by #3935 landing first: docs/memory/feature-flows.md (kept both index rows, ent#781 above ent#717) and tests/registry.json (rebuilt from the git stages, no entry dropped). No code change. Also patched the body Refs → Fixes abilityai/trinity-enterprise#781 (validation: all five ACs met). One item still yours, @AndriiPasternak31: the draft line in the body about where the judge/checks follow-up is tracked — please replace it with the issue link.

@vybe
vybe merged commit 85cdacb into dev Oct 26, 2026
25 checks passed
vybe pushed a commit that referenced this pull request Oct 26, 2026
…y.json rebuilt from stages (#3946)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
webmixgamer added a commit that referenced this pull request Oct 26, 2026
Conflicts (both sides appended): docs/memory/feature-flows.md (kept both index
rows, newest first) and tests/registry.json (kept both; every entry three-way
checked). #3936 and #3946 add no route this census sees as a hand-copied
self-gate and do not reference the old AGENT_CALLABLE table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

4 participants