Skip to content

feat(agents): persist image replies with bounded publication - #651

Merged
nixuuu merged 2 commits into
devfrom
feat/agent-image-publication
Nov 13, 2026
Merged

nixuuu merged 2 commits into
devfrom
feat/agent-image-publication

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Gateway zapisuje obrazy z show_images jako trwałe załączniki i mały item image_gallery. Usunięcie pliku źródłowego i restart nie usuwają obrazu; ponowienie call ID zwraca wcześniejszy receipt. Załączniki, manifest, audyt, budżet i receipt zapisują się atomowo.

  • Właściciel, worker i aktywna tura są sprawdzane w gatewayu. Lease 60 s, fencing token, 1 transfer/wątek i 2/worker. Limity: 10 obrazów, 20 MiB/plik, 50 MiB/wywołanie, 100 obrazów i 200 MiB/tura; niższe limity właściciela mają pierwszeństwo.
  • Probe poprzedza alokację; transfer ma fragmenty do 256 KiB, timeout bezczynności 10 s, kontrolę rozmiaru/nazwy i SHA-256. Bajty nie trafiają do modelu, outboxa ani journala.
  • Pipeline zachowuje sniffing, miniaturę WebP do 512 px i usuwanie EXIF/GPS/XMP. Animacje normalizuje do pierwszej klatki, SVG odrzuca z galerii. Worker nie może tworzyć manifestów.
  • Normalizacja używa celu plikowego ograniczającego zakodowany wynik: FIFO z opróżnianiem nadmiaru na Unixie, obowiązkowej blokady zakresu pliku na Windows. Timeout kodowania 30 s. Pamięć robocza dekodera/enkodera nadal podlega limitowi 100 Mpx; limit bajtów nie oznacza takiego samego limitu całkowitego RSS.
  • Proto addytywne: komenda/wynik 231, item 25; zachowane workspace 228–230 i rewind 19. WORKER_LINK_PROTOCOL = 1, update/v1 bez zmian. Stary worker dostaje jawną odmowę aktualizacji. Migracja 0137 następuje po scalonej 0136; druga migracja obrazów to 0138 w feat(agents): preserve local markdown images in replies #663.

Weryfikacja przed końcowym rebase: integracja gateway↔worker 8 pass / 53 asercje, w tym JPEG, TIFF→PNG i WebP przekraczające budżet dopiero po kodowaniu; odrzucenie nie tworzy załącznika, następna publikacja działa. Pełny lokalny zestaw tej warstwy: 2784 pass, 166 skip, 0 fail, temp czysty. Install, gen:check, typecheck, lint, format:check i web build przeszły dla wszystkich pięciu warstw na bazie workspace. Po końcowym rebase na dev c840d0301 ponownie wykonano gen, gen:check, lint i format:check — zielone; nowe pełne CI oraz sekwencyjne lokalne check:tmp z TMPDIR w /var/tmp pozostają pending. Zgodnie z decyzją użytkownika lokalne ponowienia nie blokują ustawienia ready. Natywne wykonanie Linux potwierdzone; blokady Windows wymagają natywnego odbioru.

Pomiar po WorkerLink gRPC z prawdziwym eksporterem: 52 066 907 B / 200 fragmentów / 2,305 s; 10 obrazów / 31 524 090 B / 130 fragmentów / 1,569 s; 100 Mpx / 1 354 945 B / 0,294 s. Manifesty 698 / 1979 / 313 B JSON. Wspólny proces gatewaya, eksportera i fixture miał szczyt RSS 531 517 440 B (506,9 MiB), przed dużą paczką 252 342 272 B. Pomiar zawiera źródła i alokacje fixture; nie jest pomiarem oddzielnych procesów produkcyjnych. Artefakty pozostają poza repo.

Warstwa 1 stosu #653. Cały stos scala użytkownik po zielonym CI. Visuals realizuje osobny agent.

@nixuuu
nixuuu force-pushed the feat/agent-image-publication branch from 6bda34b to 307078e Compare November 13, 2026 17:06
@nixuuu
nixuuu added this pull request to stack #653 November 13, 2026 17:06
@nixuuu
nixuuu force-pushed the feat/agent-image-publication branch 4 times, most recently from 773cf98 to b098a38 Compare November 13, 2026 20:04
@nixuuu
nixuuu marked this pull request as ready for review November 13, 2026 20:19
@nixuuu
nixuuu marked this pull request as draft November 13, 2026 20:29
@nixuuu
nixuuu force-pushed the feat/agent-image-publication branch from b098a38 to ec76710 Compare November 13, 2026 20:44
@nixuuu
nixuuu force-pushed the feat/agent-image-publication branch 2 times, most recently from 2aed2e8 to 26dd889 Compare November 13, 2026 23:11
@nixuuu
nixuuu force-pushed the feat/agent-image-publication branch from 26dd889 to efb3001 Compare November 13, 2026 23:19
@nixuuu
nixuuu marked this pull request as ready for review November 13, 2026 23:20
@nixuuu
nixuuu merged commit 5c17c4a into dev Nov 13, 2026
11 checks passed
@nixuuu
nixuuu deleted the feat/agent-image-publication branch November 13, 2026 23:59
nixuuu added a commit that referenced this pull request Nov 19, 2026
nixuuu added a commit that referenced this pull request Nov 19, 2026
## Summary

- Create, lock and read the bounded encoder output through a single
Win32 handle. Passing a Bun file descriptor to the separate CRT used by
`_get_osfhandle` could terminate the gateway process.
- Keep the OS-enforced byte limit, check the encoded size before
allocating, and close the handle on success or failure.
- Add Windows smoke coverage for an ordinary PNG and an encode that
exceeds its output budget. The smoke exercises the checkout encoder and
Sharp with Bun from the signed desktop installation.

Fixes: #651

## Incident

The reported local gateway at 0.3.0-nightly.75 repeatedly exited with
Windows status `0xc0000409` and had no liveness failures leading up to
the exits. On the affected builds, a pending image publication could
replay after reconnect and wait for its 60-second database lease. The
encoder crash reproduces on Windows with the same native status. The
reporter's log leaves the trigger for each exit undetermined.

## Verification

- The original encoder terminated the installed Bun with `0xc0000409`
during the new Windows regression. [Windows run before the
fix](https://github.com/itsoltech/canopy/actions/runs/44485713470/job/135428543438)
- Signed Windows install and both encoder regressions passed on PR head
`89027e38`. [Windows run with the
fix](https://github.com/itsoltech/canopy/actions/runs/44487422056)
- On nix-pc at `89027e38`, 26 focused tests passed through `check:tmp`
and 3 Windows-only cases were skipped. Gateway typecheck, scoped lint
and the diff check passed. An isolated real sidecar on the same gateway
implementation answered 27 probes and authenticated RPCs over 130
seconds before recovering from a forced exit.
- GitHub PR checks are pending. The reporter's Windows 11 installation
has yet to run the fix.
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