Repository navigation
feat(pm-aggregator): apply edge-recorded decision answers on return (#17084) - #17101
Conversation
…17084) The decision-events sync gains an inbound half on its webhook leg: before the definitions publish, each stored set's events are read back from the Worker and the answers recorded at the edge (PR #17083) that the local event log does not hold are applied to the local store through recordResolutions — the laptop's own recording rules, via edge-answer, first resolution wins — and taken into the local event log verbatim (log only, never the outbox), which makes the pull idempotent. Applying before the publish matters: the publish projects from the local file, so an edge ruling the file never learned would have its summary reverted in the Worker's stored definitions by the next publish. Now the same run settles it everywhere.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 35 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Verification (lane 2347-R-F), fleet-run 46365690637 at head ffaaa6e: the test leg is 28 pass / 0 fail across decision-answers-pull (5 new tests), sync-decision-events, decision-events and decision-definitions. The run conclusion is failure only because the chained Merging on this verification (full diff read; CI is not a gate). The pre-existing tsc error is main's, not this PR's to fix here. agent=xaltha lane=2347-R-F |
Closes #17084 — the aggregator half of the #13491 answer write path (follow-on to PR #17083).
What changed
src/decision-answers-pull.ts— the inbound half of the decision-events sync:fetchWorkerSetEventsreads a set's events back from the Worker (GET /sets/<setId>/events, beside the configured/eventsendpoint, shared secret as Bearer).applyEdgeAnswerskeeps the answer-bearing events the local event log does not hold (type submit / defer / request-info, in recorded order), rebuilds each submission (the ledgerId is derived from the local set — the wire questionRef is the qid alone), and applies them throughrecordResolutions, the laptop's own recording rules, viaedge-answer. First resolution wins: an edge answer for a question the laptop has since ruled is a reported no-op, never an overwrite.appendDecisionEventsVerbatiminsrc/decision-events.ts— log only, never the outbox), applied or not: it is part of the set's history, and its presence in the log is what makes the next pull a no-op.scripts/sync-decision-events.ts— on the webhook leg, the pull runs per stored set BEFORE the definitions publish, and the publish reloads the sets afterwards. Ordering is the point: the publish projects from the local file, so applying first is what stops it reverting an edge ruling's summary in the Worker's stored definitions. A pull failure fails the run with the set named (the publish still runs), matching the definitions step's stance.Verification
Remote dispatch via fleet-run.yml against the head: aggregator
bun testfor decision-answers-pull + sync-decision-events + decision-events + decision-definitions, plusbunx tsc --noEmit. Conclusion recorded on this PR when the run lands; CI is not a merge gate.agent=xaltha lane=2347-R-F
{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-30T06:21:06Z", "session_id": null, "lane": null, "host": "htch-runtime", "worktree": "/home/hatch", "model": null, "lane_start_issues": [], "workspace_ref": { "kind": "worktree", "id": "/home/hatch", "repo": "developing-today/code", "branch": "main", "sha": "c36a28d672723b085b14125996bcd72b1931e09d" }, "auth_subject": "xaltha", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.