Skip to content

feat(hub)!: apps/hub converges to index + config (CL-8185) - #791

Merged
TheGreatAxios merged 4 commits into
mainfrom
cl-8185-hub-sweep-2
Sep 17, 2026
Merged

TheGreatAxios merged 4 commits into
mainfrom
cl-8185-hub-sweep-2

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Contributor

Summary

Owner ruling (less-is-more): apps/hub/src is deleted down to index.ts +
config.ts, except mailbox-persist.ts (chat-domain, consumed outside
packages/chat too — left for CL-8175) and the two files owned by a
concurrent sweep (native-workflow-routine-launch.ts,
inbox-unsnooze-sweep.ts — already merged out from under this branch by
the time it rebased).

Deleted outright (dead or redundant with stock):

  • mcp-credential-bindings.ts — no importer anywhere.
  • pinned-package-credential-bindings.ts (+test) — never wired into
    index.ts; chat has its own separate copy.
  • grant-conditions.ts — identical to mountHubRoutes's own stock
    default when no conditionRegistry is supplied; index.ts now builds
    the same literal locally instead of importing it.

Deleted, capability regression (see Upstream asks):
hub-error-handler.ts, in-flight-requests.ts + shutdown.ts (shutdown
is now an immediate server.stop(true) + hub.close() + exit, no drain
window), sign-in-rate-limit.ts (sign-in reverts to better-auth's own
IP-keyed limit), launch-caches.ts (perf only), tool-grants.ts
(pinned-package tool grants stubbed to none), turn-part-content-default.ts,
turn-text-snapshot.ts (optional chat port, unwired), mail-redelivery.ts,
credential-material-refresh.ts, grant-allowance.ts,
workflow-run-tenant-auth.ts (withWorkflowRunTenantAuth's tenant-subtree
bearer widening is gone; createWorkflowRunAuthenticator itself is kept,
inlined into index.ts, since stock hub-api's own workflowRunAuthenticator
deploy-mount option and several Corbits packages take this shape directly).

Kept, folded into config.ts: hub-data-dir-git-safety.ts's
assertHubDataDirGitSafety — hub boot would otherwise corrupt this very
work tree (AGENTS.md's documented HUB_DATA_DIR hazard). Called from
createHub() at boot, not from readHubConfig, so tests parsing a config
never trip real filesystem/git IO.

scripts/evals-run.ts's own AssetService construction (previously
routed through apps/hub/src/asset-service-factory.ts) moves to
packages/evals as createEvalAssetService, since @intx/hub-sessions
isn't a resolvable dependency from root-level scripts.

Upstream asks

  • No app-level onError hook in @intx/hub-api's createApp/mountHubRoutes.
  • No bounded-drain shutdown helper (in-flight tracking + timeout + reported
    cause) in @intx/hub-api or @intx/hub-sessions.
  • better-auth's sign-in rate limit has no account-keyed extension point
    (customRules only overrides window/max per path, never the key), so it
    stays IP-keyed and forgeable on a private network.
  • No SHA-keyed read cache for the launch path in @intx/hub-sessions (perf only).
  • No stock capability walk from a launch's pinned tool packages to tool:
    grants (only inline tool factories get one).
  • turn_part.content has no guaranteed DB-level default on every deployment.
  • No stock mail-redelivery-after-wake retry for sidecar-router undelivered mail.
  • No stock serving-time oauth_token refresh ahead of outbound mail.
  • No stock auto-approve gate for a parked signal correlation whose resource
    a standing grant already covers.
  • Stock hub-api only bearer-authenticates the single /workflows/deployments
    mount; nothing lets a workflow-run agent reach any other tenant route
    without a session.

Deleted tests (hard cutover, behavior removed with the code)

  • apps/hub/src/*.test.ts for every deleted file that had one:
    asset-service-factory, credential-material-refresh,
    hub-data-dir-git-safety, hub-error-handler, in-flight-requests,
    launch-caches, pinned-package-credential-bindings, shutdown,
    sign-in-rate-limit, tool-grants, turn-part-content-default,
    turn-text-snapshot.
  • apps/hub/src/hub-zero-t4-registry.test.ts — asserted
    pinned-package-credential-bindings.ts stayed free of a legacy import;
    the file is gone.
  • apps/hub/test/mail-redelivery.test.ts, shutdown-drain.test.ts — test
    modules that no longer exist.
  • apps/hub/test/git-fixture.ts — shared fixture whose only two consumers
    are both gone.
  • apps/hub/test/composition.test.ts's "sign-in rate limiting is keyed on
    the target account" describe block — asserted the deleted account-keyed
    limiter's behavior end to end.
  • apps/hub/test/config.test.ts's two signInRateLimit-specific
    assertions.

report-error-baseline.txt regenerated (stale entries for deleted files
removed; 0 new findings).

Remaining in apps/hub/src beyond index.ts/config.ts

mailbox-persist.ts (chat-domain, also consumed by chat-ui and
agent-directory — left for CL-8175), native-connector-registry.ts,
native-workflow-routine-launch.ts, inbox-unsnooze-sweep.ts (owned by a
concurrent sweep — appears already removed on main as of this rebase),
notify-delivery.ts, and their tests — none of these were in this
sweep's target file list. server.ts was not split out: hub boot still
lives in index.ts's own if (import.meta.main) block.

Test plan

  • bun run typecheck
  • bun run fmt:check / bun run lint
  • bun run check:structural (report-error baseline regenerated)
  • bun --cwd apps/hub test — non-DB-gated suites pass (66 pass, 0 fail)
  • DB-gated hub suites (composition, boot-does-not-seed,
    chat-mount, mailbox-persist, relaunch-sweep-close,
    notify-delivery) could not be verified locally: the shared local
    Postgres is saturated by other concurrently-running agents
    ("sorry, too many clients already"). CI provisions its own Postgres
    and should be unaffected — flagging for the reviewer to confirm CI
    is green on this PR.

Owner ruling (CL-8185, less-is-more): apps/hub/src is deleted down to
index.ts + config.ts except mailbox-persist.ts (chat-domain, other
consumers survive CL-8175) and the two files another concurrent sweep
owns (native-workflow-routine-launch.ts, inbox-unsnooze-sweep.ts).

Deleted outright (dead or fully redundant):
- mcp-credential-bindings.ts: no importer anywhere.
- pinned-package-credential-bindings.ts (+test): never wired into
  index.ts; chat has its own separate copy.
- grant-conditions.ts: identical to mountHubRoutes' own stock default
  when no conditionRegistry is supplied; index.ts now builds the same
  literal locally instead of importing it.

Deleted, no inline replacement (feature regression, see Upstream
asks below):
- hub-error-handler.ts: app.onError is gone; an escaping route
  exception now falls through to Hono's bare 500.
- in-flight-requests.ts / shutdown.ts: shutdown is now an immediate
  server.stop(true) + hub.close() + exit, no drain window, no
  reported cause on a hang.
- sign-in-rate-limit.ts: sign-in reverts to better-auth's own
  IP-keyed rate limit (its private-network bypass is the reason this
  ever existed).
- launch-caches.ts: the launch path's SHA-keyed read cache is gone;
  every launch re-reads tool-package tarballs and rebuilds deploy
  packs uncached (perf only, not correctness).
- tool-grants.ts: pinned-package tool grants are stubbed to none; a
  pinned tool package's calls fail closed again.
- turn-part-content-default.ts: a turn_part insert that omits
  `content` now relies on the column's own DB default.
- turn-text-snapshot.ts: chat's turnTextSnapshot port is unwired
  (optional); a client reattaching mid-turn no longer gets a
  part-cursor catch-up.
- mail-redelivery.ts: an undelivered outbound mail is no longer
  retried after waking the recipient.
- credential-material-refresh.ts: outbound mail no longer refreshes
  a tenant's due oauth_token credentials first.
- grant-allowance.ts: the parked-call auto-approve gate is gone;
  every signal correlation takes the plain parked path.
- workflow-run-tenant-auth.ts: `withWorkflowRunTenantAuth`'s
  tenant-subtree bearer widening is gone. `createWorkflowRunAuthenticator`
  itself is kept (inlined into index.ts) since it's the one concrete
  WorkflowRunAuthenticator every workflow-run-authenticated surface in
  this app takes structurally, including stock hub-api's own
  workflowRunAuthenticator deploy-mount option.

Kept, folded into config.ts (hub boot would otherwise corrupt this
very work tree, per AGENTS.md's documented HUB_DATA_DIR hazard):
- hub-data-dir-git-safety.ts's assertHubDataDirGitSafety, called from
  createHub() at boot (not from readHubConfig, which stays a pure
  parse so tests parsing a config never trip real filesystem/git IO).

scripts/evals-run.ts's own AssetService construction (previously
routed through apps/hub/src/asset-service-factory.ts) moves to
packages/evals as createEvalAssetService, since @intx/hub-sessions is
not a resolvable dependency from root-level scripts.

Upstream asks:
- No app-level onError hook in @intx/hub-api's createApp/mountHubRoutes.
- No bounded-drain shutdown helper (in-flight tracking + timeout +
  reported cause) in @intx/hub-api or @intx/hub-sessions.
- better-auth's sign-in rate limit has no account-keyed extension
  point (customRules only overrides window/max per path, never the
  key), so it stays IP-keyed and forgeable on a private network.
- No SHA-keyed read cache for the launch path in @intx/hub-sessions
  (perf only).
- No stock capability walk from a launch's pinned tool packages to
  tool: grants (only inline tool factories get one).
- turn_part.content has no guaranteed DB-level default on every
  deployment.
- No stock mail-redelivery-after-wake retry for sidecar-router
  undelivered mail.
- No stock serving-time oauth_token refresh ahead of outbound mail.
- No stock auto-approve gate for a parked signal correlation whose
  resource a standing grant already covers.
- Stock hub-api only bearer-authenticates the single
  /workflows/deployments mount; nothing lets a workflow-run agent
  reach any other tenant route without a session.

Deleted tests (hard cutover, behavior removed with the code):
- apps/hub/src/*.test.ts for every file deleted above that had one
  (asset-service-factory, credential-material-refresh,
  hub-data-dir-git-safety, hub-error-handler, in-flight-requests,
  launch-caches, pinned-package-credential-bindings, shutdown,
  sign-in-rate-limit, tool-grants, turn-part-content-default,
  turn-text-snapshot).
- apps/hub/src/hub-zero-t4-registry.test.ts: asserted
  pinned-package-credential-bindings.ts stayed free of a legacy
  import; the file is gone.
- apps/hub/test/mail-redelivery.test.ts, shutdown-drain.test.ts: test
  modules that no longer exist.
- apps/hub/test/git-fixture.ts: shared fixture whose only two
  consumers (asset-service-factory.test.ts,
  hub-data-dir-git-safety.test.ts) are both gone.
- apps/hub/test/composition.test.ts's "sign-in rate limiting is keyed
  on the target account" describe block: asserted the deleted
  account-keyed limiter's behavior end to end.
- apps/hub/test/config.test.ts's two signInRateLimit-specific
  assertions/test.

report-error-baseline.txt regenerated (4 stale entries for deleted
files removed; 0 new findings).

Remaining in apps/hub/src beyond index.ts/config.ts: mailbox-persist.ts
(chat-domain, consumed by chat-ui and agent-directory too — leaving
for CL-8175), native-connector-registry.ts, native-workflow-routine-launch.ts,
inbox-unsnooze-sweep.ts, notify-delivery.ts, and their tests — none of
these were in this sweep's file list, and the latter two are owned by a
concurrent agent. server.ts was not split out: hub boot still lives in
index.ts's own `if (import.meta.main)` block.
@linear-code

linear-code Bot commented Sep 17, 2026

Copy link
Copy Markdown

CL-8185

@TheGreatAxios
TheGreatAxios merged commit 9056c22 into main Sep 17, 2026
TheGreatAxios added a commit that referenced this pull request Sep 17, 2026
… APIs

Rebases the 79adc433 re-vendor onto main (#790 oxfmt reformat, #791 hub
composition-root reduction) and fixes what the bump broke: routeMail's
new required authenticatedSender param, deployReadyAllocation's new
reconciliation-context param, and the retirement of
SessionService.sendUserMessage (every caller now delivers a signed MIME
message through SidecarRouter.routeMail, matching
native-workflow-routine-launch.ts's existing pattern) and of
workflow_definition.origin / workflow_definition_version.wire_projection
(the routine/catalog code that read a launch body off the frozen
projection is deleted outright — schedule/{available-catalog,
deployed-cron-deployments,list-scheduled}.ts, launchable/target.ts, the
hub cron-emitter wiring, and their tests — since Interchange no longer
stores that projection at all). packages/workflows/definition-projection.ts
keeps only its pure, DB-free half (the named errors and the
schema-validated FoldedBody reader) for chat, which still needs the type
surface ahead of its own CL-8175 retirement; its two DB-touching
resolvers now fail loud with a named error instead of guessing at
retired data. Re-applies workflow-host's CL-6448 single-step grants
collapse, which the bump otherwise silently dropped.

Updates VENDORED.md and kill-dates.txt for the 79adc433 pin, drops the
delta rows upstream has since absorbed (the per-principal signing-key
series, beforeToolExtension, the message_response signal kind, the
childRunId forward), and bumps @corbits/interaction-tools past a
test-only change the freshness check caught.
TheGreatAxios added a commit that referenced this pull request Sep 17, 2026
* Re-vendor @intX agent, harness, mail-memory, mailbox, mime, workflow-deploy, hub-common at 79adc433

* Re-vendor remaining @intX packages at 79adc433

db, types, hub-api, hub-sessions, hub-agent, inference, workflow,
workflow-host copied wholesale from Interchange 79adc433, stripping
upstream test files.

* fix(vendor): rebase re-pin onto main and cut over removed Interchange APIs

Rebases the 79adc433 re-vendor onto main (#790 oxfmt reformat, #791 hub
composition-root reduction) and fixes what the bump broke: routeMail's
new required authenticatedSender param, deployReadyAllocation's new
reconciliation-context param, and the retirement of
SessionService.sendUserMessage (every caller now delivers a signed MIME
message through SidecarRouter.routeMail, matching
native-workflow-routine-launch.ts's existing pattern) and of
workflow_definition.origin / workflow_definition_version.wire_projection
(the routine/catalog code that read a launch body off the frozen
projection is deleted outright — schedule/{available-catalog,
deployed-cron-deployments,list-scheduled}.ts, launchable/target.ts, the
hub cron-emitter wiring, and their tests — since Interchange no longer
stores that projection at all). packages/workflows/definition-projection.ts
keeps only its pure, DB-free half (the named errors and the
schema-validated FoldedBody reader) for chat, which still needs the type
surface ahead of its own CL-8175 retirement; its two DB-touching
resolvers now fail loud with a named error instead of guessing at
retired data. Re-applies workflow-host's CL-6448 single-step grants
collapse, which the bump otherwise silently dropped.

Updates VENDORED.md and kill-dates.txt for the 79adc433 pin, drops the
delta rows upstream has since absorbed (the per-principal signing-key
series, beforeToolExtension, the message_response signal kind, the
childRunId forward), and bumps @corbits/interaction-tools past a
test-only change the freshness check caught.
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