Repository navigation
fix(addie): let a certification completion retry after a known gate rejection - #9196
Conversation
…ejection The per-turn duplicate-mutation fence kept every complete_certification_module call it dispatched, including ones whose handler returned a definitive "NOT COMPLETED" gate result without writing anything. Sage would save the missing checkpoint or preliminary scores and call the identical completion again in the same turn, and the executor refused it as a duplicate external action, stranding the learner's module in progress. A normal return from an allowlisted durable-handler tool now releases the fence, matching the durable reservation and interrupted-turn replay rules that already treat those outcomes as retry-safe. A repeat after success reaches the handler's idempotent already-recorded path; a thrown handler stays fenced. Fixes #9085 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — app-only fix to Addie's durable-handler replay fence with no blocking or medium findings.
What I checked:
tool-orchestration.ts:888releases the in-turn replay fence only on a normal handler return whenhasDurableHandlerOutcome(call.name); a thrown handler stays fenced (catch at L982 does not delete). Scope limited to the six certification tools inDURABLE_HANDLER_OUTCOME_TOOLS; non-durable mutations (create_github_issue) untouched.- Load-bearing safety claim verified: repeat-after-success reaches idempotent already-recorded paths (
complete_certification_moduleL2126-2140,complete_certification_examL2763-2785) with skip-if-held credential re-checks — no double-award. - Four new tests cover gate-rejection re-dispatch, repeat-after-success, thrown-stays-fenced, and non-durable-stays-fenced.
- No protocol surface touched (no
static/schemas/source/**,docs/reference/**, ordist/**changes); changeset correctly omitted per app-only scope. CODE_VERSION bumped to 2026.11.3.
Gate evaluation: No no-auto-approve team match. gated_paths is false. high_risk is true but both reasons are (modified) with zero medium-or-higher findings (rows 3/5 require a deletion or a medium finding). No critical/high/medium findings. No prior decision. Falls through to row 9 → approve.
…ion handlers A known handler outcome does not make a repeat safe: checkpoint_teaching_progress inserts a new row per call, so replaying an older identical checkpoint later in the turn would make its evidence the latest. Limit the release to complete_certification_module and start_certification_module, which re-check every gate before writing and take their own already-recorded path on a repeat after success. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er a redirect Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve.
Clean pass. This PR narrows the durable-outcome fence release to a vetted SAME_TURN_RETRYABLE_TOOLS allowlist (complete_certification_module, start_certification_module), keeping checkpoint_teaching_progress and the exam tools fenced — a fail-closed tightening on the certification path. The subset constraint is enforced via as const satisfies, and six new dispatch tests cover the behavior. App-only change, no protocol wire surface touched, no changeset required, CODE_VERSION bump is correct.
High-risk flag is set only due to server/src/addie/** glob matches on modified files, but the reviewer found no medium-or-higher concerns, so the modifications are presumed safe (no deletions, no sensitive-category findings). gated_paths is false; no no-auto-approve team match. No Critical/High/Medium findings. Prior decision was also a clean approve.
Decision table: rows 1–8 do not fire (no critical/high/medium findings; gated_paths false; no deletions; no team gate), so falls through to row 9 → approve.
…, certification retry (adcontextprotocol#9196), release-audit changesets (adcontextprotocol#8879), reporting subscriber suspend and resume (adcontextprotocol#9199), inventory goal forecast refusal (adcontextprotocol#9206), enum hoisting annotations (adcontextprotocol#9167), format_option_ref (adcontextprotocol#8876), claim-priority indexes (adcontextprotocol#9219) Two conflicts. Resolution ledger: - semantic: package.json `test` -> union: this branch's chain (the suites it added and the build-cache and git-env steps) plus main's test:build-schemas-hoist-enum-annotations and test:build-schemas-hoist-inside-definitions, after test:build-schemas-exit-status. Every script main's chain runs is in the merged chain. Dependencies auto-merged to main's versions. - semantic: server/src/training-agent/gcs-reporting.ts imports -> union: this branch's narrow `@adcp/sdk/utils` import of canonicalize; main's randomUUID import and its added `@adcp/sdk/server` names. The rest of the file auto-merged. - mechanical: package-lock.json -> main's (auto-merged; this branch does not change it). Checks: npm ci on main's lockfile (SDK 17.0.0-beta.40), npm run typecheck, and the pre-commit hook's full run.
Fixes #9085
Root cause
Addie's tool executor fences identical mutations within one model turn.
createAddieToolExecutoradds each mutation's replay key todispatchedSideEffectsbefore dispatch and refuses a second identical call withError: Duplicate external action blocked; its prior outcome was not retried automatically.The key stayed in the set even when
complete_certification_modulereturned a definitive gate rejection. A gate rejection writes nothing. The production traces behind the escalations all follow the same sequence in one turn:complete_certification_module({module_id, scores})returnsNOT COMPLETED — … You must save at least one teaching checkpoint(or… has no preliminary_scores).checkpoint_teaching_progresssaves the missing checkpoint, with every criterion verified and preliminary scores set.complete_certification_modulecall is refused as a duplicate. Sage then tells the learner completion is blocked and escalates.The other replay guards already treat these outcomes as retry-safe. The durable reservation check in
ThreadServiceand the interrupted-turn policy inblockCheckpointedToolReplaysboth accept a normal return from aDURABLE_HANDLER_OUTCOME_TOOLShandler as a known outcome (durable_outcome: 'known'). Only the in-turn fence ignored it.Read-only production data, last 120 days: the duplicate block fired on
complete_certification_modulein 11 threads and onstart_certification_modulein 6. Each one followed a known gate result. Most learners recovered in a later turn. Two escalated learners, and one who did not escalate, are still stuckin_progress.Fix
server/src/addie/side-effect-claims.tsaddsSAME_TURN_RETRYABLE_TOOLS:complete_certification_moduleandstart_certification_module.server/src/addie/model-providers/tool-orchestration.tsreleases the fence for these two once their handler returns normally.A known outcome alone does not make a repeat safe.
checkpoint_teaching_progressinserts a new row on every call, so replaying an older identical checkpoint would make its evidence the latest. These two handlers re-check every gate before they write:NOT COMPLETEDor an unmet prerequisite, the same call made again is decided afresh through policy, the durable reservation and the handler.complete_certification_modulereturnsModule X completed! This module was already recorded as complete.with no second write and no second award.start_certification_moduleresumes the in-progress row, keeping its status andstarted_at, and advances theattemptscounter as every resume does.CODE_VERSIONis bumped to2026.11.3because this changes Addie tool dispatch. There is no changeset: this is app-only.Known residual: delivery paths that persist only at the end of the turn
On the streaming web, Slack-streaming and Tavus paths, each tool result is persisted as it ends (
buildToolResultCheckpoint). That settles the durable reservation before the next call, so the in-turn retry now goes through. The non-streaming paths (processMessageinroutes/addie-chat.ts, Slackbolt-app.ts,email-conversation-handler.ts) persist results only after the turn. There, an identical retry in the same turn is still refused, now by the durable reservation check ("durable outcome reservation failed") instead of the in-turn fence. It still fails closed, and the next turn succeeds because the end-of-turn persistence settles the earlier reservation.In production over the last 60 days, every certification thread that called these tools used a path that persists per tool. None used a non-streaming path. Persisting each durable outcome as it lands on the non-streaming paths means threading a settle callback through
ProcessMessageOptionsto eight call sites, so it is left for a follow-up.Tests
server/tests/unit/addie/model-provider-tool-orchestration.test.ts:start_certification_moduleis dispatched again after a prerequisite redirect.checkpoint_teaching_progressafter a later checkpoint is still blocked.The re-dispatch tests fail on the pre-fix executor.
Learners already blocked
The code fix does not unblock learners who are already stuck. A reviewed, idempotent backfill has been handed to a maintainer and has not been run. It completes the module from the exact checkpoint that verified every criterion, writes an
admin_module_completionsaudit row, and awards any credential that becomes eligible. No learner identifiers are in this PR.🤖 Generated with Claude Code