@cohortapp/agent-sdk 2.18.31 → 2.18.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cohortapp/agent-sdk",
3
- "version": "2.18.31",
3
+ "version": "2.18.32",
4
4
  "description": "Cohort Agent SDK — autonomous AI colleague runtime. Deploy senior AI colleagues on dedicated Mac minis, wired to the Cohort operating surface.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1652,6 +1652,38 @@ export function markNoticeSaid(rec, notice, now) {
1652
1652
  */
1653
1653
  async function sayOutcomeNotice(o) {
1654
1654
  const { rec, notice, text, item, kind, now } = o;
1655
+
1656
+ // ── NO OUTCOME NOTICE REACHES A DOCUMENT, AT THE CHOKEPOINT ───────────────
1657
+ //
1658
+ // 2.18.30 put this test in `settleSession`, which covered the failed,
1659
+ // timed-out and silently-exited branches and MISSED the sweep's own. A seat
1660
+ // running 2.18.30 then posted the INTERRUPTED variant onto a plan document at
1661
+ // 11:49:10Z — "was cut off part-way — the session running it stopped and a new
1662
+ // one took over" — because `sweepObligations` branch (d) emits through here
1663
+ // without passing through `settleSession` at all. Branch (c), the
1664
+ // past-every-timeout case, had the same hole.
1665
+ //
1666
+ // So the guard belongs HERE rather than at each branch. This function is the
1667
+ // single chokepoint every outcome notice passes through — three callers today
1668
+ // — and a fourth branch added later is covered by construction instead of
1669
+ // reintroducing the defect. Patching three sites and trusting the next author
1670
+ // to remember is how 2.18.30 shipped incomplete.
1671
+ //
1672
+ // WHY THE INTERRUPTED VARIANT IS THE WORST ONE TO LEAVE UNGUARDED. Its trigger
1673
+ // is `rec.daemonPid !== process.pid && !alive(rec.daemonPid)` — a daemon that
1674
+ // was replaced. An AUTOUPDATE RELAUNCH is exactly that, so every seat taking a
1675
+ // release posts one of these for whatever obligation was in flight when it
1676
+ // restarted. On a document surface that makes a release itself the trigger for
1677
+ // a comment nobody asked for, fleet-wide, once per upgrade.
1678
+ //
1679
+ // A reply is unaffected: replies go out through `deliver` directly. Only
1680
+ // OUTCOME notices pass through here, and a document never asked for one.
1681
+ if (isDocumentSurface(rec)) {
1682
+ counters.bump("assurance.notice_withheld_document", { notice, service: rec && rec.service });
1683
+ markNoticeSaid(rec, notice, now);
1684
+ return { sent: false, reason: "document-surface" };
1685
+ }
1686
+
1655
1687
  if (noticeAlreadySaid(rec, notice)) {
1656
1688
  console.log(`[assurance] ${notice} notice for ${rec.key} already delivered to ${rec.channel} — not repeating it`);
1657
1689
  counters.bump("assurance.notice_deduped", { notice, scope: "obligation" });