Repository navigation
fix(operator-queue): an expired approval the platform did not hold is marked outcome_unknown (abilityai/trinity-enterprise#844) - #3515
Conversation
… marked outcome_unknown (Abilityai/trinity-enterprise#844) The expiry sweep (mark_expired, every poll cycle) ends a pending ask on its deadline alone and wrote every timeout identically (expired / timeout, no reason). Only a gated-skill approval names an action the platform holds; for every other approval the agent holds the action, so "the approval went stale and nothing happened" and "the approval was skipped and the action went ahead" left the same trace. Both timeout writers (mark_expired and the #3247 replace path's in-transaction expiry) now write disposition_reason = 'outcome_unknown' for an approval that is not a gate's, from one SQL CASE inside the same compare-and-set, so only the winning writer records it. Questions, alerts and gate approvals stay NULL; rows that ended earlier are never rewritten. The expired audit row carries outcome_unknown: true for those rows. No schema change: the existing disposition_reason column carries the fact. Test: tests/unit/test_ent844_expired_approval_outcome.py. Mutation check (disposition_reason=_TIMEOUT_REASON reverted to None in both writers): 5 red - test_an_approval_the_platform_did_not_hold_expires_as_outcome_unknown [agent-mcp, agent-file, None-None], test_the_replace_path_expires_the_same_way_as_the_sweep, test_the_expiry_audit_row_names_an_unknown_outcome_and_only_that; restored, 9 green. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s outcome is unknown (Abilityai/trinity-enterprise#844) queueEndingText - the one rule ResolvedCard, the queue detail and /m share - words disposition_reason 'outcome_unknown' on a timeout as "Expired - nobody answered in time; whether the action went ahead is unknown" (TIMEOUT_ENDING_REASONS; an unknown token falls back to the plain wording). ResolvedCard no longer prints a timeout's reason token as a note. Test: src/frontend/tests/unit/operatorQueueOutcomeUnknown.spec.js (3 red before the change, 7 green after; full npm run test:unit green). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ilityai/trinity-enterprise#844) Operating-room feature flow (ledger + new paragraph), database.md column comment, MCP type comment, and test registry entries for the two new suites. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…wn outcome too (Abilityai/trinity-enterprise#844) Review finding: both timeout writers stamp disposition_reason='outcome_unknown', but only the sweep's `expired` audit row carried `outcome_unknown: true`. The #3247 replace path in raise_ask built its own inline audit row without it, so the same bypass read differently in the audit trail depending on which writer the clock used. One builder (`_expired_audit`) now serves both. The new test drives the replace path through ask_service.raise_ask and goes red without the fix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n included (Abilityai/trinity-enterprise#844) Review finding: QueueItemDetail rendered queueEndingText only for a platform ending, so an expired approval fell through to the person-answer branch ("by · …") and the outcome_unknown marker never reached the detail panel, which is one of the surfaces the PR and AC3 rely on. A clock ending now renders through the shared ending rule. The mounted spec goes red without the fix. Co-Authored-By: Claude Opus 5.5 <[email protected]>
/review ReportBranch: feature/ent844-approval-sweep-audit → dev (merge-base diff)
Execution coverage (Step 2.5)
Neither new test file contains a source-text assertion. Fix mutation: I reverted both writers to Critical Findings (both fixed)[C1] Incomplete fix (4.14): the second timeout writer's audit row had no marker (Confidence: 9/10). Fixed in d64b598. [C2] AC3: the queue detail panel never showed the marker (Confidence: 9/10). Fixed in 1282349. Informational Findings[I1] All writers that end an ask were checked (Confidence: 9/10). I grepped every
The only by-age endings of a pending ask are the two timeout writers, and both are covered. [I2] Marker lifetime equals row lifetime (Confidence: 8/10). The retention sweep still hard-deletes terminal rows after [I3] The Workspace and file write-back do not carry the marker (Confidence: 7/10). The Workspace projection withholds [I4] Replace-path expiry CAS does not re-check Clean Categories
Tests run
Summary
🤖 Generated with Claude Code |
Summary
An approval the clock ends no longer reads the same whether or not anything held its action. When the expiry sweep ends a pending approval whose action the platform does not hold, the ending is now recorded as
disposition_reason = 'outcome_unknown'. That covers every approval except a gated-skill one, for example an agent asking before it merges a PR. The marker shows up on the API rows, in the agent readback, in theexpiredaudit row and on the Operations resolved card. This is option (b) from the issue's acceptance criteria.Root cause
OperatorQueueOperations.mark_expired(run on every operator-queue poll cycle) and the #3247 replace path's in-transaction expiry end any pending ask pastexpires_at. Both wrote the same ledger values every time:expired/disposed_by='timeout'/ no reason. Only a gated-skill approval (raised_by='gate') names an action the platform holds, and when that one expires nothing runs. Every other approval names an action the agent holds, and the agent can go ahead without an answer. So afterwards, "went stale, nothing happened" and "skipped, the action happened anyway" left identical traces.The fix
db/operator_queue.py: a single SQLCASE(_TIMEOUT_REASON) runs inside the same compare-and-set UPDATE in both timeout writers. It writesoutcome_unknownwhentype='approval'and the row is not a gate row (the existing_NOT_A_GATE_ROWpredicate, so legacy NULL-raiser rows count too). Questions, alerts and gate approvals stay NULL. Only the writer that wins the CAS records the marker. Rows that already ended are never rewritten.services/ask_service.expire: theexpiredaudit row getsoutcome_unknown: truein its details. It is a boolean, because the reason text never goes into an audit row.queueEndingTextis the one rule shared by ResolvedCard, the queue detail and /m. It now reads "Expired — nobody answered in time; whether the action went ahead is unknown" (TIMEOUT_ENDING_REASONS). ResolvedCard no longer prints a timeout's token as a note.disposition_reasoncolumn already reaches the API (person and machine views) and the agent readback. The Workspace projection still does not expose it, as before.database.mdcolumn comment, the MCP type comment, andtests/registry.json.Why (b) and not (a): for an agent-held approval the platform cannot see whether the action happened, so a sweep that "checks the action's outcome" has nothing to check. Never expiring these items would change the agreed "denied by timeout" contract and leave asks pending forever. (b) is the smallest change that records the truth.
Tests
tests/unit/test_ent844_expired_approval_outcome.py, 9 tests on real SQLite:disposition_reason=None. Five tests went red:test_an_approval_the_platform_did_not_hold_expires_as_outcome_unknown[agent-mcp|agent-file|None-None],test_the_replace_path_expires_the_same_way_as_the_sweepandtest_the_expiry_audit_row_names_an_unknown_outcome_and_only_that. With the fix restored, all 9 pass.src/frontend/tests/unit/operatorQueueOutcomeUnknown.spec.js: 3 tests failed before the frontend change; all 7 pass after it.tests/unitthat touchesoperator_queue,cleanup_serviceorask_service(143 files): 4122 passed, 6 skipped, 7 xfailed.npm run test:unitinsrc/frontend: 5457 passed.Product decisions taken (please confirm)
outcome_unknownondisposition_reason. The agent's own readback also sees it.raised_by='gate'and recorded on the skill-gate request.Fixes abilityai/trinity-enterprise#844
🤖 Generated with Claude Code