Repository navigation
refactor(gateway): split the gateway core, api and linked computers - #51
Merged
Merged
Conversation
nixuuu
added a commit
that referenced
this pull request
Nov 13, 2026
Isolate event persistence per thread, resolve archived and deleted backlogs durably, and retain legacy delivery until the gateway is upgraded. Add redacted ingest diagnostics and recovery coverage. Related: #51
nixuuu
added a commit
that referenced
this pull request
Nov 13, 2026
Isolate event persistence per thread, resolve archived and deleted backlogs durably, and retain legacy delivery until the gateway is upgraded. Add redacted ingest diagnostics and recovery coverage. Related: #51
nixuuu
added a commit
that referenced
this pull request
Nov 13, 2026
Isolate event persistence per thread, resolve archived and deleted backlogs durably, and retain legacy delivery until the gateway is upgraded. Add redacted ingest diagnostics and recovery coverage. Related: #51
nixuuu
added a commit
that referenced
this pull request
Nov 13, 2026
Isolate event persistence per thread, resolve archived and deleted backlogs durably, and retain legacy delivery until the gateway is upgraded. Add redacted ingest diagnostics and recovery coverage. Related: #51
nixuuu
added a commit
that referenced
this pull request
Nov 13, 2026
…620) A background task can outlive its thread's archive. When Claude reports its completion by starting a native follow-up turn, the visibility trigger rejects it. The previous ingest drain disconnected the entire worker every 11 seconds and interrupted unrelated running turns. Archived threads now retain late output for existing turns and background-task state, while completion notes are durably cancelled in the task-end transaction. Background processes keep running; neither the platform note nor a native Claude follow-up starts a new turn after archive. Unarchiving shows the completed task without replaying its continuation. An additive lifecycle snapshot/live message tells capable workers to suppress native wakes and stale StartTurn commands; snapshot ordering preserves newer lifecycle updates. Gateway ingest resolves older journals automatically: unknown archived turns become durable quarantine notices; deleted threads receive only an ACK cursor, without retaining new payload/history/quarantine or resurrecting the thread. Other storage failures retry per thread with backoff, then quarantine the original event. An unavailable durable fallback retains the worker journal without draining the connection. WorkerLink protocol remains 1. Old workers recover against the new gateway. New workers encountering an old gateway's ingest drain durably defer all then-unacknowledged journals (the old message identifies no offending thread) and resume them when the gateway is upgraded. Diagnostics recognize failed, dropped, quarantined and deferred ingest templates, redact thread/worker IDs and payloads, and expose aggregate counters. Polish execution, lifecycle, durability, protocol and diagnostics documentation describes the policy. Validation: - All CI checks passed for aa005da: static checks, all four test shards (each through check:tmp), web/Linux builds and aggregate validation. - Local install, gen:check, typecheck, lint, format:check and web build passed with nice. - Real Claude SDK adapter + SQLite + gRPC: background app server → archive → offline completion/native wake → reconnect; no new turn/drain, unrelated turn survives and finishes, unarchive does not wake the task. Final-head check:tmp: 1 test / 13 assertions passed, temp directory empty. - Old-protocol completion/follow-up replay, archive/delete recovery, lost ACKs, gateway/journal restarts, transient retry exhaustion and successful-event ordering: 5 tests / 66 assertions passed locally. Legacy-gateway recovery, existing event-storage regressions and log-export security tests also passed. - Local full-suite limitation: the first sequential run failed two bot-files assertions and a bot-handoff timeout under heavy shared-host load; those complete files then passed separately (9/83 and 10/91) and in the second full run. The second full run reached 504 passing tests before computer-moves reported “Laptop C is unreachable” (run 3/20); --bail also bypassed global temp cleanup, so that local full check was not clean. No unrelated production code or test deadlines were changed. The complete CI suite and its temp-directory gates are green. Copy audit (§8): adds sentence-case diagnostic labels (“Event storage failures”, “Events dropped after deletion”, “Events quarantined”, “Journals deferred until gateway update”) and the plain timeline notice “Automatic follow-up skipped because this thread is archived or deleted.” The notice explains why work did not start and contains no user content or identifiers. No controls/layout changed; no browser verification was performed. Related: #51
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Code-quality phase 3, area A (docs/code-quality.md):
apps/gatewayexcept store/bots/connectors. All 22 size findings in 13 files → 0 (lint on the area: 0 diagnostics, all rules); 76 modules extracted, behaviour-preserving moves, original exports and import paths kept, no size suppressions.apps/gateway/src/)core/core.tscomputers/runtime.tscomputers/agents.tscomputers/shared.tscomputers/moves.tscomputers/move-state.tsapi/routed.tsapi/ui-service.tscore/agent-bus.ts,core/cli-tools.ts,core/worker-ssh.ts,computers/remote.ts,computers/mirror.tsChecks: install, gen:check, typecheck, format:check, web build; linked-computer/queue integration files ×5 (475 pass); two full check:tmp runs 830 pass / 0 fail.