Commit graph Bifrost/tools/bifrost-bridge.mjs
Author SHA1 Message Date
Meta Vens
ff087a554b Watchdog notice reader: pin timeout, spawn-error, 5xx/429 and guard behaviour; say what non-2xx is
Tests only, plus wording. No change to what the reader or bridge does.

- A spawn timeout and a spawn error (ENOBUFS from a bridge that floods
  stdout) record unknown, are never re-posted, and block the closure.
  WATCHDOG_NOTICE_BRIDGE_TIMEOUT_MS overrides the 60 s timeout so the test
  reaches that branch; the default is unchanged.
- A 500/502/503/429 answer to the message POST exits 75 from the bridge, and
  through the reader is retried with the same nonce until it completes.
- allowed_mentions {parse: []} is asserted in the posted body; status exits
  non-zero while an entry is unknown and zero when none is.
- The bridge comment and docs/watchdog-notice.md no longer call a non-2xx
  answer "definite": it is retried with the same nonce, relying on
  enforce_nonce inside Discord's window, and may double-send if Discord acted
  on a 5xx outside it.

Builds. Two tests fail on Windows (SIGKILL status), as before; they pass on
Yggdrasil.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 22:56:27 +02:00
Meta Vens
1f001e11d2 Watchdog notice reader: the journal owns "sent"; only exit 75 is retried
Fix batch for Soul pass s1 (spec r3):
- Delete prune-on-absence and its test. Absence from Idunn's store no longer
  deletes a journal entry, so an empty or restored store never re-sends.
- discord-dm exits 75 only when no message can have been sent (arguments,
  token, DM channel open, non-2xx on the message POST). The reader records
  failed for 75 only; any other non-success without a message id is unknown
  and is never re-posted.
- Subject grammar is Idunn's require_id; the notice puts it in backticks.
- Times are bounded to the Date range; notice text is built before the
  running entry is written.

Builds and passes on Linux. On Windows the two tests that SIGKILL the reader
cannot pass (process.kill does not deliver a signal there).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 21:54:23 +02:00
Meta Vens
417454c28f Watchdog notice reader: Idunn incidents become owner DMs through Bifrost's own journal
tools/watchdog-notice.mjs is a one-shot reader. It reads Idunn's incident
store unlocked with SingleFileMessagePackBackingStore.pullAll, sends one opening
and one closing DM per incident through bifrost-bridge.mjs, and keeps a
bifrost.watchdog_notice_execution.v1 journal: a running entry becomes unknown
and is never re-posted, a failed one is retried with the same nonce up to five
times, terminal entries are pruned once Idunn retires the incident. The exit
status is the delivery-failure signal.

discord-dm accepts --nonce (at most 25 chars) and sends nonce with
enforce_nonce so a retry inside Discord's window returns the original message.

The tests run the CLI against the store bytes Idunn wrote (fixture from
GameCult/Idunn 7f7528b3) with a counting bridge double, and once through the
real bridge with fetch stubbed. docs/watchdog-notice.md states the CultLib
>= 8cb3b728 floor.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-09-30 21:15:18 +02:00
Meta Vens
42728a677a Remove unused postBridgeJson/postDispatchRunJson and their ensureTrailingSlash copies
REC-099: `postBridgeJson` (tools/bifrost-bridge.mjs) and
`postDispatchRunJson` (tools/dispatch-agent-requests.mjs) each occur
exactly once in their file: their own definition, with no caller.
Each was the sole caller of that file's private `ensureTrailingSlash`
copy, which becomes dead in the same cut. The `ensureTrailingSlash`
copies in agent-transport.mjs and governance-threads.mjs are separate,
still-called definitions and were left untouched.

Kill attempts that failed: none.
- `rg -n "postBridgeJson" tools/*.mjs` -> only its own (now removed)
  definition.
- `rg -n "postDispatchRunJson" tools/*.mjs` -> only its own (now
  removed) definition.
- `rg -n "ensureTrailingSlash" tools/bifrost-bridge.mjs` and the same
  against tools/dispatch-agent-requests.mjs -> confirmed each file's
  copy had exactly one caller (the function just removed) before
  cutting it.

Checks run: `node --check tools/bifrost-bridge.mjs` and
`node --check tools/dispatch-agent-requests.mjs` -> both syntax OK. No
package.json/test suite exists for these standalone tool scripts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-13 14:41:21 +02:00
Meta Vens
3bd250f811 Gate deployments with typed release authority 2026-07-16 18:28:13 +01:00
Meta Vens
cde3a78874 Move public crossings onto typed Bifrost transport 2026-07-15 22:16:07 +01:00
Meta Vens
30e594570d Enforce named future bridge surfaces 2026-06-22 16:44:14 +01:00
Meta Vens
f1f91713ad Add generic outside-world bridge request 2026-06-22 15:49:11 +01:00
Meta Vens
445c27978b Gate public bridge actions on Bifrost identity 2026-06-22 14:54:14 +01:00
Meta Vens
c533a7f98c Record Epiphany bridge provenance 2026-06-22 14:26:53 +01:00
Meta Vens
ba01b78d68 Fix Bifrost bridge runtime and fixture env isolation 2026-06-22 14:03:07 +01:00
Meta Vens
a22092feff Require receipts for non-github bridge activity 2026-06-17 12:06:20 +01:00
Meta Vens
f0661a8995 Lock recovery hatches in dispatched turns 2026-06-17 08:38:21 +01:00
Meta Vens
01bc5558af Gate dispatched GitHub CLI mutations 2026-06-17 07:53:38 +01:00
Meta Vens
d93267eb47 Enforce bridge-owned GitHub pushes in dispatch turns 2026-06-17 06:51:08 +01:00
Meta Vens
70f323c7db Use concrete GitHub comment receipts 2026-06-17 06:28:10 +01:00
Meta Vens
2281b0e63d Gate GitHub bridge actions and receipt agent runs 2026-06-17 04:03:14 +01:00
Meta Vens
35dd658185 Prepare Bifrost Reddit organizing bridge 2026-06-09 15:22:00 +01:00
Meta Vens
829e56819e Add Discord DM bridge action 2026-06-04 20:28:55 +01:00
Meta Vens
0221f298a5 Route agent requests through Codex app turns 2026-05-20 16:48:20 +01:00
Meta Vens
f8d6fd633e Add GitHub comment bridge command 2026-05-19 19:01:16 +01:00
Meta Vens
1e33a8bff6 Add Discord persona bridge path 2026-05-19 18:58:42 +01:00
Meta Vens
b1760954e9 Add Bifrost bridge actuator 2026-05-19 18:51:28 +01:00