Repository navigation
fix(#936): refresh stale test expectations for #665, #898, #474 - #940
Merged
Merged
Conversation
Several integration tests were asserting pre-change behaviour: - tests/test_agent_timeout.py — default execution_timeout_seconds was raised from 900 → 3600 in #665. Rename test_get_timeout_default_is_900 and update the expected value. - tests/integration/test_monitoring_service.py — /health-specific override in monitoring_service.py treats ReadTimeout, ReadError, and PoolTimeout as agent liveness signals and DOES record_failure() on the per-agent circuit. Rename the three `_does_not_record_` tests to `_records_failure` and flip the assertion from 0 → 1. The docstrings now point at the explicit /health-specific handlers rather than the unrelated TRANSIENT_TRANSPORT_EXCEPTIONS contract. - tests/test_agent_files.py — POST /api/agents/{name}/files/mkdir (#898) is the first test in the file that requires the agent container to be visible to the backend Docker SDK before the request, not just the row marked status=running. Add a small _wait_for_container_ready helper that polls /files until the container is visible (probe returns anything other than 404) and call it in the two TestCreateFolder tests that actually hit the endpoint (test_create_folder_and_list, test_create_folder_duplicate_returns_409). The other three tests in the class fail-fast before the container check (deny-list 403, nonexistent-agent 404, unauth 401) and don't need the wait. No production code changes — tests only.
trinity-ability
pushed a commit
that referenced
this pull request
Oct 18, 2026
…ent#940 CP-D2) TD-2 (ent#935 addendum A, owned by #940): Tier-0 now grades fan_out, loop and reminder runs when another agent sent them (source_agent_name set); the same triggers without a sender, and 'user', stay ungraded. One rule, db.evaluations.tier0_eligible, is applied by both the candidate query and evaluate_execution. Without it a fan-out child had no Tier-0 row and hence no pair row, so the pair scorecard could not see a fan-out edge. recent_series_metrics keys a sourced non-schedule run on (agent_name, triggered_by, source_agent_name, playbook), as ruled; an unsourced agent run keeps its ent#935 key. TD-3 (series_key AND Jaccard >= 0.9, loop and distinct fan-out tasks excluded) is unchanged from CP-A; the end-to-end test pins a fan-out of three as three pair rows with no duplicate_dispatch fail. No excluded-trigger list in tests/ pinned these triggers; no test outside the 935/937/938/940 files reads the changed identifiers. Refs abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]>
vybe
added a commit
that referenced
this pull request
Oct 27, 2026
…, the pair's own rates in Delegated pairs, week-over-week Outcomes (Abilityai/trinity-enterprise#938, #940, #941, #74) Gaps found auditing the branch against the issue threads: * Delegated pairs showed the callee runs' Tier-0 pass rate as the edge's number. The row now reads the group's `pair` block (graded, pair-check pass rate, top failed pair check), and a failed run lists its `pair_failed_checks` beside its Tier-0 ones, marked as the pair's. * The execution page listed only failed gates and knew nothing of the judge or the hand-off. New `GET …/executions/{id}/evaluations` returns the run's Tier-0, judge and pair rows in one read, under the singular route's gate and the one per-caller projection (an agent key still reads findings and reason codes, never a score). ExecutionChecks lists every gate with its outcome, the judge's quality out of 5 with each dimension's verdict and reason (or why the run was skipped), and the hand-off's checks with the caller named. * Outcomes had the weekly history stored and never read it. The store reads `…/analyses`; each fleet tile says how it moved against last week, the project rows carry the done-count movement, and a Week by week line plots the fleet's rates once two weeks exist. A failed history read leaves the deltas at "no earlier week" and nothing else. * An anomaly alarm on the Needs Response card links to the agent's Schedules tab, where the incident's evidence is (the alarm text pointed to a page that does not exist; fixed in the enterprise module). Tests: test_938_run_evaluations (6), census entry; executionChecks (+5), evaluationsPanel (+2), outcomesPanel (+3), queueCardAnomalyLink (2). Co-Authored-By: Claude Fable 5.1 <[email protected]>
vybe
added a commit
that referenced
this pull request
Oct 29, 2026
…first-read receipt, delegated-trigger grading (ent#940) (#3794) * feat(eval): pair evaluator checks 1-5 + platform writer evaluator= fence (ent#940 CP-A) Layer 1, checkpoint A of Abilityai/trinity-enterprise#940. - db/evaluations: TIER0_PAIR_EVALUATOR + PLATFORM_EVALUATORS; evaluator= kwarg (default Tier-0, ValueError otherwise) threaded through upsert_platform_evaluation / insert_platform_evaluation_if_absent / latest_tier0_for_execution; unevaluated_pair_execution_ids. - db/activities: collaboration_rows_for_executions (chunked IN). - db/schedules/executions: sibling_executions (cap+1) + pair_rework_series. - database.py facade lines for all five. - services/tier0_pair_evaluator: dispatch_exists, one_sided_record, duplicate_dispatch, resend_after_receipt, wrong_route + build_context + evaluate_pair. No migration. - test_935_write_fence allowlist += the pair evaluator (additive); test_935_tier0_writer's private-method stub forwards the new argument. Mutation: removing the PLATFORM_EVALUATORS refusal turns test_the_writer_refuses_an_evaluator_outside_the_closed_set red (4/4). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair checks 6-9 + caller_running re-pick (ent#940 CP-B part 1) Layer 1, checkpoint B (sub-part 1) of Abilityai/trinity-enterprise#940. - services/tier0_pair_evaluator: relay_unverified + relayed_failed_work (gates), failed_with_side_effects + rework_bounds (signals). Relay = the caller's reply names the callee run; a relay with no caller read_result receipt between callee end and caller end fails, and a relay older than the first read_result row anywhere skips no_readback_record (receipts are written from CP-D). rework_bounds compares this turn's round-trips with the pair series p95 (>= BASELINE_MIN_RUNS caller turns), upper side only. _ts now accepts a datetime (the execution model's parsed values). - db/evaluations.unevaluated_pair_execution_ids: a pair row that carries skip: caller_running is re-picked once the caller run is terminal; a final row never is. - db/activities.earliest_collaboration_action + database.py facade line. - test_940_pair_checks: the headline-count test counts the registered gates (7) instead of the CP-A literal 5. Mutation: dropping the provisional re-pick from the candidate query turns test_a_caller_running_pair_row_is_re_picked_once_the_caller_ends red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair row metrics — latency, cost, verified (ent#940 CP-B part 2a) The pair row gains a metrics block beside its checks (never pass/fail, never in the headline): dispatch->start (callee admission to start), start->end, end->first read (the caller's first read_result receipt dated after the callee ended), the callee run's cost, and verified (the callee's own Tier-0 headline passed). Unknown is None, never 0. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair sweep as phase 2 of the Tier-0 cycle (ent#940 CP-B part 2b) tier0_sweep_service.run_cycle now runs tier0_pair_evaluator.sweep after the Tier-0 batch, under the existing tier0:leader lease (TD-5: no second lease, no new setting) and at the Tier-0 bounds (25 candidates, 4 threads, 10 s each). A hung pair evaluation leaves an all-skip evaluator_timeout pair row through insert_platform_evaluation_if_absent(evaluator=pair), so it is not re-picked and never replaces a grade that landed. The Tier-0 counts in the cycle result are unchanged; the pair counts ride under a new 'pair' key. test_935_write_fence: the pair evaluator's entry points take an execution id only, its sweep takes keyword bounds only, and it imports no FastAPI/auth type. Mutation: calling the pair sweep from the loop ahead of the lease check (and out of run_cycle) turns test_the_pair_phase_runs_only_under_the_tier0_lease [False] red, plus the cycle-order and leader [True] cases; restored byte-identical (cmp). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair read side — window join, pair fold, projection, scorecard (ent#940 CP-C) - window_rows LEFT JOINs the platform:tier0:pair row as `pair_checks` (one per run on the unique index, so a delegated run still counts once). - fold: Tier-0 counters unchanged; a disjoint `pair` block on by=pair only (TD-6) — pair_graded/passed/rate, pair_per_check_fail, latency p50 x3, cost_per_verified_outcome, round_trips_mean. Failed entries carry `pair_failed_checks` (ids + reason codes, never evidence). - project_summary: a machine reads the pair block's counts only (PAIR_MACHINE_KEYS); quality stays stripped. NON_PERSON_EVALUATORS += pair. - Agent summary gains `pair_failed`: the agent's own edge failures as caller, scoped by caller_side_filters (person: callee visible; agent key: itself only). - Scorecard: eval.pair_graded / eval.pair_passed / eval.pair_checks_passed_rate on pair series only; test_937_rollup point count re-pinned 14 -> 16. Mutation: caller_side_filters `callers=names` -> `None` turned 3 tests in test_940_pair_read.py red (agent key reading a sibling's pair failures, caller-side listing, person caller-side scope); restored byte-identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): first-read receipt on agent-key execution and fan-out result reads (ent#940 CP-D1) TD-1: an agent key's first read of another agent's FINISHED run writes one agent_collaboration activity with "action": "read_result" on the reader's own agent, related_execution_id = the run — the evidence relay_unverified grades against. Hooked on GET /api/agents/{name}/executions/{id} (get_execution_result) and GET /api/agents/{name}/fan-out/{id} (get_fan_out_result, one receipt per finished child). First read only: the id is a uuid5 over (reader, run) and the insert is on_conflict_do_nothing on the primary key, so a second read and two racing reads leave one row. No migration, no lock. Fail-open: a write that raises is swallowed; status and body are unchanged. Human reads, an agent reading its own run, and polls of a running run write nothing. Mutations (restored byte-identical, cmp): uuid4 id -> 4 red incl. test_a_second_read_writes_no_second_receipt and test_two_racing_receipt_writes_leave_one_row; try/except removed -> 2 red (test_a_receipt_write_that_raises_changes_nothing_in_the_response, test_a_fan_out_receipt_write_that_raises_changes_nothing). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): Tier-0 grades delegated fan-out, loop and reminder runs (ent#940 CP-D2) TD-2 (ent#935 addendum A, owned by #940): Tier-0 now grades fan_out, loop and reminder runs when another agent sent them (source_agent_name set); the same triggers without a sender, and 'user', stay ungraded. One rule, db.evaluations.tier0_eligible, is applied by both the candidate query and evaluate_execution. Without it a fan-out child had no Tier-0 row and hence no pair row, so the pair scorecard could not see a fan-out edge. recent_series_metrics keys a sourced non-schedule run on (agent_name, triggered_by, source_agent_name, playbook), as ruled; an unsourced agent run keeps its ent#935 key. TD-3 (series_key AND Jaccard >= 0.9, loop and distinct fan-out tasks excluded) is unchanged from CP-A; the end-to-end test pins a fan-out of three as three pair rows with no duplicate_dispatch fail. No excluded-trigger list in tests/ pinned these triggers; no test outside the 935/937/938/940 files reads the changed identifiers. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(eval): pair evaluation addendum C, delegated-trigger + receipt docs, test registry (ent#940 CP-E) - §46 addendum C, FR-18..FR-21: pair checks and skip reasons, the platform:tier0:pair row and its fence, the pair read block, and the trigger widening / per-sender series key / first-read receipt as built. Layer 2 (pair judge) and the gitlink are named as not built. - Stale claims fixed: Tier-0 scope (FR-7 intro, FR-9, background-services row, feature-flow diagram) now includes sourced fan_out/loop/reminder runs; budget_vs_baseline series key (FR-8) is per sender for every sourced non-schedule run including agent; FR-10 writer callers three -> four. - Feature flow: "Pair evaluation" section; observability.md pointer. - tests/registry.json: entries for the eight tests/unit/test_940_*.py. Docs only; no code change. The ExecutionChecks / EvaluationsPanel copy still names only scheduled and agent-triggered runs; the docs say so. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): an agent key reads a pair row's check ids and reasons only (ent#940 C1) project_row reduced a Tier-1 row for a machine but passed a pair row's checks through, so the callee's own key read latency, cost and round-trip evidence on GET /agents/{name}/evaluations, GET /evaluations and GET /evaluations/{id} - the numbers deviation C keeps off the aggregate. A machine now reads schema/headline/edge and [{id, tier, source, status, reason}]; a person reads the row as stored. Red before: test_agent_key_list_route_reads_pair_rows_without_metrics_or_evidence and test_agent_key_fleet_list_and_by_id_read_pair_rows_without_metrics (extra 'metrics'). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): the Not-evaluated copy names the delegated runs ent#940 grades (ent#940 C2) ExecutionChecks and EvaluationsPanel still said only scheduled and agent-triggered runs are graded; sourced fan_out/loop/reminder runs are graded too since ent#940. Copy, its mount-spec pin and the two doc hedges that described the stale copy change together. No class changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): a finished result handed over inline is a read (ent#940 I3) record_first_reads fired only on the two GETs, so a caller that got the callee's reply from a sync chat_with_agent call and quoted its execution id was graded fail: unread_relay although it had read the result. The sync /chat, sync /task and sync POST /fan-out answers (and their idempotent replays) now write the same read_result receipt through the same insert-if-absent helper: finished-only by the run's stored status, an accepted/queued receipt answer writes none, fail-open, response unchanged. relay_unverified is not narrowed by delegation_mode. Red before: test_a_sync_chat_delivery_leaves_one_receipt, test_a_sync_task_delivery_leaves_one_receipt, test_a_sync_fan_out_delivery_receipts_each_finished_child, test_a_relay_after_an_inline_reply_is_not_unread (unread_relay). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): pair sweep grades fresh rows before provisional re-grades; a caller read failure stays provisional (ent#940 I1) Fresh candidates (no pair row) now sort before provisional re-grades, so rows whose re-grade keeps failing never starve a tick's batch. A caller read that raises is skip: caller_unreadable, re-picked like caller_running, instead of a permanent caller_missing from one blip. Mutation: with the code reverted, test_fresh_candidates_are_graded_before_provisional_re_grades and test_a_raising_caller_read_keeps_the_row_provisional go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): a callee's own failed list excludes caller-side pair failures (ent#940 I2) TD-6: an agent sees only its own failed pair checks. A pair check grades the caller's handling of the edge, so fold() counts an edge failure as a failed run on the by=pair view only (pair=True). The callee's summary failed list and /evaluations/failed outside by=pair no longer carry it; the caller still reads it as pair_failed, a person through by=pair. FR-20 and the feature flow said 'as callee in failed' — corrected. Mutation: with the service/router change reverted, test_an_agents_own_fold_never_lists_a_caller_side_failure, test_agent_summary_lists_pair_failures_only_on_the_caller_side, test_agent_key_failed_route_by_agent_carries_no_caller_side_check and test_person_caller_side_hides_a_callee_outside_scope go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(arch): list tier0_evaluator and tier0_pair_evaluator in the backend service catalog (ent#940 I7) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(eval): rename the writer-fence test to _exactly_four_callers (ent#940 I8) The fence now pins four writer sites (tier0_pair_evaluator joined in ent#940); the old _exactly_three_callers name invited a reader to 'fix' the set. Function rename only — the file, tests/registry.json and the docs reference the file name, which is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Trinity Agent (trinity) <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
vybe
added a commit
that referenced
this pull request
Oct 29, 2026
…, the pair's own rates in Delegated pairs, week-over-week Outcomes (Abilityai/trinity-enterprise#938, #940, #941, #74) Gaps found auditing the branch against the issue threads: * Delegated pairs showed the callee runs' Tier-0 pass rate as the edge's number. The row now reads the group's `pair` block (graded, pair-check pass rate, top failed pair check), and a failed run lists its `pair_failed_checks` beside its Tier-0 ones, marked as the pair's. * The execution page listed only failed gates and knew nothing of the judge or the hand-off. New `GET …/executions/{id}/evaluations` returns the run's Tier-0, judge and pair rows in one read, under the singular route's gate and the one per-caller projection (an agent key still reads findings and reason codes, never a score). ExecutionChecks lists every gate with its outcome, the judge's quality out of 5 with each dimension's verdict and reason (or why the run was skipped), and the hand-off's checks with the caller named. * Outcomes had the weekly history stored and never read it. The store reads `…/analyses`; each fleet tile says how it moved against last week, the project rows carry the done-count movement, and a Week by week line plots the fleet's rates once two weeks exist. A failed history read leaves the deltas at "no earlier week" and nothing else. * An anomaly alarm on the Needs Response card links to the agent's Schedules tab, where the incident's evidence is (the alarm text pointed to a page that does not exist; fixed in the enterprise module). Tests: test_938_run_evaluations (6), census entry; executionChecks (+5), evaluationsPanel (+2), outcomesPanel (+3), queueCardAnomalyLink (2). Co-Authored-By: Claude Fable 5.1 <[email protected]>
vybe
added a commit
that referenced
this pull request
Oct 31, 2026
…first-read receipt, delegated-trigger grading (ent#940) (#3794) * feat(eval): pair evaluator checks 1-5 + platform writer evaluator= fence (ent#940 CP-A) Layer 1, checkpoint A of Abilityai/trinity-enterprise#940. - db/evaluations: TIER0_PAIR_EVALUATOR + PLATFORM_EVALUATORS; evaluator= kwarg (default Tier-0, ValueError otherwise) threaded through upsert_platform_evaluation / insert_platform_evaluation_if_absent / latest_tier0_for_execution; unevaluated_pair_execution_ids. - db/activities: collaboration_rows_for_executions (chunked IN). - db/schedules/executions: sibling_executions (cap+1) + pair_rework_series. - database.py facade lines for all five. - services/tier0_pair_evaluator: dispatch_exists, one_sided_record, duplicate_dispatch, resend_after_receipt, wrong_route + build_context + evaluate_pair. No migration. - test_935_write_fence allowlist += the pair evaluator (additive); test_935_tier0_writer's private-method stub forwards the new argument. Mutation: removing the PLATFORM_EVALUATORS refusal turns test_the_writer_refuses_an_evaluator_outside_the_closed_set red (4/4). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair checks 6-9 + caller_running re-pick (ent#940 CP-B part 1) Layer 1, checkpoint B (sub-part 1) of Abilityai/trinity-enterprise#940. - services/tier0_pair_evaluator: relay_unverified + relayed_failed_work (gates), failed_with_side_effects + rework_bounds (signals). Relay = the caller's reply names the callee run; a relay with no caller read_result receipt between callee end and caller end fails, and a relay older than the first read_result row anywhere skips no_readback_record (receipts are written from CP-D). rework_bounds compares this turn's round-trips with the pair series p95 (>= BASELINE_MIN_RUNS caller turns), upper side only. _ts now accepts a datetime (the execution model's parsed values). - db/evaluations.unevaluated_pair_execution_ids: a pair row that carries skip: caller_running is re-picked once the caller run is terminal; a final row never is. - db/activities.earliest_collaboration_action + database.py facade line. - test_940_pair_checks: the headline-count test counts the registered gates (7) instead of the CP-A literal 5. Mutation: dropping the provisional re-pick from the candidate query turns test_a_caller_running_pair_row_is_re_picked_once_the_caller_ends red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair row metrics — latency, cost, verified (ent#940 CP-B part 2a) The pair row gains a metrics block beside its checks (never pass/fail, never in the headline): dispatch->start (callee admission to start), start->end, end->first read (the caller's first read_result receipt dated after the callee ended), the callee run's cost, and verified (the callee's own Tier-0 headline passed). Unknown is None, never 0. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair sweep as phase 2 of the Tier-0 cycle (ent#940 CP-B part 2b) tier0_sweep_service.run_cycle now runs tier0_pair_evaluator.sweep after the Tier-0 batch, under the existing tier0:leader lease (TD-5: no second lease, no new setting) and at the Tier-0 bounds (25 candidates, 4 threads, 10 s each). A hung pair evaluation leaves an all-skip evaluator_timeout pair row through insert_platform_evaluation_if_absent(evaluator=pair), so it is not re-picked and never replaces a grade that landed. The Tier-0 counts in the cycle result are unchanged; the pair counts ride under a new 'pair' key. test_935_write_fence: the pair evaluator's entry points take an execution id only, its sweep takes keyword bounds only, and it imports no FastAPI/auth type. Mutation: calling the pair sweep from the loop ahead of the lease check (and out of run_cycle) turns test_the_pair_phase_runs_only_under_the_tier0_lease [False] red, plus the cycle-order and leader [True] cases; restored byte-identical (cmp). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair read side — window join, pair fold, projection, scorecard (ent#940 CP-C) - window_rows LEFT JOINs the platform:tier0:pair row as `pair_checks` (one per run on the unique index, so a delegated run still counts once). - fold: Tier-0 counters unchanged; a disjoint `pair` block on by=pair only (TD-6) — pair_graded/passed/rate, pair_per_check_fail, latency p50 x3, cost_per_verified_outcome, round_trips_mean. Failed entries carry `pair_failed_checks` (ids + reason codes, never evidence). - project_summary: a machine reads the pair block's counts only (PAIR_MACHINE_KEYS); quality stays stripped. NON_PERSON_EVALUATORS += pair. - Agent summary gains `pair_failed`: the agent's own edge failures as caller, scoped by caller_side_filters (person: callee visible; agent key: itself only). - Scorecard: eval.pair_graded / eval.pair_passed / eval.pair_checks_passed_rate on pair series only; test_937_rollup point count re-pinned 14 -> 16. Mutation: caller_side_filters `callers=names` -> `None` turned 3 tests in test_940_pair_read.py red (agent key reading a sibling's pair failures, caller-side listing, person caller-side scope); restored byte-identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): first-read receipt on agent-key execution and fan-out result reads (ent#940 CP-D1) TD-1: an agent key's first read of another agent's FINISHED run writes one agent_collaboration activity with "action": "read_result" on the reader's own agent, related_execution_id = the run — the evidence relay_unverified grades against. Hooked on GET /api/agents/{name}/executions/{id} (get_execution_result) and GET /api/agents/{name}/fan-out/{id} (get_fan_out_result, one receipt per finished child). First read only: the id is a uuid5 over (reader, run) and the insert is on_conflict_do_nothing on the primary key, so a second read and two racing reads leave one row. No migration, no lock. Fail-open: a write that raises is swallowed; status and body are unchanged. Human reads, an agent reading its own run, and polls of a running run write nothing. Mutations (restored byte-identical, cmp): uuid4 id -> 4 red incl. test_a_second_read_writes_no_second_receipt and test_two_racing_receipt_writes_leave_one_row; try/except removed -> 2 red (test_a_receipt_write_that_raises_changes_nothing_in_the_response, test_a_fan_out_receipt_write_that_raises_changes_nothing). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): Tier-0 grades delegated fan-out, loop and reminder runs (ent#940 CP-D2) TD-2 (ent#935 addendum A, owned by #940): Tier-0 now grades fan_out, loop and reminder runs when another agent sent them (source_agent_name set); the same triggers without a sender, and 'user', stay ungraded. One rule, db.evaluations.tier0_eligible, is applied by both the candidate query and evaluate_execution. Without it a fan-out child had no Tier-0 row and hence no pair row, so the pair scorecard could not see a fan-out edge. recent_series_metrics keys a sourced non-schedule run on (agent_name, triggered_by, source_agent_name, playbook), as ruled; an unsourced agent run keeps its ent#935 key. TD-3 (series_key AND Jaccard >= 0.9, loop and distinct fan-out tasks excluded) is unchanged from CP-A; the end-to-end test pins a fan-out of three as three pair rows with no duplicate_dispatch fail. No excluded-trigger list in tests/ pinned these triggers; no test outside the 935/937/938/940 files reads the changed identifiers. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(eval): pair evaluation addendum C, delegated-trigger + receipt docs, test registry (ent#940 CP-E) - §46 addendum C, FR-18..FR-21: pair checks and skip reasons, the platform:tier0:pair row and its fence, the pair read block, and the trigger widening / per-sender series key / first-read receipt as built. Layer 2 (pair judge) and the gitlink are named as not built. - Stale claims fixed: Tier-0 scope (FR-7 intro, FR-9, background-services row, feature-flow diagram) now includes sourced fan_out/loop/reminder runs; budget_vs_baseline series key (FR-8) is per sender for every sourced non-schedule run including agent; FR-10 writer callers three -> four. - Feature flow: "Pair evaluation" section; observability.md pointer. - tests/registry.json: entries for the eight tests/unit/test_940_*.py. Docs only; no code change. The ExecutionChecks / EvaluationsPanel copy still names only scheduled and agent-triggered runs; the docs say so. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): an agent key reads a pair row's check ids and reasons only (ent#940 C1) project_row reduced a Tier-1 row for a machine but passed a pair row's checks through, so the callee's own key read latency, cost and round-trip evidence on GET /agents/{name}/evaluations, GET /evaluations and GET /evaluations/{id} - the numbers deviation C keeps off the aggregate. A machine now reads schema/headline/edge and [{id, tier, source, status, reason}]; a person reads the row as stored. Red before: test_agent_key_list_route_reads_pair_rows_without_metrics_or_evidence and test_agent_key_fleet_list_and_by_id_read_pair_rows_without_metrics (extra 'metrics'). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): the Not-evaluated copy names the delegated runs ent#940 grades (ent#940 C2) ExecutionChecks and EvaluationsPanel still said only scheduled and agent-triggered runs are graded; sourced fan_out/loop/reminder runs are graded too since ent#940. Copy, its mount-spec pin and the two doc hedges that described the stale copy change together. No class changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): a finished result handed over inline is a read (ent#940 I3) record_first_reads fired only on the two GETs, so a caller that got the callee's reply from a sync chat_with_agent call and quoted its execution id was graded fail: unread_relay although it had read the result. The sync /chat, sync /task and sync POST /fan-out answers (and their idempotent replays) now write the same read_result receipt through the same insert-if-absent helper: finished-only by the run's stored status, an accepted/queued receipt answer writes none, fail-open, response unchanged. relay_unverified is not narrowed by delegation_mode. Red before: test_a_sync_chat_delivery_leaves_one_receipt, test_a_sync_task_delivery_leaves_one_receipt, test_a_sync_fan_out_delivery_receipts_each_finished_child, test_a_relay_after_an_inline_reply_is_not_unread (unread_relay). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): pair sweep grades fresh rows before provisional re-grades; a caller read failure stays provisional (ent#940 I1) Fresh candidates (no pair row) now sort before provisional re-grades, so rows whose re-grade keeps failing never starve a tick's batch. A caller read that raises is skip: caller_unreadable, re-picked like caller_running, instead of a permanent caller_missing from one blip. Mutation: with the code reverted, test_fresh_candidates_are_graded_before_provisional_re_grades and test_a_raising_caller_read_keeps_the_row_provisional go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): a callee's own failed list excludes caller-side pair failures (ent#940 I2) TD-6: an agent sees only its own failed pair checks. A pair check grades the caller's handling of the edge, so fold() counts an edge failure as a failed run on the by=pair view only (pair=True). The callee's summary failed list and /evaluations/failed outside by=pair no longer carry it; the caller still reads it as pair_failed, a person through by=pair. FR-20 and the feature flow said 'as callee in failed' — corrected. Mutation: with the service/router change reverted, test_an_agents_own_fold_never_lists_a_caller_side_failure, test_agent_summary_lists_pair_failures_only_on_the_caller_side, test_agent_key_failed_route_by_agent_carries_no_caller_side_check and test_person_caller_side_hides_a_callee_outside_scope go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(arch): list tier0_evaluator and tier0_pair_evaluator in the backend service catalog (ent#940 I7) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(eval): rename the writer-fence test to _exactly_four_callers (ent#940 I8) The fence now pins four writer sites (tier0_pair_evaluator joined in ent#940); the old _exactly_three_callers name invited a reader to 'fix' the set. Function rename only — the file, tests/registry.json and the docs reference the file name, which is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Trinity Agent (trinity) <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
vybe
added a commit
that referenced
this pull request
Oct 31, 2026
…, the pair's own rates in Delegated pairs, week-over-week Outcomes (Abilityai/trinity-enterprise#938, #940, #941, #74) Gaps found auditing the branch against the issue threads: * Delegated pairs showed the callee runs' Tier-0 pass rate as the edge's number. The row now reads the group's `pair` block (graded, pair-check pass rate, top failed pair check), and a failed run lists its `pair_failed_checks` beside its Tier-0 ones, marked as the pair's. * The execution page listed only failed gates and knew nothing of the judge or the hand-off. New `GET …/executions/{id}/evaluations` returns the run's Tier-0, judge and pair rows in one read, under the singular route's gate and the one per-caller projection (an agent key still reads findings and reason codes, never a score). ExecutionChecks lists every gate with its outcome, the judge's quality out of 5 with each dimension's verdict and reason (or why the run was skipped), and the hand-off's checks with the caller named. * Outcomes had the weekly history stored and never read it. The store reads `…/analyses`; each fleet tile says how it moved against last week, the project rows carry the done-count movement, and a Week by week line plots the fleet's rates once two weeks exist. A failed history read leaves the deltas at "no earlier week" and nothing else. * An anomaly alarm on the Needs Response card links to the agent's Schedules tab, where the incident's evidence is (the alarm text pointed to a page that does not exist; fixed in the enterprise module). Tests: test_938_run_evaluations (6), census entry; executionChecks (+5), evaluationsPanel (+2), outcomesPanel (+3), queueCardAnomalyLink (2). Co-Authored-By: Claude Fable 5.1 <[email protected]>
vybe
added a commit
that referenced
this pull request
Oct 31, 2026
…first-read receipt, delegated-trigger grading (ent#940) (#3794) * feat(eval): pair evaluator checks 1-5 + platform writer evaluator= fence (ent#940 CP-A) Layer 1, checkpoint A of Abilityai/trinity-enterprise#940. - db/evaluations: TIER0_PAIR_EVALUATOR + PLATFORM_EVALUATORS; evaluator= kwarg (default Tier-0, ValueError otherwise) threaded through upsert_platform_evaluation / insert_platform_evaluation_if_absent / latest_tier0_for_execution; unevaluated_pair_execution_ids. - db/activities: collaboration_rows_for_executions (chunked IN). - db/schedules/executions: sibling_executions (cap+1) + pair_rework_series. - database.py facade lines for all five. - services/tier0_pair_evaluator: dispatch_exists, one_sided_record, duplicate_dispatch, resend_after_receipt, wrong_route + build_context + evaluate_pair. No migration. - test_935_write_fence allowlist += the pair evaluator (additive); test_935_tier0_writer's private-method stub forwards the new argument. Mutation: removing the PLATFORM_EVALUATORS refusal turns test_the_writer_refuses_an_evaluator_outside_the_closed_set red (4/4). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair checks 6-9 + caller_running re-pick (ent#940 CP-B part 1) Layer 1, checkpoint B (sub-part 1) of Abilityai/trinity-enterprise#940. - services/tier0_pair_evaluator: relay_unverified + relayed_failed_work (gates), failed_with_side_effects + rework_bounds (signals). Relay = the caller's reply names the callee run; a relay with no caller read_result receipt between callee end and caller end fails, and a relay older than the first read_result row anywhere skips no_readback_record (receipts are written from CP-D). rework_bounds compares this turn's round-trips with the pair series p95 (>= BASELINE_MIN_RUNS caller turns), upper side only. _ts now accepts a datetime (the execution model's parsed values). - db/evaluations.unevaluated_pair_execution_ids: a pair row that carries skip: caller_running is re-picked once the caller run is terminal; a final row never is. - db/activities.earliest_collaboration_action + database.py facade line. - test_940_pair_checks: the headline-count test counts the registered gates (7) instead of the CP-A literal 5. Mutation: dropping the provisional re-pick from the candidate query turns test_a_caller_running_pair_row_is_re_picked_once_the_caller_ends red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair row metrics — latency, cost, verified (ent#940 CP-B part 2a) The pair row gains a metrics block beside its checks (never pass/fail, never in the headline): dispatch->start (callee admission to start), start->end, end->first read (the caller's first read_result receipt dated after the callee ended), the callee run's cost, and verified (the callee's own Tier-0 headline passed). Unknown is None, never 0. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair sweep as phase 2 of the Tier-0 cycle (ent#940 CP-B part 2b) tier0_sweep_service.run_cycle now runs tier0_pair_evaluator.sweep after the Tier-0 batch, under the existing tier0:leader lease (TD-5: no second lease, no new setting) and at the Tier-0 bounds (25 candidates, 4 threads, 10 s each). A hung pair evaluation leaves an all-skip evaluator_timeout pair row through insert_platform_evaluation_if_absent(evaluator=pair), so it is not re-picked and never replaces a grade that landed. The Tier-0 counts in the cycle result are unchanged; the pair counts ride under a new 'pair' key. test_935_write_fence: the pair evaluator's entry points take an execution id only, its sweep takes keyword bounds only, and it imports no FastAPI/auth type. Mutation: calling the pair sweep from the loop ahead of the lease check (and out of run_cycle) turns test_the_pair_phase_runs_only_under_the_tier0_lease [False] red, plus the cycle-order and leader [True] cases; restored byte-identical (cmp). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair read side — window join, pair fold, projection, scorecard (ent#940 CP-C) - window_rows LEFT JOINs the platform:tier0:pair row as `pair_checks` (one per run on the unique index, so a delegated run still counts once). - fold: Tier-0 counters unchanged; a disjoint `pair` block on by=pair only (TD-6) — pair_graded/passed/rate, pair_per_check_fail, latency p50 x3, cost_per_verified_outcome, round_trips_mean. Failed entries carry `pair_failed_checks` (ids + reason codes, never evidence). - project_summary: a machine reads the pair block's counts only (PAIR_MACHINE_KEYS); quality stays stripped. NON_PERSON_EVALUATORS += pair. - Agent summary gains `pair_failed`: the agent's own edge failures as caller, scoped by caller_side_filters (person: callee visible; agent key: itself only). - Scorecard: eval.pair_graded / eval.pair_passed / eval.pair_checks_passed_rate on pair series only; test_937_rollup point count re-pinned 14 -> 16. Mutation: caller_side_filters `callers=names` -> `None` turned 3 tests in test_940_pair_read.py red (agent key reading a sibling's pair failures, caller-side listing, person caller-side scope); restored byte-identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): first-read receipt on agent-key execution and fan-out result reads (ent#940 CP-D1) TD-1: an agent key's first read of another agent's FINISHED run writes one agent_collaboration activity with "action": "read_result" on the reader's own agent, related_execution_id = the run — the evidence relay_unverified grades against. Hooked on GET /api/agents/{name}/executions/{id} (get_execution_result) and GET /api/agents/{name}/fan-out/{id} (get_fan_out_result, one receipt per finished child). First read only: the id is a uuid5 over (reader, run) and the insert is on_conflict_do_nothing on the primary key, so a second read and two racing reads leave one row. No migration, no lock. Fail-open: a write that raises is swallowed; status and body are unchanged. Human reads, an agent reading its own run, and polls of a running run write nothing. Mutations (restored byte-identical, cmp): uuid4 id -> 4 red incl. test_a_second_read_writes_no_second_receipt and test_two_racing_receipt_writes_leave_one_row; try/except removed -> 2 red (test_a_receipt_write_that_raises_changes_nothing_in_the_response, test_a_fan_out_receipt_write_that_raises_changes_nothing). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): Tier-0 grades delegated fan-out, loop and reminder runs (ent#940 CP-D2) TD-2 (ent#935 addendum A, owned by #940): Tier-0 now grades fan_out, loop and reminder runs when another agent sent them (source_agent_name set); the same triggers without a sender, and 'user', stay ungraded. One rule, db.evaluations.tier0_eligible, is applied by both the candidate query and evaluate_execution. Without it a fan-out child had no Tier-0 row and hence no pair row, so the pair scorecard could not see a fan-out edge. recent_series_metrics keys a sourced non-schedule run on (agent_name, triggered_by, source_agent_name, playbook), as ruled; an unsourced agent run keeps its ent#935 key. TD-3 (series_key AND Jaccard >= 0.9, loop and distinct fan-out tasks excluded) is unchanged from CP-A; the end-to-end test pins a fan-out of three as three pair rows with no duplicate_dispatch fail. No excluded-trigger list in tests/ pinned these triggers; no test outside the 935/937/938/940 files reads the changed identifiers. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(eval): pair evaluation addendum C, delegated-trigger + receipt docs, test registry (ent#940 CP-E) - §46 addendum C, FR-18..FR-21: pair checks and skip reasons, the platform:tier0:pair row and its fence, the pair read block, and the trigger widening / per-sender series key / first-read receipt as built. Layer 2 (pair judge) and the gitlink are named as not built. - Stale claims fixed: Tier-0 scope (FR-7 intro, FR-9, background-services row, feature-flow diagram) now includes sourced fan_out/loop/reminder runs; budget_vs_baseline series key (FR-8) is per sender for every sourced non-schedule run including agent; FR-10 writer callers three -> four. - Feature flow: "Pair evaluation" section; observability.md pointer. - tests/registry.json: entries for the eight tests/unit/test_940_*.py. Docs only; no code change. The ExecutionChecks / EvaluationsPanel copy still names only scheduled and agent-triggered runs; the docs say so. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): an agent key reads a pair row's check ids and reasons only (ent#940 C1) project_row reduced a Tier-1 row for a machine but passed a pair row's checks through, so the callee's own key read latency, cost and round-trip evidence on GET /agents/{name}/evaluations, GET /evaluations and GET /evaluations/{id} - the numbers deviation C keeps off the aggregate. A machine now reads schema/headline/edge and [{id, tier, source, status, reason}]; a person reads the row as stored. Red before: test_agent_key_list_route_reads_pair_rows_without_metrics_or_evidence and test_agent_key_fleet_list_and_by_id_read_pair_rows_without_metrics (extra 'metrics'). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): the Not-evaluated copy names the delegated runs ent#940 grades (ent#940 C2) ExecutionChecks and EvaluationsPanel still said only scheduled and agent-triggered runs are graded; sourced fan_out/loop/reminder runs are graded too since ent#940. Copy, its mount-spec pin and the two doc hedges that described the stale copy change together. No class changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): a finished result handed over inline is a read (ent#940 I3) record_first_reads fired only on the two GETs, so a caller that got the callee's reply from a sync chat_with_agent call and quoted its execution id was graded fail: unread_relay although it had read the result. The sync /chat, sync /task and sync POST /fan-out answers (and their idempotent replays) now write the same read_result receipt through the same insert-if-absent helper: finished-only by the run's stored status, an accepted/queued receipt answer writes none, fail-open, response unchanged. relay_unverified is not narrowed by delegation_mode. Red before: test_a_sync_chat_delivery_leaves_one_receipt, test_a_sync_task_delivery_leaves_one_receipt, test_a_sync_fan_out_delivery_receipts_each_finished_child, test_a_relay_after_an_inline_reply_is_not_unread (unread_relay). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): pair sweep grades fresh rows before provisional re-grades; a caller read failure stays provisional (ent#940 I1) Fresh candidates (no pair row) now sort before provisional re-grades, so rows whose re-grade keeps failing never starve a tick's batch. A caller read that raises is skip: caller_unreadable, re-picked like caller_running, instead of a permanent caller_missing from one blip. Mutation: with the code reverted, test_fresh_candidates_are_graded_before_provisional_re_grades and test_a_raising_caller_read_keeps_the_row_provisional go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): a callee's own failed list excludes caller-side pair failures (ent#940 I2) TD-6: an agent sees only its own failed pair checks. A pair check grades the caller's handling of the edge, so fold() counts an edge failure as a failed run on the by=pair view only (pair=True). The callee's summary failed list and /evaluations/failed outside by=pair no longer carry it; the caller still reads it as pair_failed, a person through by=pair. FR-20 and the feature flow said 'as callee in failed' — corrected. Mutation: with the service/router change reverted, test_an_agents_own_fold_never_lists_a_caller_side_failure, test_agent_summary_lists_pair_failures_only_on_the_caller_side, test_agent_key_failed_route_by_agent_carries_no_caller_side_check and test_person_caller_side_hides_a_callee_outside_scope go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(arch): list tier0_evaluator and tier0_pair_evaluator in the backend service catalog (ent#940 I7) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(eval): rename the writer-fence test to _exactly_four_callers (ent#940 I8) The fence now pins four writer sites (tier0_pair_evaluator joined in ent#940); the old _exactly_three_callers name invited a reader to 'fix' the set. Function rename only — the file, tests/registry.json and the docs reference the file name, which is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Trinity Agent (trinity) <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
vybe
added a commit
that referenced
this pull request
Oct 31, 2026
…, the pair's own rates in Delegated pairs, week-over-week Outcomes (Abilityai/trinity-enterprise#938, #940, #941, #74) Gaps found auditing the branch against the issue threads: * Delegated pairs showed the callee runs' Tier-0 pass rate as the edge's number. The row now reads the group's `pair` block (graded, pair-check pass rate, top failed pair check), and a failed run lists its `pair_failed_checks` beside its Tier-0 ones, marked as the pair's. * The execution page listed only failed gates and knew nothing of the judge or the hand-off. New `GET …/executions/{id}/evaluations` returns the run's Tier-0, judge and pair rows in one read, under the singular route's gate and the one per-caller projection (an agent key still reads findings and reason codes, never a score). ExecutionChecks lists every gate with its outcome, the judge's quality out of 5 with each dimension's verdict and reason (or why the run was skipped), and the hand-off's checks with the caller named. * Outcomes had the weekly history stored and never read it. The store reads `…/analyses`; each fleet tile says how it moved against last week, the project rows carry the done-count movement, and a Week by week line plots the fleet's rates once two weeks exist. A failed history read leaves the deltas at "no earlier week" and nothing else. * An anomaly alarm on the Needs Response card links to the agent's Schedules tab, where the incident's evidence is (the alarm text pointed to a page that does not exist; fixed in the enterprise module). Tests: test_938_run_evaluations (6), census entry; executionChecks (+5), evaluationsPanel (+2), outcomesPanel (+3), queueCardAnomalyLink (2). Co-Authored-By: Claude Fable 5.1 <[email protected]>
vybe
added a commit
that referenced
this pull request
Nov 2, 2026
…first-read receipt, delegated-trigger grading (ent#940) (#3794) * feat(eval): pair evaluator checks 1-5 + platform writer evaluator= fence (ent#940 CP-A) Layer 1, checkpoint A of Abilityai/trinity-enterprise#940. - db/evaluations: TIER0_PAIR_EVALUATOR + PLATFORM_EVALUATORS; evaluator= kwarg (default Tier-0, ValueError otherwise) threaded through upsert_platform_evaluation / insert_platform_evaluation_if_absent / latest_tier0_for_execution; unevaluated_pair_execution_ids. - db/activities: collaboration_rows_for_executions (chunked IN). - db/schedules/executions: sibling_executions (cap+1) + pair_rework_series. - database.py facade lines for all five. - services/tier0_pair_evaluator: dispatch_exists, one_sided_record, duplicate_dispatch, resend_after_receipt, wrong_route + build_context + evaluate_pair. No migration. - test_935_write_fence allowlist += the pair evaluator (additive); test_935_tier0_writer's private-method stub forwards the new argument. Mutation: removing the PLATFORM_EVALUATORS refusal turns test_the_writer_refuses_an_evaluator_outside_the_closed_set red (4/4). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair checks 6-9 + caller_running re-pick (ent#940 CP-B part 1) Layer 1, checkpoint B (sub-part 1) of Abilityai/trinity-enterprise#940. - services/tier0_pair_evaluator: relay_unverified + relayed_failed_work (gates), failed_with_side_effects + rework_bounds (signals). Relay = the caller's reply names the callee run; a relay with no caller read_result receipt between callee end and caller end fails, and a relay older than the first read_result row anywhere skips no_readback_record (receipts are written from CP-D). rework_bounds compares this turn's round-trips with the pair series p95 (>= BASELINE_MIN_RUNS caller turns), upper side only. _ts now accepts a datetime (the execution model's parsed values). - db/evaluations.unevaluated_pair_execution_ids: a pair row that carries skip: caller_running is re-picked once the caller run is terminal; a final row never is. - db/activities.earliest_collaboration_action + database.py facade line. - test_940_pair_checks: the headline-count test counts the registered gates (7) instead of the CP-A literal 5. Mutation: dropping the provisional re-pick from the candidate query turns test_a_caller_running_pair_row_is_re_picked_once_the_caller_ends red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair row metrics — latency, cost, verified (ent#940 CP-B part 2a) The pair row gains a metrics block beside its checks (never pass/fail, never in the headline): dispatch->start (callee admission to start), start->end, end->first read (the caller's first read_result receipt dated after the callee ended), the callee run's cost, and verified (the callee's own Tier-0 headline passed). Unknown is None, never 0. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair sweep as phase 2 of the Tier-0 cycle (ent#940 CP-B part 2b) tier0_sweep_service.run_cycle now runs tier0_pair_evaluator.sweep after the Tier-0 batch, under the existing tier0:leader lease (TD-5: no second lease, no new setting) and at the Tier-0 bounds (25 candidates, 4 threads, 10 s each). A hung pair evaluation leaves an all-skip evaluator_timeout pair row through insert_platform_evaluation_if_absent(evaluator=pair), so it is not re-picked and never replaces a grade that landed. The Tier-0 counts in the cycle result are unchanged; the pair counts ride under a new 'pair' key. test_935_write_fence: the pair evaluator's entry points take an execution id only, its sweep takes keyword bounds only, and it imports no FastAPI/auth type. Mutation: calling the pair sweep from the loop ahead of the lease check (and out of run_cycle) turns test_the_pair_phase_runs_only_under_the_tier0_lease [False] red, plus the cycle-order and leader [True] cases; restored byte-identical (cmp). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair read side — window join, pair fold, projection, scorecard (ent#940 CP-C) - window_rows LEFT JOINs the platform:tier0:pair row as `pair_checks` (one per run on the unique index, so a delegated run still counts once). - fold: Tier-0 counters unchanged; a disjoint `pair` block on by=pair only (TD-6) — pair_graded/passed/rate, pair_per_check_fail, latency p50 x3, cost_per_verified_outcome, round_trips_mean. Failed entries carry `pair_failed_checks` (ids + reason codes, never evidence). - project_summary: a machine reads the pair block's counts only (PAIR_MACHINE_KEYS); quality stays stripped. NON_PERSON_EVALUATORS += pair. - Agent summary gains `pair_failed`: the agent's own edge failures as caller, scoped by caller_side_filters (person: callee visible; agent key: itself only). - Scorecard: eval.pair_graded / eval.pair_passed / eval.pair_checks_passed_rate on pair series only; test_937_rollup point count re-pinned 14 -> 16. Mutation: caller_side_filters `callers=names` -> `None` turned 3 tests in test_940_pair_read.py red (agent key reading a sibling's pair failures, caller-side listing, person caller-side scope); restored byte-identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): first-read receipt on agent-key execution and fan-out result reads (ent#940 CP-D1) TD-1: an agent key's first read of another agent's FINISHED run writes one agent_collaboration activity with "action": "read_result" on the reader's own agent, related_execution_id = the run — the evidence relay_unverified grades against. Hooked on GET /api/agents/{name}/executions/{id} (get_execution_result) and GET /api/agents/{name}/fan-out/{id} (get_fan_out_result, one receipt per finished child). First read only: the id is a uuid5 over (reader, run) and the insert is on_conflict_do_nothing on the primary key, so a second read and two racing reads leave one row. No migration, no lock. Fail-open: a write that raises is swallowed; status and body are unchanged. Human reads, an agent reading its own run, and polls of a running run write nothing. Mutations (restored byte-identical, cmp): uuid4 id -> 4 red incl. test_a_second_read_writes_no_second_receipt and test_two_racing_receipt_writes_leave_one_row; try/except removed -> 2 red (test_a_receipt_write_that_raises_changes_nothing_in_the_response, test_a_fan_out_receipt_write_that_raises_changes_nothing). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): Tier-0 grades delegated fan-out, loop and reminder runs (ent#940 CP-D2) TD-2 (ent#935 addendum A, owned by #940): Tier-0 now grades fan_out, loop and reminder runs when another agent sent them (source_agent_name set); the same triggers without a sender, and 'user', stay ungraded. One rule, db.evaluations.tier0_eligible, is applied by both the candidate query and evaluate_execution. Without it a fan-out child had no Tier-0 row and hence no pair row, so the pair scorecard could not see a fan-out edge. recent_series_metrics keys a sourced non-schedule run on (agent_name, triggered_by, source_agent_name, playbook), as ruled; an unsourced agent run keeps its ent#935 key. TD-3 (series_key AND Jaccard >= 0.9, loop and distinct fan-out tasks excluded) is unchanged from CP-A; the end-to-end test pins a fan-out of three as three pair rows with no duplicate_dispatch fail. No excluded-trigger list in tests/ pinned these triggers; no test outside the 935/937/938/940 files reads the changed identifiers. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(eval): pair evaluation addendum C, delegated-trigger + receipt docs, test registry (ent#940 CP-E) - §46 addendum C, FR-18..FR-21: pair checks and skip reasons, the platform:tier0:pair row and its fence, the pair read block, and the trigger widening / per-sender series key / first-read receipt as built. Layer 2 (pair judge) and the gitlink are named as not built. - Stale claims fixed: Tier-0 scope (FR-7 intro, FR-9, background-services row, feature-flow diagram) now includes sourced fan_out/loop/reminder runs; budget_vs_baseline series key (FR-8) is per sender for every sourced non-schedule run including agent; FR-10 writer callers three -> four. - Feature flow: "Pair evaluation" section; observability.md pointer. - tests/registry.json: entries for the eight tests/unit/test_940_*.py. Docs only; no code change. The ExecutionChecks / EvaluationsPanel copy still names only scheduled and agent-triggered runs; the docs say so. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): an agent key reads a pair row's check ids and reasons only (ent#940 C1) project_row reduced a Tier-1 row for a machine but passed a pair row's checks through, so the callee's own key read latency, cost and round-trip evidence on GET /agents/{name}/evaluations, GET /evaluations and GET /evaluations/{id} - the numbers deviation C keeps off the aggregate. A machine now reads schema/headline/edge and [{id, tier, source, status, reason}]; a person reads the row as stored. Red before: test_agent_key_list_route_reads_pair_rows_without_metrics_or_evidence and test_agent_key_fleet_list_and_by_id_read_pair_rows_without_metrics (extra 'metrics'). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): the Not-evaluated copy names the delegated runs ent#940 grades (ent#940 C2) ExecutionChecks and EvaluationsPanel still said only scheduled and agent-triggered runs are graded; sourced fan_out/loop/reminder runs are graded too since ent#940. Copy, its mount-spec pin and the two doc hedges that described the stale copy change together. No class changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): a finished result handed over inline is a read (ent#940 I3) record_first_reads fired only on the two GETs, so a caller that got the callee's reply from a sync chat_with_agent call and quoted its execution id was graded fail: unread_relay although it had read the result. The sync /chat, sync /task and sync POST /fan-out answers (and their idempotent replays) now write the same read_result receipt through the same insert-if-absent helper: finished-only by the run's stored status, an accepted/queued receipt answer writes none, fail-open, response unchanged. relay_unverified is not narrowed by delegation_mode. Red before: test_a_sync_chat_delivery_leaves_one_receipt, test_a_sync_task_delivery_leaves_one_receipt, test_a_sync_fan_out_delivery_receipts_each_finished_child, test_a_relay_after_an_inline_reply_is_not_unread (unread_relay). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): pair sweep grades fresh rows before provisional re-grades; a caller read failure stays provisional (ent#940 I1) Fresh candidates (no pair row) now sort before provisional re-grades, so rows whose re-grade keeps failing never starve a tick's batch. A caller read that raises is skip: caller_unreadable, re-picked like caller_running, instead of a permanent caller_missing from one blip. Mutation: with the code reverted, test_fresh_candidates_are_graded_before_provisional_re_grades and test_a_raising_caller_read_keeps_the_row_provisional go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): a callee's own failed list excludes caller-side pair failures (ent#940 I2) TD-6: an agent sees only its own failed pair checks. A pair check grades the caller's handling of the edge, so fold() counts an edge failure as a failed run on the by=pair view only (pair=True). The callee's summary failed list and /evaluations/failed outside by=pair no longer carry it; the caller still reads it as pair_failed, a person through by=pair. FR-20 and the feature flow said 'as callee in failed' — corrected. Mutation: with the service/router change reverted, test_an_agents_own_fold_never_lists_a_caller_side_failure, test_agent_summary_lists_pair_failures_only_on_the_caller_side, test_agent_key_failed_route_by_agent_carries_no_caller_side_check and test_person_caller_side_hides_a_callee_outside_scope go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(arch): list tier0_evaluator and tier0_pair_evaluator in the backend service catalog (ent#940 I7) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(eval): rename the writer-fence test to _exactly_four_callers (ent#940 I8) The fence now pins four writer sites (tier0_pair_evaluator joined in ent#940); the old _exactly_three_callers name invited a reader to 'fix' the set. Function rename only — the file, tests/registry.json and the docs reference the file name, which is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Trinity Agent (trinity) <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
vybe
added a commit
that referenced
this pull request
Nov 2, 2026
…, the pair's own rates in Delegated pairs, week-over-week Outcomes (Abilityai/trinity-enterprise#938, #940, #941, #74) Gaps found auditing the branch against the issue threads: * Delegated pairs showed the callee runs' Tier-0 pass rate as the edge's number. The row now reads the group's `pair` block (graded, pair-check pass rate, top failed pair check), and a failed run lists its `pair_failed_checks` beside its Tier-0 ones, marked as the pair's. * The execution page listed only failed gates and knew nothing of the judge or the hand-off. New `GET …/executions/{id}/evaluations` returns the run's Tier-0, judge and pair rows in one read, under the singular route's gate and the one per-caller projection (an agent key still reads findings and reason codes, never a score). ExecutionChecks lists every gate with its outcome, the judge's quality out of 5 with each dimension's verdict and reason (or why the run was skipped), and the hand-off's checks with the caller named. * Outcomes had the weekly history stored and never read it. The store reads `…/analyses`; each fleet tile says how it moved against last week, the project rows carry the done-count movement, and a Week by week line plots the fleet's rates once two weeks exist. A failed history read leaves the deltas at "no earlier week" and nothing else. * An anomaly alarm on the Needs Response card links to the agent's Schedules tab, where the incident's evidence is (the alarm text pointed to a page that does not exist; fixed in the enterprise module). Tests: test_938_run_evaluations (6), census entry; executionChecks (+5), evaluationsPanel (+2), outcomesPanel (+3), queueCardAnomalyLink (2). Co-Authored-By: Claude Fable 5.1 <[email protected]>
vybe
added a commit
that referenced
this pull request
Nov 2, 2026
…first-read receipt, delegated-trigger grading (ent#940) (#3794) * feat(eval): pair evaluator checks 1-5 + platform writer evaluator= fence (ent#940 CP-A) Layer 1, checkpoint A of Abilityai/trinity-enterprise#940. - db/evaluations: TIER0_PAIR_EVALUATOR + PLATFORM_EVALUATORS; evaluator= kwarg (default Tier-0, ValueError otherwise) threaded through upsert_platform_evaluation / insert_platform_evaluation_if_absent / latest_tier0_for_execution; unevaluated_pair_execution_ids. - db/activities: collaboration_rows_for_executions (chunked IN). - db/schedules/executions: sibling_executions (cap+1) + pair_rework_series. - database.py facade lines for all five. - services/tier0_pair_evaluator: dispatch_exists, one_sided_record, duplicate_dispatch, resend_after_receipt, wrong_route + build_context + evaluate_pair. No migration. - test_935_write_fence allowlist += the pair evaluator (additive); test_935_tier0_writer's private-method stub forwards the new argument. Mutation: removing the PLATFORM_EVALUATORS refusal turns test_the_writer_refuses_an_evaluator_outside_the_closed_set red (4/4). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair checks 6-9 + caller_running re-pick (ent#940 CP-B part 1) Layer 1, checkpoint B (sub-part 1) of Abilityai/trinity-enterprise#940. - services/tier0_pair_evaluator: relay_unverified + relayed_failed_work (gates), failed_with_side_effects + rework_bounds (signals). Relay = the caller's reply names the callee run; a relay with no caller read_result receipt between callee end and caller end fails, and a relay older than the first read_result row anywhere skips no_readback_record (receipts are written from CP-D). rework_bounds compares this turn's round-trips with the pair series p95 (>= BASELINE_MIN_RUNS caller turns), upper side only. _ts now accepts a datetime (the execution model's parsed values). - db/evaluations.unevaluated_pair_execution_ids: a pair row that carries skip: caller_running is re-picked once the caller run is terminal; a final row never is. - db/activities.earliest_collaboration_action + database.py facade line. - test_940_pair_checks: the headline-count test counts the registered gates (7) instead of the CP-A literal 5. Mutation: dropping the provisional re-pick from the candidate query turns test_a_caller_running_pair_row_is_re_picked_once_the_caller_ends red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair row metrics — latency, cost, verified (ent#940 CP-B part 2a) The pair row gains a metrics block beside its checks (never pass/fail, never in the headline): dispatch->start (callee admission to start), start->end, end->first read (the caller's first read_result receipt dated after the callee ended), the callee run's cost, and verified (the callee's own Tier-0 headline passed). Unknown is None, never 0. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair sweep as phase 2 of the Tier-0 cycle (ent#940 CP-B part 2b) tier0_sweep_service.run_cycle now runs tier0_pair_evaluator.sweep after the Tier-0 batch, under the existing tier0:leader lease (TD-5: no second lease, no new setting) and at the Tier-0 bounds (25 candidates, 4 threads, 10 s each). A hung pair evaluation leaves an all-skip evaluator_timeout pair row through insert_platform_evaluation_if_absent(evaluator=pair), so it is not re-picked and never replaces a grade that landed. The Tier-0 counts in the cycle result are unchanged; the pair counts ride under a new 'pair' key. test_935_write_fence: the pair evaluator's entry points take an execution id only, its sweep takes keyword bounds only, and it imports no FastAPI/auth type. Mutation: calling the pair sweep from the loop ahead of the lease check (and out of run_cycle) turns test_the_pair_phase_runs_only_under_the_tier0_lease [False] red, plus the cycle-order and leader [True] cases; restored byte-identical (cmp). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair read side — window join, pair fold, projection, scorecard (ent#940 CP-C) - window_rows LEFT JOINs the platform:tier0:pair row as `pair_checks` (one per run on the unique index, so a delegated run still counts once). - fold: Tier-0 counters unchanged; a disjoint `pair` block on by=pair only (TD-6) — pair_graded/passed/rate, pair_per_check_fail, latency p50 x3, cost_per_verified_outcome, round_trips_mean. Failed entries carry `pair_failed_checks` (ids + reason codes, never evidence). - project_summary: a machine reads the pair block's counts only (PAIR_MACHINE_KEYS); quality stays stripped. NON_PERSON_EVALUATORS += pair. - Agent summary gains `pair_failed`: the agent's own edge failures as caller, scoped by caller_side_filters (person: callee visible; agent key: itself only). - Scorecard: eval.pair_graded / eval.pair_passed / eval.pair_checks_passed_rate on pair series only; test_937_rollup point count re-pinned 14 -> 16. Mutation: caller_side_filters `callers=names` -> `None` turned 3 tests in test_940_pair_read.py red (agent key reading a sibling's pair failures, caller-side listing, person caller-side scope); restored byte-identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): first-read receipt on agent-key execution and fan-out result reads (ent#940 CP-D1) TD-1: an agent key's first read of another agent's FINISHED run writes one agent_collaboration activity with "action": "read_result" on the reader's own agent, related_execution_id = the run — the evidence relay_unverified grades against. Hooked on GET /api/agents/{name}/executions/{id} (get_execution_result) and GET /api/agents/{name}/fan-out/{id} (get_fan_out_result, one receipt per finished child). First read only: the id is a uuid5 over (reader, run) and the insert is on_conflict_do_nothing on the primary key, so a second read and two racing reads leave one row. No migration, no lock. Fail-open: a write that raises is swallowed; status and body are unchanged. Human reads, an agent reading its own run, and polls of a running run write nothing. Mutations (restored byte-identical, cmp): uuid4 id -> 4 red incl. test_a_second_read_writes_no_second_receipt and test_two_racing_receipt_writes_leave_one_row; try/except removed -> 2 red (test_a_receipt_write_that_raises_changes_nothing_in_the_response, test_a_fan_out_receipt_write_that_raises_changes_nothing). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): Tier-0 grades delegated fan-out, loop and reminder runs (ent#940 CP-D2) TD-2 (ent#935 addendum A, owned by #940): Tier-0 now grades fan_out, loop and reminder runs when another agent sent them (source_agent_name set); the same triggers without a sender, and 'user', stay ungraded. One rule, db.evaluations.tier0_eligible, is applied by both the candidate query and evaluate_execution. Without it a fan-out child had no Tier-0 row and hence no pair row, so the pair scorecard could not see a fan-out edge. recent_series_metrics keys a sourced non-schedule run on (agent_name, triggered_by, source_agent_name, playbook), as ruled; an unsourced agent run keeps its ent#935 key. TD-3 (series_key AND Jaccard >= 0.9, loop and distinct fan-out tasks excluded) is unchanged from CP-A; the end-to-end test pins a fan-out of three as three pair rows with no duplicate_dispatch fail. No excluded-trigger list in tests/ pinned these triggers; no test outside the 935/937/938/940 files reads the changed identifiers. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(eval): pair evaluation addendum C, delegated-trigger + receipt docs, test registry (ent#940 CP-E) - §46 addendum C, FR-18..FR-21: pair checks and skip reasons, the platform:tier0:pair row and its fence, the pair read block, and the trigger widening / per-sender series key / first-read receipt as built. Layer 2 (pair judge) and the gitlink are named as not built. - Stale claims fixed: Tier-0 scope (FR-7 intro, FR-9, background-services row, feature-flow diagram) now includes sourced fan_out/loop/reminder runs; budget_vs_baseline series key (FR-8) is per sender for every sourced non-schedule run including agent; FR-10 writer callers three -> four. - Feature flow: "Pair evaluation" section; observability.md pointer. - tests/registry.json: entries for the eight tests/unit/test_940_*.py. Docs only; no code change. The ExecutionChecks / EvaluationsPanel copy still names only scheduled and agent-triggered runs; the docs say so. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): an agent key reads a pair row's check ids and reasons only (ent#940 C1) project_row reduced a Tier-1 row for a machine but passed a pair row's checks through, so the callee's own key read latency, cost and round-trip evidence on GET /agents/{name}/evaluations, GET /evaluations and GET /evaluations/{id} - the numbers deviation C keeps off the aggregate. A machine now reads schema/headline/edge and [{id, tier, source, status, reason}]; a person reads the row as stored. Red before: test_agent_key_list_route_reads_pair_rows_without_metrics_or_evidence and test_agent_key_fleet_list_and_by_id_read_pair_rows_without_metrics (extra 'metrics'). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): the Not-evaluated copy names the delegated runs ent#940 grades (ent#940 C2) ExecutionChecks and EvaluationsPanel still said only scheduled and agent-triggered runs are graded; sourced fan_out/loop/reminder runs are graded too since ent#940. Copy, its mount-spec pin and the two doc hedges that described the stale copy change together. No class changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): a finished result handed over inline is a read (ent#940 I3) record_first_reads fired only on the two GETs, so a caller that got the callee's reply from a sync chat_with_agent call and quoted its execution id was graded fail: unread_relay although it had read the result. The sync /chat, sync /task and sync POST /fan-out answers (and their idempotent replays) now write the same read_result receipt through the same insert-if-absent helper: finished-only by the run's stored status, an accepted/queued receipt answer writes none, fail-open, response unchanged. relay_unverified is not narrowed by delegation_mode. Red before: test_a_sync_chat_delivery_leaves_one_receipt, test_a_sync_task_delivery_leaves_one_receipt, test_a_sync_fan_out_delivery_receipts_each_finished_child, test_a_relay_after_an_inline_reply_is_not_unread (unread_relay). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): pair sweep grades fresh rows before provisional re-grades; a caller read failure stays provisional (ent#940 I1) Fresh candidates (no pair row) now sort before provisional re-grades, so rows whose re-grade keeps failing never starve a tick's batch. A caller read that raises is skip: caller_unreadable, re-picked like caller_running, instead of a permanent caller_missing from one blip. Mutation: with the code reverted, test_fresh_candidates_are_graded_before_provisional_re_grades and test_a_raising_caller_read_keeps_the_row_provisional go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): a callee's own failed list excludes caller-side pair failures (ent#940 I2) TD-6: an agent sees only its own failed pair checks. A pair check grades the caller's handling of the edge, so fold() counts an edge failure as a failed run on the by=pair view only (pair=True). The callee's summary failed list and /evaluations/failed outside by=pair no longer carry it; the caller still reads it as pair_failed, a person through by=pair. FR-20 and the feature flow said 'as callee in failed' — corrected. Mutation: with the service/router change reverted, test_an_agents_own_fold_never_lists_a_caller_side_failure, test_agent_summary_lists_pair_failures_only_on_the_caller_side, test_agent_key_failed_route_by_agent_carries_no_caller_side_check and test_person_caller_side_hides_a_callee_outside_scope go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(arch): list tier0_evaluator and tier0_pair_evaluator in the backend service catalog (ent#940 I7) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(eval): rename the writer-fence test to _exactly_four_callers (ent#940 I8) The fence now pins four writer sites (tier0_pair_evaluator joined in ent#940); the old _exactly_three_callers name invited a reader to 'fix' the set. Function rename only — the file, tests/registry.json and the docs reference the file name, which is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Trinity Agent (trinity) <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
vybe
added a commit
that referenced
this pull request
Nov 2, 2026
…, the pair's own rates in Delegated pairs, week-over-week Outcomes (Abilityai/trinity-enterprise#938, #940, #941, #74) Gaps found auditing the branch against the issue threads: * Delegated pairs showed the callee runs' Tier-0 pass rate as the edge's number. The row now reads the group's `pair` block (graded, pair-check pass rate, top failed pair check), and a failed run lists its `pair_failed_checks` beside its Tier-0 ones, marked as the pair's. * The execution page listed only failed gates and knew nothing of the judge or the hand-off. New `GET …/executions/{id}/evaluations` returns the run's Tier-0, judge and pair rows in one read, under the singular route's gate and the one per-caller projection (an agent key still reads findings and reason codes, never a score). ExecutionChecks lists every gate with its outcome, the judge's quality out of 5 with each dimension's verdict and reason (or why the run was skipped), and the hand-off's checks with the caller named. * Outcomes had the weekly history stored and never read it. The store reads `…/analyses`; each fleet tile says how it moved against last week, the project rows carry the done-count movement, and a Week by week line plots the fleet's rates once two weeks exist. A failed history read leaves the deltas at "no earlier week" and nothing else. * An anomaly alarm on the Needs Response card links to the agent's Schedules tab, where the incident's evidence is (the alarm text pointed to a page that does not exist; fixed in the enterprise module). Tests: test_938_run_evaluations (6), census entry; executionChecks (+5), evaluationsPanel (+2), outcomesPanel (+3), queueCardAnomalyLink (2). Co-Authored-By: Claude Fable 5.1 <[email protected]>
vybe
added a commit
that referenced
this pull request
Nov 2, 2026
…first-read receipt, delegated-trigger grading (ent#940) (#3794) * feat(eval): pair evaluator checks 1-5 + platform writer evaluator= fence (ent#940 CP-A) Layer 1, checkpoint A of Abilityai/trinity-enterprise#940. - db/evaluations: TIER0_PAIR_EVALUATOR + PLATFORM_EVALUATORS; evaluator= kwarg (default Tier-0, ValueError otherwise) threaded through upsert_platform_evaluation / insert_platform_evaluation_if_absent / latest_tier0_for_execution; unevaluated_pair_execution_ids. - db/activities: collaboration_rows_for_executions (chunked IN). - db/schedules/executions: sibling_executions (cap+1) + pair_rework_series. - database.py facade lines for all five. - services/tier0_pair_evaluator: dispatch_exists, one_sided_record, duplicate_dispatch, resend_after_receipt, wrong_route + build_context + evaluate_pair. No migration. - test_935_write_fence allowlist += the pair evaluator (additive); test_935_tier0_writer's private-method stub forwards the new argument. Mutation: removing the PLATFORM_EVALUATORS refusal turns test_the_writer_refuses_an_evaluator_outside_the_closed_set red (4/4). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair checks 6-9 + caller_running re-pick (ent#940 CP-B part 1) Layer 1, checkpoint B (sub-part 1) of Abilityai/trinity-enterprise#940. - services/tier0_pair_evaluator: relay_unverified + relayed_failed_work (gates), failed_with_side_effects + rework_bounds (signals). Relay = the caller's reply names the callee run; a relay with no caller read_result receipt between callee end and caller end fails, and a relay older than the first read_result row anywhere skips no_readback_record (receipts are written from CP-D). rework_bounds compares this turn's round-trips with the pair series p95 (>= BASELINE_MIN_RUNS caller turns), upper side only. _ts now accepts a datetime (the execution model's parsed values). - db/evaluations.unevaluated_pair_execution_ids: a pair row that carries skip: caller_running is re-picked once the caller run is terminal; a final row never is. - db/activities.earliest_collaboration_action + database.py facade line. - test_940_pair_checks: the headline-count test counts the registered gates (7) instead of the CP-A literal 5. Mutation: dropping the provisional re-pick from the candidate query turns test_a_caller_running_pair_row_is_re_picked_once_the_caller_ends red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair row metrics — latency, cost, verified (ent#940 CP-B part 2a) The pair row gains a metrics block beside its checks (never pass/fail, never in the headline): dispatch->start (callee admission to start), start->end, end->first read (the caller's first read_result receipt dated after the callee ended), the callee run's cost, and verified (the callee's own Tier-0 headline passed). Unknown is None, never 0. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair sweep as phase 2 of the Tier-0 cycle (ent#940 CP-B part 2b) tier0_sweep_service.run_cycle now runs tier0_pair_evaluator.sweep after the Tier-0 batch, under the existing tier0:leader lease (TD-5: no second lease, no new setting) and at the Tier-0 bounds (25 candidates, 4 threads, 10 s each). A hung pair evaluation leaves an all-skip evaluator_timeout pair row through insert_platform_evaluation_if_absent(evaluator=pair), so it is not re-picked and never replaces a grade that landed. The Tier-0 counts in the cycle result are unchanged; the pair counts ride under a new 'pair' key. test_935_write_fence: the pair evaluator's entry points take an execution id only, its sweep takes keyword bounds only, and it imports no FastAPI/auth type. Mutation: calling the pair sweep from the loop ahead of the lease check (and out of run_cycle) turns test_the_pair_phase_runs_only_under_the_tier0_lease [False] red, plus the cycle-order and leader [True] cases; restored byte-identical (cmp). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair read side — window join, pair fold, projection, scorecard (ent#940 CP-C) - window_rows LEFT JOINs the platform:tier0:pair row as `pair_checks` (one per run on the unique index, so a delegated run still counts once). - fold: Tier-0 counters unchanged; a disjoint `pair` block on by=pair only (TD-6) — pair_graded/passed/rate, pair_per_check_fail, latency p50 x3, cost_per_verified_outcome, round_trips_mean. Failed entries carry `pair_failed_checks` (ids + reason codes, never evidence). - project_summary: a machine reads the pair block's counts only (PAIR_MACHINE_KEYS); quality stays stripped. NON_PERSON_EVALUATORS += pair. - Agent summary gains `pair_failed`: the agent's own edge failures as caller, scoped by caller_side_filters (person: callee visible; agent key: itself only). - Scorecard: eval.pair_graded / eval.pair_passed / eval.pair_checks_passed_rate on pair series only; test_937_rollup point count re-pinned 14 -> 16. Mutation: caller_side_filters `callers=names` -> `None` turned 3 tests in test_940_pair_read.py red (agent key reading a sibling's pair failures, caller-side listing, person caller-side scope); restored byte-identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): first-read receipt on agent-key execution and fan-out result reads (ent#940 CP-D1) TD-1: an agent key's first read of another agent's FINISHED run writes one agent_collaboration activity with "action": "read_result" on the reader's own agent, related_execution_id = the run — the evidence relay_unverified grades against. Hooked on GET /api/agents/{name}/executions/{id} (get_execution_result) and GET /api/agents/{name}/fan-out/{id} (get_fan_out_result, one receipt per finished child). First read only: the id is a uuid5 over (reader, run) and the insert is on_conflict_do_nothing on the primary key, so a second read and two racing reads leave one row. No migration, no lock. Fail-open: a write that raises is swallowed; status and body are unchanged. Human reads, an agent reading its own run, and polls of a running run write nothing. Mutations (restored byte-identical, cmp): uuid4 id -> 4 red incl. test_a_second_read_writes_no_second_receipt and test_two_racing_receipt_writes_leave_one_row; try/except removed -> 2 red (test_a_receipt_write_that_raises_changes_nothing_in_the_response, test_a_fan_out_receipt_write_that_raises_changes_nothing). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): Tier-0 grades delegated fan-out, loop and reminder runs (ent#940 CP-D2) TD-2 (ent#935 addendum A, owned by #940): Tier-0 now grades fan_out, loop and reminder runs when another agent sent them (source_agent_name set); the same triggers without a sender, and 'user', stay ungraded. One rule, db.evaluations.tier0_eligible, is applied by both the candidate query and evaluate_execution. Without it a fan-out child had no Tier-0 row and hence no pair row, so the pair scorecard could not see a fan-out edge. recent_series_metrics keys a sourced non-schedule run on (agent_name, triggered_by, source_agent_name, playbook), as ruled; an unsourced agent run keeps its ent#935 key. TD-3 (series_key AND Jaccard >= 0.9, loop and distinct fan-out tasks excluded) is unchanged from CP-A; the end-to-end test pins a fan-out of three as three pair rows with no duplicate_dispatch fail. No excluded-trigger list in tests/ pinned these triggers; no test outside the 935/937/938/940 files reads the changed identifiers. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(eval): pair evaluation addendum C, delegated-trigger + receipt docs, test registry (ent#940 CP-E) - §46 addendum C, FR-18..FR-21: pair checks and skip reasons, the platform:tier0:pair row and its fence, the pair read block, and the trigger widening / per-sender series key / first-read receipt as built. Layer 2 (pair judge) and the gitlink are named as not built. - Stale claims fixed: Tier-0 scope (FR-7 intro, FR-9, background-services row, feature-flow diagram) now includes sourced fan_out/loop/reminder runs; budget_vs_baseline series key (FR-8) is per sender for every sourced non-schedule run including agent; FR-10 writer callers three -> four. - Feature flow: "Pair evaluation" section; observability.md pointer. - tests/registry.json: entries for the eight tests/unit/test_940_*.py. Docs only; no code change. The ExecutionChecks / EvaluationsPanel copy still names only scheduled and agent-triggered runs; the docs say so. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): an agent key reads a pair row's check ids and reasons only (ent#940 C1) project_row reduced a Tier-1 row for a machine but passed a pair row's checks through, so the callee's own key read latency, cost and round-trip evidence on GET /agents/{name}/evaluations, GET /evaluations and GET /evaluations/{id} - the numbers deviation C keeps off the aggregate. A machine now reads schema/headline/edge and [{id, tier, source, status, reason}]; a person reads the row as stored. Red before: test_agent_key_list_route_reads_pair_rows_without_metrics_or_evidence and test_agent_key_fleet_list_and_by_id_read_pair_rows_without_metrics (extra 'metrics'). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): the Not-evaluated copy names the delegated runs ent#940 grades (ent#940 C2) ExecutionChecks and EvaluationsPanel still said only scheduled and agent-triggered runs are graded; sourced fan_out/loop/reminder runs are graded too since ent#940. Copy, its mount-spec pin and the two doc hedges that described the stale copy change together. No class changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): a finished result handed over inline is a read (ent#940 I3) record_first_reads fired only on the two GETs, so a caller that got the callee's reply from a sync chat_with_agent call and quoted its execution id was graded fail: unread_relay although it had read the result. The sync /chat, sync /task and sync POST /fan-out answers (and their idempotent replays) now write the same read_result receipt through the same insert-if-absent helper: finished-only by the run's stored status, an accepted/queued receipt answer writes none, fail-open, response unchanged. relay_unverified is not narrowed by delegation_mode. Red before: test_a_sync_chat_delivery_leaves_one_receipt, test_a_sync_task_delivery_leaves_one_receipt, test_a_sync_fan_out_delivery_receipts_each_finished_child, test_a_relay_after_an_inline_reply_is_not_unread (unread_relay). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): pair sweep grades fresh rows before provisional re-grades; a caller read failure stays provisional (ent#940 I1) Fresh candidates (no pair row) now sort before provisional re-grades, so rows whose re-grade keeps failing never starve a tick's batch. A caller read that raises is skip: caller_unreadable, re-picked like caller_running, instead of a permanent caller_missing from one blip. Mutation: with the code reverted, test_fresh_candidates_are_graded_before_provisional_re_grades and test_a_raising_caller_read_keeps_the_row_provisional go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): a callee's own failed list excludes caller-side pair failures (ent#940 I2) TD-6: an agent sees only its own failed pair checks. A pair check grades the caller's handling of the edge, so fold() counts an edge failure as a failed run on the by=pair view only (pair=True). The callee's summary failed list and /evaluations/failed outside by=pair no longer carry it; the caller still reads it as pair_failed, a person through by=pair. FR-20 and the feature flow said 'as callee in failed' — corrected. Mutation: with the service/router change reverted, test_an_agents_own_fold_never_lists_a_caller_side_failure, test_agent_summary_lists_pair_failures_only_on_the_caller_side, test_agent_key_failed_route_by_agent_carries_no_caller_side_check and test_person_caller_side_hides_a_callee_outside_scope go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(arch): list tier0_evaluator and tier0_pair_evaluator in the backend service catalog (ent#940 I7) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(eval): rename the writer-fence test to _exactly_four_callers (ent#940 I8) The fence now pins four writer sites (tier0_pair_evaluator joined in ent#940); the old _exactly_three_callers name invited a reader to 'fix' the set. Function rename only — the file, tests/registry.json and the docs reference the file name, which is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Trinity Agent (trinity) <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
vybe
added a commit
that referenced
this pull request
Nov 2, 2026
…, the pair's own rates in Delegated pairs, week-over-week Outcomes (Abilityai/trinity-enterprise#938, #940, #941, #74) Gaps found auditing the branch against the issue threads: * Delegated pairs showed the callee runs' Tier-0 pass rate as the edge's number. The row now reads the group's `pair` block (graded, pair-check pass rate, top failed pair check), and a failed run lists its `pair_failed_checks` beside its Tier-0 ones, marked as the pair's. * The execution page listed only failed gates and knew nothing of the judge or the hand-off. New `GET …/executions/{id}/evaluations` returns the run's Tier-0, judge and pair rows in one read, under the singular route's gate and the one per-caller projection (an agent key still reads findings and reason codes, never a score). ExecutionChecks lists every gate with its outcome, the judge's quality out of 5 with each dimension's verdict and reason (or why the run was skipped), and the hand-off's checks with the caller named. * Outcomes had the weekly history stored and never read it. The store reads `…/analyses`; each fleet tile says how it moved against last week, the project rows carry the done-count movement, and a Week by week line plots the fleet's rates once two weeks exist. A failed history read leaves the deltas at "no earlier week" and nothing else. * An anomaly alarm on the Needs Response card links to the agent's Schedules tab, where the incident's evidence is (the alarm text pointed to a page that does not exist; fixed in the enterprise module). Tests: test_938_run_evaluations (6), census entry; executionChecks (+5), evaluationsPanel (+2), outcomesPanel (+3), queueCardAnomalyLink (2). Co-Authored-By: Claude Fable 5.1 <[email protected]>
vybe
added a commit
that referenced
this pull request
Nov 2, 2026
…first-read receipt, delegated-trigger grading (ent#940) (#3794) * feat(eval): pair evaluator checks 1-5 + platform writer evaluator= fence (ent#940 CP-A) Layer 1, checkpoint A of Abilityai/trinity-enterprise#940. - db/evaluations: TIER0_PAIR_EVALUATOR + PLATFORM_EVALUATORS; evaluator= kwarg (default Tier-0, ValueError otherwise) threaded through upsert_platform_evaluation / insert_platform_evaluation_if_absent / latest_tier0_for_execution; unevaluated_pair_execution_ids. - db/activities: collaboration_rows_for_executions (chunked IN). - db/schedules/executions: sibling_executions (cap+1) + pair_rework_series. - database.py facade lines for all five. - services/tier0_pair_evaluator: dispatch_exists, one_sided_record, duplicate_dispatch, resend_after_receipt, wrong_route + build_context + evaluate_pair. No migration. - test_935_write_fence allowlist += the pair evaluator (additive); test_935_tier0_writer's private-method stub forwards the new argument. Mutation: removing the PLATFORM_EVALUATORS refusal turns test_the_writer_refuses_an_evaluator_outside_the_closed_set red (4/4). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair checks 6-9 + caller_running re-pick (ent#940 CP-B part 1) Layer 1, checkpoint B (sub-part 1) of Abilityai/trinity-enterprise#940. - services/tier0_pair_evaluator: relay_unverified + relayed_failed_work (gates), failed_with_side_effects + rework_bounds (signals). Relay = the caller's reply names the callee run; a relay with no caller read_result receipt between callee end and caller end fails, and a relay older than the first read_result row anywhere skips no_readback_record (receipts are written from CP-D). rework_bounds compares this turn's round-trips with the pair series p95 (>= BASELINE_MIN_RUNS caller turns), upper side only. _ts now accepts a datetime (the execution model's parsed values). - db/evaluations.unevaluated_pair_execution_ids: a pair row that carries skip: caller_running is re-picked once the caller run is terminal; a final row never is. - db/activities.earliest_collaboration_action + database.py facade line. - test_940_pair_checks: the headline-count test counts the registered gates (7) instead of the CP-A literal 5. Mutation: dropping the provisional re-pick from the candidate query turns test_a_caller_running_pair_row_is_re_picked_once_the_caller_ends red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair row metrics — latency, cost, verified (ent#940 CP-B part 2a) The pair row gains a metrics block beside its checks (never pass/fail, never in the headline): dispatch->start (callee admission to start), start->end, end->first read (the caller's first read_result receipt dated after the callee ended), the callee run's cost, and verified (the callee's own Tier-0 headline passed). Unknown is None, never 0. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair sweep as phase 2 of the Tier-0 cycle (ent#940 CP-B part 2b) tier0_sweep_service.run_cycle now runs tier0_pair_evaluator.sweep after the Tier-0 batch, under the existing tier0:leader lease (TD-5: no second lease, no new setting) and at the Tier-0 bounds (25 candidates, 4 threads, 10 s each). A hung pair evaluation leaves an all-skip evaluator_timeout pair row through insert_platform_evaluation_if_absent(evaluator=pair), so it is not re-picked and never replaces a grade that landed. The Tier-0 counts in the cycle result are unchanged; the pair counts ride under a new 'pair' key. test_935_write_fence: the pair evaluator's entry points take an execution id only, its sweep takes keyword bounds only, and it imports no FastAPI/auth type. Mutation: calling the pair sweep from the loop ahead of the lease check (and out of run_cycle) turns test_the_pair_phase_runs_only_under_the_tier0_lease [False] red, plus the cycle-order and leader [True] cases; restored byte-identical (cmp). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair read side — window join, pair fold, projection, scorecard (ent#940 CP-C) - window_rows LEFT JOINs the platform:tier0:pair row as `pair_checks` (one per run on the unique index, so a delegated run still counts once). - fold: Tier-0 counters unchanged; a disjoint `pair` block on by=pair only (TD-6) — pair_graded/passed/rate, pair_per_check_fail, latency p50 x3, cost_per_verified_outcome, round_trips_mean. Failed entries carry `pair_failed_checks` (ids + reason codes, never evidence). - project_summary: a machine reads the pair block's counts only (PAIR_MACHINE_KEYS); quality stays stripped. NON_PERSON_EVALUATORS += pair. - Agent summary gains `pair_failed`: the agent's own edge failures as caller, scoped by caller_side_filters (person: callee visible; agent key: itself only). - Scorecard: eval.pair_graded / eval.pair_passed / eval.pair_checks_passed_rate on pair series only; test_937_rollup point count re-pinned 14 -> 16. Mutation: caller_side_filters `callers=names` -> `None` turned 3 tests in test_940_pair_read.py red (agent key reading a sibling's pair failures, caller-side listing, person caller-side scope); restored byte-identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): first-read receipt on agent-key execution and fan-out result reads (ent#940 CP-D1) TD-1: an agent key's first read of another agent's FINISHED run writes one agent_collaboration activity with "action": "read_result" on the reader's own agent, related_execution_id = the run — the evidence relay_unverified grades against. Hooked on GET /api/agents/{name}/executions/{id} (get_execution_result) and GET /api/agents/{name}/fan-out/{id} (get_fan_out_result, one receipt per finished child). First read only: the id is a uuid5 over (reader, run) and the insert is on_conflict_do_nothing on the primary key, so a second read and two racing reads leave one row. No migration, no lock. Fail-open: a write that raises is swallowed; status and body are unchanged. Human reads, an agent reading its own run, and polls of a running run write nothing. Mutations (restored byte-identical, cmp): uuid4 id -> 4 red incl. test_a_second_read_writes_no_second_receipt and test_two_racing_receipt_writes_leave_one_row; try/except removed -> 2 red (test_a_receipt_write_that_raises_changes_nothing_in_the_response, test_a_fan_out_receipt_write_that_raises_changes_nothing). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): Tier-0 grades delegated fan-out, loop and reminder runs (ent#940 CP-D2) TD-2 (ent#935 addendum A, owned by #940): Tier-0 now grades fan_out, loop and reminder runs when another agent sent them (source_agent_name set); the same triggers without a sender, and 'user', stay ungraded. One rule, db.evaluations.tier0_eligible, is applied by both the candidate query and evaluate_execution. Without it a fan-out child had no Tier-0 row and hence no pair row, so the pair scorecard could not see a fan-out edge. recent_series_metrics keys a sourced non-schedule run on (agent_name, triggered_by, source_agent_name, playbook), as ruled; an unsourced agent run keeps its ent#935 key. TD-3 (series_key AND Jaccard >= 0.9, loop and distinct fan-out tasks excluded) is unchanged from CP-A; the end-to-end test pins a fan-out of three as three pair rows with no duplicate_dispatch fail. No excluded-trigger list in tests/ pinned these triggers; no test outside the 935/937/938/940 files reads the changed identifiers. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(eval): pair evaluation addendum C, delegated-trigger + receipt docs, test registry (ent#940 CP-E) - §46 addendum C, FR-18..FR-21: pair checks and skip reasons, the platform:tier0:pair row and its fence, the pair read block, and the trigger widening / per-sender series key / first-read receipt as built. Layer 2 (pair judge) and the gitlink are named as not built. - Stale claims fixed: Tier-0 scope (FR-7 intro, FR-9, background-services row, feature-flow diagram) now includes sourced fan_out/loop/reminder runs; budget_vs_baseline series key (FR-8) is per sender for every sourced non-schedule run including agent; FR-10 writer callers three -> four. - Feature flow: "Pair evaluation" section; observability.md pointer. - tests/registry.json: entries for the eight tests/unit/test_940_*.py. Docs only; no code change. The ExecutionChecks / EvaluationsPanel copy still names only scheduled and agent-triggered runs; the docs say so. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): an agent key reads a pair row's check ids and reasons only (ent#940 C1) project_row reduced a Tier-1 row for a machine but passed a pair row's checks through, so the callee's own key read latency, cost and round-trip evidence on GET /agents/{name}/evaluations, GET /evaluations and GET /evaluations/{id} - the numbers deviation C keeps off the aggregate. A machine now reads schema/headline/edge and [{id, tier, source, status, reason}]; a person reads the row as stored. Red before: test_agent_key_list_route_reads_pair_rows_without_metrics_or_evidence and test_agent_key_fleet_list_and_by_id_read_pair_rows_without_metrics (extra 'metrics'). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): the Not-evaluated copy names the delegated runs ent#940 grades (ent#940 C2) ExecutionChecks and EvaluationsPanel still said only scheduled and agent-triggered runs are graded; sourced fan_out/loop/reminder runs are graded too since ent#940. Copy, its mount-spec pin and the two doc hedges that described the stale copy change together. No class changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): a finished result handed over inline is a read (ent#940 I3) record_first_reads fired only on the two GETs, so a caller that got the callee's reply from a sync chat_with_agent call and quoted its execution id was graded fail: unread_relay although it had read the result. The sync /chat, sync /task and sync POST /fan-out answers (and their idempotent replays) now write the same read_result receipt through the same insert-if-absent helper: finished-only by the run's stored status, an accepted/queued receipt answer writes none, fail-open, response unchanged. relay_unverified is not narrowed by delegation_mode. Red before: test_a_sync_chat_delivery_leaves_one_receipt, test_a_sync_task_delivery_leaves_one_receipt, test_a_sync_fan_out_delivery_receipts_each_finished_child, test_a_relay_after_an_inline_reply_is_not_unread (unread_relay). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): pair sweep grades fresh rows before provisional re-grades; a caller read failure stays provisional (ent#940 I1) Fresh candidates (no pair row) now sort before provisional re-grades, so rows whose re-grade keeps failing never starve a tick's batch. A caller read that raises is skip: caller_unreadable, re-picked like caller_running, instead of a permanent caller_missing from one blip. Mutation: with the code reverted, test_fresh_candidates_are_graded_before_provisional_re_grades and test_a_raising_caller_read_keeps_the_row_provisional go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): a callee's own failed list excludes caller-side pair failures (ent#940 I2) TD-6: an agent sees only its own failed pair checks. A pair check grades the caller's handling of the edge, so fold() counts an edge failure as a failed run on the by=pair view only (pair=True). The callee's summary failed list and /evaluations/failed outside by=pair no longer carry it; the caller still reads it as pair_failed, a person through by=pair. FR-20 and the feature flow said 'as callee in failed' — corrected. Mutation: with the service/router change reverted, test_an_agents_own_fold_never_lists_a_caller_side_failure, test_agent_summary_lists_pair_failures_only_on_the_caller_side, test_agent_key_failed_route_by_agent_carries_no_caller_side_check and test_person_caller_side_hides_a_callee_outside_scope go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(arch): list tier0_evaluator and tier0_pair_evaluator in the backend service catalog (ent#940 I7) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(eval): rename the writer-fence test to _exactly_four_callers (ent#940 I8) The fence now pins four writer sites (tier0_pair_evaluator joined in ent#940); the old _exactly_three_callers name invited a reader to 'fix' the set. Function rename only — the file, tests/registry.json and the docs reference the file name, which is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Trinity Agent (trinity) <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
vybe
added a commit
that referenced
this pull request
Nov 2, 2026
…, the pair's own rates in Delegated pairs, week-over-week Outcomes (Abilityai/trinity-enterprise#938, #940, #941, #74) Gaps found auditing the branch against the issue threads: * Delegated pairs showed the callee runs' Tier-0 pass rate as the edge's number. The row now reads the group's `pair` block (graded, pair-check pass rate, top failed pair check), and a failed run lists its `pair_failed_checks` beside its Tier-0 ones, marked as the pair's. * The execution page listed only failed gates and knew nothing of the judge or the hand-off. New `GET …/executions/{id}/evaluations` returns the run's Tier-0, judge and pair rows in one read, under the singular route's gate and the one per-caller projection (an agent key still reads findings and reason codes, never a score). ExecutionChecks lists every gate with its outcome, the judge's quality out of 5 with each dimension's verdict and reason (or why the run was skipped), and the hand-off's checks with the caller named. * Outcomes had the weekly history stored and never read it. The store reads `…/analyses`; each fleet tile says how it moved against last week, the project rows carry the done-count movement, and a Week by week line plots the fleet's rates once two weeks exist. A failed history read leaves the deltas at "no earlier week" and nothing else. * An anomaly alarm on the Needs Response card links to the agent's Schedules tab, where the incident's evidence is (the alarm text pointed to a page that does not exist; fixed in the enterprise module). Tests: test_938_run_evaluations (6), census entry; executionChecks (+5), evaluationsPanel (+2), outcomesPanel (+3), queueCardAnomalyLink (2). Co-Authored-By: Claude Fable 5.1 <[email protected]>
vybe
added a commit
that referenced
this pull request
Nov 2, 2026
…rprise#936, #938, #940) - Judge tab: a refused save clears the earlier "Saved." marker, so a dismissed error never reads as saved (the one CRITICAL). - A person the agent is merely shared with is not an operator: the judge's words and a Tier-1 score are withheld from them as the comment already is, with the token findings in place; the ent#781 contract test says so. - A caller that ended `skipped` has ended: one CALLER_ENDED_STATUSES for the pair evaluator and its re-pick query, so a callee's provisional row no longer waits forever. - The refusal read is one 200-row page; a full page is unreadable, never a pass on evidence that was not read. - 0115 / tier1_one_per_run: NULL updated_at ranks the same on both backends. - Operations: Health and Evaluations render slots read the one TAB_GATES map; ExecutionChecks encodes its path segments; the rating control hides only on 403/404 and reports any other failure; the tracker-list error dismisses instead of re-fetching. Co-Authored-By: Claude Fable 5.1 <[email protected]>
vybe
added a commit
that referenced
this pull request
Nov 2, 2026
…first-read receipt, delegated-trigger grading (ent#940) (#3794) * feat(eval): pair evaluator checks 1-5 + platform writer evaluator= fence (ent#940 CP-A) Layer 1, checkpoint A of Abilityai/trinity-enterprise#940. - db/evaluations: TIER0_PAIR_EVALUATOR + PLATFORM_EVALUATORS; evaluator= kwarg (default Tier-0, ValueError otherwise) threaded through upsert_platform_evaluation / insert_platform_evaluation_if_absent / latest_tier0_for_execution; unevaluated_pair_execution_ids. - db/activities: collaboration_rows_for_executions (chunked IN). - db/schedules/executions: sibling_executions (cap+1) + pair_rework_series. - database.py facade lines for all five. - services/tier0_pair_evaluator: dispatch_exists, one_sided_record, duplicate_dispatch, resend_after_receipt, wrong_route + build_context + evaluate_pair. No migration. - test_935_write_fence allowlist += the pair evaluator (additive); test_935_tier0_writer's private-method stub forwards the new argument. Mutation: removing the PLATFORM_EVALUATORS refusal turns test_the_writer_refuses_an_evaluator_outside_the_closed_set red (4/4). Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair checks 6-9 + caller_running re-pick (ent#940 CP-B part 1) Layer 1, checkpoint B (sub-part 1) of Abilityai/trinity-enterprise#940. - services/tier0_pair_evaluator: relay_unverified + relayed_failed_work (gates), failed_with_side_effects + rework_bounds (signals). Relay = the caller's reply names the callee run; a relay with no caller read_result receipt between callee end and caller end fails, and a relay older than the first read_result row anywhere skips no_readback_record (receipts are written from CP-D). rework_bounds compares this turn's round-trips with the pair series p95 (>= BASELINE_MIN_RUNS caller turns), upper side only. _ts now accepts a datetime (the execution model's parsed values). - db/evaluations.unevaluated_pair_execution_ids: a pair row that carries skip: caller_running is re-picked once the caller run is terminal; a final row never is. - db/activities.earliest_collaboration_action + database.py facade line. - test_940_pair_checks: the headline-count test counts the registered gates (7) instead of the CP-A literal 5. Mutation: dropping the provisional re-pick from the candidate query turns test_a_caller_running_pair_row_is_re_picked_once_the_caller_ends red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair row metrics — latency, cost, verified (ent#940 CP-B part 2a) The pair row gains a metrics block beside its checks (never pass/fail, never in the headline): dispatch->start (callee admission to start), start->end, end->first read (the caller's first read_result receipt dated after the callee ended), the callee run's cost, and verified (the callee's own Tier-0 headline passed). Unknown is None, never 0. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair sweep as phase 2 of the Tier-0 cycle (ent#940 CP-B part 2b) tier0_sweep_service.run_cycle now runs tier0_pair_evaluator.sweep after the Tier-0 batch, under the existing tier0:leader lease (TD-5: no second lease, no new setting) and at the Tier-0 bounds (25 candidates, 4 threads, 10 s each). A hung pair evaluation leaves an all-skip evaluator_timeout pair row through insert_platform_evaluation_if_absent(evaluator=pair), so it is not re-picked and never replaces a grade that landed. The Tier-0 counts in the cycle result are unchanged; the pair counts ride under a new 'pair' key. test_935_write_fence: the pair evaluator's entry points take an execution id only, its sweep takes keyword bounds only, and it imports no FastAPI/auth type. Mutation: calling the pair sweep from the loop ahead of the lease check (and out of run_cycle) turns test_the_pair_phase_runs_only_under_the_tier0_lease [False] red, plus the cycle-order and leader [True] cases; restored byte-identical (cmp). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): pair read side — window join, pair fold, projection, scorecard (ent#940 CP-C) - window_rows LEFT JOINs the platform:tier0:pair row as `pair_checks` (one per run on the unique index, so a delegated run still counts once). - fold: Tier-0 counters unchanged; a disjoint `pair` block on by=pair only (TD-6) — pair_graded/passed/rate, pair_per_check_fail, latency p50 x3, cost_per_verified_outcome, round_trips_mean. Failed entries carry `pair_failed_checks` (ids + reason codes, never evidence). - project_summary: a machine reads the pair block's counts only (PAIR_MACHINE_KEYS); quality stays stripped. NON_PERSON_EVALUATORS += pair. - Agent summary gains `pair_failed`: the agent's own edge failures as caller, scoped by caller_side_filters (person: callee visible; agent key: itself only). - Scorecard: eval.pair_graded / eval.pair_passed / eval.pair_checks_passed_rate on pair series only; test_937_rollup point count re-pinned 14 -> 16. Mutation: caller_side_filters `callers=names` -> `None` turned 3 tests in test_940_pair_read.py red (agent key reading a sibling's pair failures, caller-side listing, person caller-side scope); restored byte-identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): first-read receipt on agent-key execution and fan-out result reads (ent#940 CP-D1) TD-1: an agent key's first read of another agent's FINISHED run writes one agent_collaboration activity with "action": "read_result" on the reader's own agent, related_execution_id = the run — the evidence relay_unverified grades against. Hooked on GET /api/agents/{name}/executions/{id} (get_execution_result) and GET /api/agents/{name}/fan-out/{id} (get_fan_out_result, one receipt per finished child). First read only: the id is a uuid5 over (reader, run) and the insert is on_conflict_do_nothing on the primary key, so a second read and two racing reads leave one row. No migration, no lock. Fail-open: a write that raises is swallowed; status and body are unchanged. Human reads, an agent reading its own run, and polls of a running run write nothing. Mutations (restored byte-identical, cmp): uuid4 id -> 4 red incl. test_a_second_read_writes_no_second_receipt and test_two_racing_receipt_writes_leave_one_row; try/except removed -> 2 red (test_a_receipt_write_that_raises_changes_nothing_in_the_response, test_a_fan_out_receipt_write_that_raises_changes_nothing). Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(eval): Tier-0 grades delegated fan-out, loop and reminder runs (ent#940 CP-D2) TD-2 (ent#935 addendum A, owned by #940): Tier-0 now grades fan_out, loop and reminder runs when another agent sent them (source_agent_name set); the same triggers without a sender, and 'user', stay ungraded. One rule, db.evaluations.tier0_eligible, is applied by both the candidate query and evaluate_execution. Without it a fan-out child had no Tier-0 row and hence no pair row, so the pair scorecard could not see a fan-out edge. recent_series_metrics keys a sourced non-schedule run on (agent_name, triggered_by, source_agent_name, playbook), as ruled; an unsourced agent run keeps its ent#935 key. TD-3 (series_key AND Jaccard >= 0.9, loop and distinct fan-out tasks excluded) is unchanged from CP-A; the end-to-end test pins a fan-out of three as three pair rows with no duplicate_dispatch fail. No excluded-trigger list in tests/ pinned these triggers; no test outside the 935/937/938/940 files reads the changed identifiers. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(eval): pair evaluation addendum C, delegated-trigger + receipt docs, test registry (ent#940 CP-E) - §46 addendum C, FR-18..FR-21: pair checks and skip reasons, the platform:tier0:pair row and its fence, the pair read block, and the trigger widening / per-sender series key / first-read receipt as built. Layer 2 (pair judge) and the gitlink are named as not built. - Stale claims fixed: Tier-0 scope (FR-7 intro, FR-9, background-services row, feature-flow diagram) now includes sourced fan_out/loop/reminder runs; budget_vs_baseline series key (FR-8) is per sender for every sourced non-schedule run including agent; FR-10 writer callers three -> four. - Feature flow: "Pair evaluation" section; observability.md pointer. - tests/registry.json: entries for the eight tests/unit/test_940_*.py. Docs only; no code change. The ExecutionChecks / EvaluationsPanel copy still names only scheduled and agent-triggered runs; the docs say so. Refs Abilityai/trinity-enterprise#940 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): an agent key reads a pair row's check ids and reasons only (ent#940 C1) project_row reduced a Tier-1 row for a machine but passed a pair row's checks through, so the callee's own key read latency, cost and round-trip evidence on GET /agents/{name}/evaluations, GET /evaluations and GET /evaluations/{id} - the numbers deviation C keeps off the aggregate. A machine now reads schema/headline/edge and [{id, tier, source, status, reason}]; a person reads the row as stored. Red before: test_agent_key_list_route_reads_pair_rows_without_metrics_or_evidence and test_agent_key_fleet_list_and_by_id_read_pair_rows_without_metrics (extra 'metrics'). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): the Not-evaluated copy names the delegated runs ent#940 grades (ent#940 C2) ExecutionChecks and EvaluationsPanel still said only scheduled and agent-triggered runs are graded; sourced fan_out/loop/reminder runs are graded too since ent#940. Copy, its mount-spec pin and the two doc hedges that described the stale copy change together. No class changed. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(evaluations): a finished result handed over inline is a read (ent#940 I3) record_first_reads fired only on the two GETs, so a caller that got the callee's reply from a sync chat_with_agent call and quoted its execution id was graded fail: unread_relay although it had read the result. The sync /chat, sync /task and sync POST /fan-out answers (and their idempotent replays) now write the same read_result receipt through the same insert-if-absent helper: finished-only by the run's stored status, an accepted/queued receipt answer writes none, fail-open, response unchanged. relay_unverified is not narrowed by delegation_mode. Red before: test_a_sync_chat_delivery_leaves_one_receipt, test_a_sync_task_delivery_leaves_one_receipt, test_a_sync_fan_out_delivery_receipts_each_finished_child, test_a_relay_after_an_inline_reply_is_not_unread (unread_relay). Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): pair sweep grades fresh rows before provisional re-grades; a caller read failure stays provisional (ent#940 I1) Fresh candidates (no pair row) now sort before provisional re-grades, so rows whose re-grade keeps failing never starve a tick's batch. A caller read that raises is skip: caller_unreadable, re-picked like caller_running, instead of a permanent caller_missing from one blip. Mutation: with the code reverted, test_fresh_candidates_are_graded_before_provisional_re_grades and test_a_raising_caller_read_keeps_the_row_provisional go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(eval): a callee's own failed list excludes caller-side pair failures (ent#940 I2) TD-6: an agent sees only its own failed pair checks. A pair check grades the caller's handling of the edge, so fold() counts an edge failure as a failed run on the by=pair view only (pair=True). The callee's summary failed list and /evaluations/failed outside by=pair no longer carry it; the caller still reads it as pair_failed, a person through by=pair. FR-20 and the feature flow said 'as callee in failed' — corrected. Mutation: with the service/router change reverted, test_an_agents_own_fold_never_lists_a_caller_side_failure, test_agent_summary_lists_pair_failures_only_on_the_caller_side, test_agent_key_failed_route_by_agent_carries_no_caller_side_check and test_person_caller_side_hides_a_callee_outside_scope go red. Co-Authored-By: Claude Opus 5.5 <[email protected]> * docs(arch): list tier0_evaluator and tier0_pair_evaluator in the backend service catalog (ent#940 I7) Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(eval): rename the writer-fence test to _exactly_four_callers (ent#940 I8) The fence now pins four writer sites (tier0_pair_evaluator joined in ent#940); the old _exactly_three_callers name invited a reader to 'fix' the set. Function rename only — the file, tests/registry.json and the docs reference the file name, which is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Trinity Agent (trinity) <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
vybe
added a commit
that referenced
this pull request
Nov 2, 2026
…, the pair's own rates in Delegated pairs, week-over-week Outcomes (Abilityai/trinity-enterprise#938, #940, #941, #74) Gaps found auditing the branch against the issue threads: * Delegated pairs showed the callee runs' Tier-0 pass rate as the edge's number. The row now reads the group's `pair` block (graded, pair-check pass rate, top failed pair check), and a failed run lists its `pair_failed_checks` beside its Tier-0 ones, marked as the pair's. * The execution page listed only failed gates and knew nothing of the judge or the hand-off. New `GET …/executions/{id}/evaluations` returns the run's Tier-0, judge and pair rows in one read, under the singular route's gate and the one per-caller projection (an agent key still reads findings and reason codes, never a score). ExecutionChecks lists every gate with its outcome, the judge's quality out of 5 with each dimension's verdict and reason (or why the run was skipped), and the hand-off's checks with the caller named. * Outcomes had the weekly history stored and never read it. The store reads `…/analyses`; each fleet tile says how it moved against last week, the project rows carry the done-count movement, and a Week by week line plots the fleet's rates once two weeks exist. A failed history read leaves the deltas at "no earlier week" and nothing else. * An anomaly alarm on the Needs Response card links to the agent's Schedules tab, where the incident's evidence is (the alarm text pointed to a page that does not exist; fixed in the enterprise module). Tests: test_938_run_evaluations (6), census entry; executionChecks (+5), evaluationsPanel (+2), outcomesPanel (+3), queueCardAnomalyLink (2). Co-Authored-By: Claude Fable 5.1 <[email protected]>
vybe
added a commit
that referenced
this pull request
Nov 2, 2026
…rprise#936, #938, #940) - Judge tab: a refused save clears the earlier "Saved." marker, so a dismissed error never reads as saved (the one CRITICAL). - A person the agent is merely shared with is not an operator: the judge's words and a Tier-1 score are withheld from them as the comment already is, with the token findings in place; the ent#781 contract test says so. - A caller that ended `skipped` has ended: one CALLER_ENDED_STATUSES for the pair evaluator and its re-pick query, so a callee's provisional row no longer waits forever. - The refusal read is one 200-row page; a full page is unreadable, never a pass on evidence that was not read. - 0115 / tier1_one_per_run: NULL updated_at ranks the same on both backends. - Operations: Health and Evaluations render slots read the one TAB_GATES map; ExecutionChecks encodes its path segments; the rating control hides only on 403/404 and reports any other failure; the tracker-list error dismisses instead of re-fetching. Co-Authored-By: Claude Fable 5.1 <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #936.
Summary
test_get_timeout_default_is_900→test_get_timeout_default_is_3600(default raised in feat: increase default chat execution timeout from 15m to 60m #665).TestCheckNetworkHealthClassification: renametest_{read_timeout,read_error,pool_timeout}_does_not_record→..._records_failureand flip the assertion to== 1./healthprobes treat these exceptions as agent-liveness signals and DO record on the circuit (override ofTRANSIENT_TRANSPORT_EXCEPTIONS).TestCreateFolder: add a small_wait_for_container_readyhelper that polls until the agent container is visible to the backend's Docker SDK, and call it from the two tests that actually hitPOST /files/mkdir(feat(files): create folder in File Manager (#37) #898). The other three tests in the class fail-fast before the container lookup and don't need the wait.No production code changes — tests only.
Test plan
tests/test_watchdog.py::TestTwoCycleOrphanConfirmation— 3/3 pass (already correct after fix(#921): watchdog orphan race + CB dormant self-heal + admin reset #924; left untouched).tests/integration/test_monitoring_service.py::TestCheckNetworkHealthClassification::test_{read_timeout,read_error,pool_timeout}_records_failure— 3/3 pass.tests/test_agent_timeout.py::TestTimeoutGet::test_get_timeout_default_is_3600— pass.tests/test_agent_files.py::TestCreateFolder::test_create_folder_and_list— pass (after rebuildingtrinity-agent-baseto include feat(files): create folder in File Manager (#37) #898's mkdir endpoint).tests/test_subscription_auto_switch.py::TestAutoSwitchSetting::test_get_auto_switch_default_on— passes against current dev (no change needed; the runtime default still resolves to True per Lower subscription auto-switch threshold to 1 failure and broaden to auth errors #441).Note:
tests/integration/test_monitoring_service.pyrequiresREDIS_URLto be exported beforepyteststarts (the module setslocalhost:6379at import time, buttests/conftest.pypre-loadsservices.agent_clientfirst, which capturesconfig.REDIS_URL). Pre-existing setup quirk, not introduced here.