Skip to content

test(photon): pin startup obligation-redelivery contract through the real PhotonAdapter send path - #11

Merged
ragnos-dev merged 1 commit into
mainfrom
claude/photon-obligation-redelivery-test
Jul 21, 2026
Merged

ragnos-dev merged 1 commit into
mainfrom
claude/photon-obligation-redelivery-test

Conversation

@ragnos-dev

Copy link
Copy Markdown

Why

Upstream PR NousResearch#67181 (in the v2026.7.20 re-baseline) added the delivery-obligation ledger: _redeliver_pending_obligations() runs at gateway startup and redelivers crash-recovered final responses via adapter.send(...).

PhotonAdapter dedupes inbound sidecar deliveries only (_handled_deliveries / _accepted_handle_deliveries); it has no outbound dedup, so the ledger's crash-ambiguity rails (visible RECOVERED_MARKER, delivered-state exclusion, MAX_ATTEMPTS cap) are the only guard against a duplicate iMessage. No photon test exercised this path.

What

One new test file, tests/plugins/platforms/photon/test_obligation_redelivery.py, driving the real GatewayRunner._redeliver_pending_obligations() against a real PhotonAdapter with only the sidecar HTTP transport stubbed (at _sidecar_call, so the real send -> format_message -> _sidecar_send chain runs; no Node sidecar, no ports). Proves:

  • an ambiguous (attempting) row redelivers with RECOVERED_MARKER surviving into the sidecar /send body; a pending row redelivers plainly and clears resume_pending
  • a successful redelivery marks the row delivered and a later boot's sweep never sends it again (exactly one /send total)
  • a sidecar send failure leaves the row failed-but-claimed, spending one attempt per boot until MAX_ATTEMPTS abandons it without a further send

The runner harness mirrors the existing tests/gateway/test_delivery_ledger.py::TestGatewayRedeliverySweep seam (the established convention for this method); fixture style mirrors test_inbound.py.

Scope

Test-only, under tests/plugins/platforms/photon/ (allowed overlay path per config/hermes_upstream_pin.yaml). No agent/, gateway/, or hermes_cli/ files touched.

Evidence

.venv/bin/python3 -m pytest tests/plugins/platforms/photon/ -q
132 passed in 16.24s   (128 existing + 4 new)

🤖 Generated with Claude Code

…real PhotonAdapter send path

PhotonAdapter dedupes inbound sidecar deliveries only; it has no outbound
dedup, so the delivery ledger's crash-ambiguity contract is the only guard
against a duplicate iMessage from a crash-recovered final response. No
photon test exercised _redeliver_pending_obligations until now.

Covers, with the sidecar transport stubbed at _sidecar_call so the real
send/format_message/_sidecar_send chain runs:
- ambiguous (attempting) rows carry RECOVERED_MARKER into the /send body;
  pending rows redeliver plainly and clear resume_pending
- a delivered row is never claimed or sent again by a later boot's sweep
- a sidecar failure leaves the row failed-but-claimed, spending exactly one
  attempt per boot until MAX_ATTEMPTS abandons it

Test-only change under tests/plugins/platforms/photon/ (allowed overlay
path); no upstream core files touched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ragnos-dev
ragnos-dev merged commit 2bc92f6 into main Jul 21, 2026
30 of 32 checks passed
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.

1 participant