Skip to content

feat(pm-aggregator): apply edge-recorded decision answers on return (#17084) - #17101

Merged
dezren39 merged 1 commit into
mainfrom
xaltha/2347-f-17084-apply-edge
Nov 30, 2026
Merged

dezren39 merged 1 commit into
mainfrom
xaltha/2347-f-17084-apply-edge

Conversation

@dezren39

@dezren39 dezren39 commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Closes #17084 — the aggregator half of the #13491 answer write path (follow-on to PR #17083).

What changed

  • New src/decision-answers-pull.ts — the inbound half of the decision-events sync:
    • fetchWorkerSetEvents reads a set's events back from the Worker (GET /sets/<setId>/events, beside the configured /events endpoint, shared secret as Bearer).
    • applyEdgeAnswers keeps 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 through recordResolutions, the laptop's own recording rules, via edge-answer. First resolution wins: an edge answer for a question the laptop has since ruled is a reported no-op, never an overwrite.
    • Every pulled event then joins the local event log verbatim (appendDecisionEventsVerbatim in src/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 test for decision-answers-pull + sync-decision-events + decision-events + decision-definitions, plus bunx 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-bot with what you need.

…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.
@coderabbitai

coderabbitai Bot commented Nov 30, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2e4bb759-82be-4396-84de-fd3a482d6144
Commits

Reviewing files that changed from the base of the PR and between 3e1da20 and ffaaa6e.

Files selected for processing: 4

  • pm-stack/aggregator/scripts/sync-decision-events.ts
  • pm-stack/aggregator/src/decision-answers-pull.ts
  • pm-stack/aggregator/src/decision-events.ts
  • pm-stack/aggregator/test/decision-answers-pull.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@dezren39
dezren39 merged commit f482d4a into main Nov 30, 2026
2 checks passed
@dezren39
dezren39 deleted the xaltha/2347-f-17084-apply-edge branch November 30, 2026 06:33
@dezren39

Copy link
Copy Markdown
Member Author

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 bunx tsc --noEmit hits test/work-mobile-views.test.ts(495,17): error TS2769 — proven pre-existing: the identical tsc dispatch against current main (run 46366858857) fails with the identical error, in a file and type family this PR does not touch. (An earlier base-SHA comparison run, 46366255049, failed at checkout and was discarded as invalid.)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Aggregator: apply edge-recorded decision answers on return (#13491 follow-on)

1 participant