Skip to content

feat: add Hermes-powered T3 Work - #4604

Open
maria-rcks wants to merge 34 commits into
pingdotgg:codex/v1-v2-state-migrationfrom
maria-rcks:hermes/h0-conformance
Open

feat: add Hermes-powered T3 Work#4604
maria-rcks wants to merge 34 commits into
pingdotgg:codex/v1-v2-state-migrationfrom
maria-rcks:hermes/h0-conformance

Conversation

@maria-rcks

@maria-rcks maria-rcks commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Stack

This is a cross-fork draft stacked directly on #4400 (codex/v1-v2-state-migration). Its parent is the current #4400 head, 80082809973557d1cec7f7107932a4db1d37f0e7.

Summary

  • Add Hermes as a first-class orchestration-v2 provider with managed local serve startup, attachment to compatible running instances, reconnect/reconciliation, durable bindings, model/reasoning selection, command support, tool-call visibility, and provider error terminalization.
  • Add the projectless T3 Work experience across web and mobile: dedicated workspace switching, fresh-context chats, unsettled/settled/pinned thread handling, Main, clear/delete history, replies, commands, settings, and non-git behavior.
  • Add transport onboarding/import for recent Discord/Telegram/etc. sessions with an age control, canonical Work-project ownership, lazy durable history hydration, settlement classification, and profile-scoped reset/re-import.
  • Add image/video/PDF/file uploads and rendering, imported Hermes cache media, MEDIA: output handling, reply normalization, and safe durable asset access.
  • Expose T3 orchestration MCP to Hermes through authenticated, capability-scoped, lifecycle-revoked per-session leases so Hermes can delegate coding tasks to selected providers/models when the gateway advertises session_mcp.
  • Add Hermes cron/proactive infrastructure and settings, Hermes ACP support for Code mode, and a disabled OpenClaw “Soon” gateway entry.
  • Add a pinned Hermes conformance harness, sanitized protocol fixture, evidence template, and integration documentation.

Reliability and security

  • T3 Work runs do not request Git filesystem checkpoints, preventing non-git chats from hanging in checkpoint baseline capture.
  • Permanent provider-start failures terminalize instead of leaving threads stuck in Working.
  • Import and full-history reset resolve the canonical Work project server-side, validate provider/profile ownership, preserve unrelated threads, and reject reset while mutations are unsettled.
  • Import is disabled unless configured and requires an evidence-backed negotiated profile.import + session.lifecycle capability inventory; legacy gateways are not granted synthetic optional/mutating capabilities.
  • MEDIA: ingestion is confined to canonical Hermes-owned cache roots by default. Additional roots require explicit operator configuration; traversal and symlink escapes are rejected.
  • MCP credentials are hashed, audience/capability checked, atomically rotated, and revoked with their thread/session lifecycle without breaking long-running sessions via wall-clock expiry.
  • A forward migration repairs development databases that ran the earlier unscoped Hermes import ledger.

Verification

  • 67 changed test files passed, 746 tests total.
  • Typechecks passed for @t3tools/contracts, @t3tools/shared, @t3tools/client-runtime, t3, @t3tools/web, @t3tools/mobile, and @t3tools/scripts.
  • Targeted lint, formatting, git diff --check, and the staged commit hook passed.
  • Release review included adversarial coverage for cross-profile/provider reset isolation, forged project IDs, unsettled mutations, media traversal/symlink escape, long-lived MCP sessions, and multi-environment mobile routing.

Browser/dev-server/simulator testing was intentionally not run for this handoff. CodeRabbit CLI was installed but signed out, so its external review was unavailable; the branch received independent Sol-medium backend, client, security, and integration reviews instead.

Current protocol constraints

  • T3 orchestration MCP delegation is enabled only when the connected Hermes gateway advertises safe ephemeral session_mcp lease support; the pinned legacy gateway remains correctly reported as blocked rather than receiving unsafe fallback behavior.
  • Remote Hermes endpoints remain subject to the connection-security policy and explicit authentication configuration.
  • OpenClaw is visible but intentionally disabled as “Soon”; this PR includes the provider skeleton, not a production-enabled gateway.

UI Changes — Screenshots & demos

All media below is from live end-to-end runs against a real Hermes gateway (Codex OAuth, GPT‑5.5), through both T3 Work and T3 Code.

Demo videos

Full e2e pass — Hermes code work, attachments (image/PDF/file/video), MEDIA output, delegation:

Hermes e2e demo

Reload dedupe + attachment-only rendering verification (fresh and older Hermes Code threads render each message exactly once after hard reload):

Dedupe and attachment rendering demo

Hermes in T3 Work

Image upload in a Work thread — Hermes describes the attached gradient:

Work thread with image attachment

Hermes generates an image via its terminal tool; the MEDIA: output renders as an image bubble:

MEDIA output rendered

Subagent delegation — spawn acknowledged once, then the result reported back:

Delegation spawn

Delegation answer

Hermes tool inventory surfaced natively (delegate_task, cronjob, skill_manage, project tools, …):

Tool inventory

Hermes model picker (provider models incl. Codex OAuth) with the "Delegated tasks" panel:

Model picker and delegated tasks

Session import

Imported thread keeps its historical timestamp (6:47 AM) and settled state Imported threads keep historical sidebar ages, not "now"
Imported thread history Historical sidebar ages

Hermes in T3 Code

Hermes as a coding provider on a normal Code project — native Updated greet.py file-change activity, thread classified into the Code sidebar:

Hermes in Code tab

Note

Add Hermes-powered T3 Work workspace with session import, cron, skills, and ACP driver support

  • Introduces a T3 Work workspace mode alongside T3 Code in web and mobile sidebars, filtering threads by provider driver kind (Hermes vs others) and routing new conversations to a Hermes-backed project.
  • Adds the hermes provider driver (HermesDriver.ts), hermesAcp ACP driver (HermesAcpDriver.ts), and openclaw ACP driver (OpenClawDriver.ts) to the built-in driver registry.
  • Adds a HermesServeAdapterV2 and HermesAcpAdapterV2 orchestration adapter with full session/thread/turn lifecycle, MCP lease handling, and media persistence against a Hermes gateway (HermesServeAdapterV2.ts).
  • Implements Hermes session import (discovery, import, history reset), cron management, and skills browsing via new WebSocket RPCs and corresponding settings pages (HermesSessionImportService.ts, HermesCronSettings.tsx, HermesSkillsSettings.tsx).
  • Adds chat composer support for file, PDF, and video attachments with provider-aware validation, inline video rendering, and updated markdown media rendering (ChatComposer.tsx, MarkdownMedia.tsx).
  • Adds six new SQLite migrations (44–49) for Hermes session bindings, mutation intents, session imports, proactive events, and title/branch lineage.
  • Introduces HermesConnectionSecurity for endpoint classification and HermesServeRuntime to attach to or launch a local Hermes gateway process (HermesConnectionSecurity.ts, HermesServeRuntime.ts).
  • Risk: new migrations are irreversible; enabling the Hermes provider also sets the enableHermes rollout flag and creates a T3 Work backing project automatically on first use.

Macroscope summarized f024045.


Note

Medium Risk
Work launches depend on correct Hermes/t3-work routing and prepareWorkspace: false propagating through mobile outbox and turn bootstrap; server asset and Hermes remote/cron paths add security-sensitive surface area but include explicit fail-closed checks and tests.

Overview
Mobile gains a persisted T3 Work / T3 Code workspace switch in the home header, sidebar, and split layouts. Lists and pending outbox items are filtered by provider driver (Hermes vs coding providers) via new mobileWorkspace helpers; Work mode forces thread-list v2, shows an Inbox header, and hides project filters.

Starting a task in Work resolves a Hermes backing project and model through resolveHermesConversationTarget, opens a New conversation draft with preselected Hermes model, uses work-scoped composer drafts, and sends prepareWorkspace: false through the outbox and thread.turn.start bootstrap so routing-only projects do not run workspace prep. Code keeps the existing new-task flow. Hermes and OpenClaw provider icons are added to the thread list.

Server changes in this diff extend signed asset URLs to workspace videos and browser artifacts (safe filenames, O_NOFOLLOW streaming), broaden attachment filename extensions, and add t3WorkDir / browserArtifactsDir derived paths. Hermes connection security assesses loopback vs remote endpoints (pairing token, TLS fingerprint, kill switches) and blocks unsupported remote verification. Hermes cron projects gateway capability inventory into list/mutate APIs with shared clients, operation-id deduplication, and execution provenance/deduping.

Reviewed by Cursor Bugbot for commit f024045. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6b33c0a0-f987-409f-a66a-2f06feb8bd0e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Jul 27, 2026

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effect service review: one error-modeling convention violation found in the new Hermes service code. Details inline.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/hermes/HermesProactiveEventRepository.ts Outdated
Comment thread apps/server/src/hermes/HermesSessionBindingRepository.ts
Comment thread apps/server/src/hermes/HermesHistoryNormalization.ts Outdated
Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/mobile/src/lib/mobileWorkspace.ts Outdated
Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/mobile/src/features/threads/NewTaskDraftScreen.tsx Outdated
Comment thread apps/server/src/assets/AssetAccess.ts Outdated
Comment thread apps/mobile/src/features/home/HomeHeader.tsx Outdated
Comment thread apps/server/src/hermes/HermesProactiveEventRepository.ts
@maria-rcks
maria-rcks marked this pull request as ready for review July 27, 2026 03:28
Comment thread apps/mobile/src/features/threads/ThreadNavigationSidebar.tsx
Comment thread apps/mobile/src/features/home/HomeScreen.tsx Outdated
Comment thread apps/mobile/src/features/threads/NewTaskDraftScreen.tsx
Comment thread apps/server/src/hermes/HermesHistoryNormalization.ts
Comment thread apps/server/src/hermes/HermesCron.ts
@macroscopeapp

macroscopeapp Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

1 blocking correctness issue found. Diff is too large for automated approval analysis. A human reviewer should evaluate this PR.

You can customize Macroscope's approvability policy. Learn more.

Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/mobile/src/features/threads/NewTaskDraftScreen.tsx

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Effect service review found error-modeling convention violations in the new Hermes services. Two new findings are noted inline below. A previously reported issue in HermesProactiveEventRepository.ts (the detail/message derived from cause) is still present at this commit but is not re-flagged here to avoid duplicating the earlier comment.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/hermes/HermesSessionImportService.ts Outdated
Comment thread apps/server/src/hermes/HermesSessionCatalog.ts Outdated
Comment thread apps/web/src/components/settings/HermesSkillsSettings.tsx Outdated
Comment thread apps/server/src/hermes/HermesSessionCatalog.ts
Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/server/src/hermes/HermesSessionCatalog.ts
Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/web/src/components/settings/HermesSkillsSettings.tsx Outdated
Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/server/src/hermes/HermesCron.ts Outdated
Comment thread apps/server/src/hermes/HermesCron.ts Outdated
Comment thread apps/server/src/hermes/HermesSkills.ts Outdated
Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/server/src/hermes/HermesGatewayClient.test.ts
Comment thread apps/server/src/hermes/HermesGatewayClient.ts
Comment thread apps/server/src/hermes/HermesSessionImportService.ts
to: "completed",
now: DateTime.formatIso(yield* DateTime.now),
});
yield* hydrateThread(threadId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import hydrate failures stay empty

High Severity

Import now marks the ledger completed and then calls hydrateThread, whose failures are only logged. A transient hydrate error leaves a completed import with no projected transcript. Combined with the new 4007 read-only resume path, a later vanished upstream session can never recover that history.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ab7d3f0. Configure here.

projectId: backingProject.id,
title: session.title || session.preview || "Hermes session",
isMain: false,
...(startedAt === undefined ? {} : { createdAt: startedAt }),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Settle wipes historical updatedAt

Medium Severity

Imported settled sessions get a historical createdAt from started_at, then immediately receive thread.settle, which sets updatedAt to wall-clock now. Until a successful hydrate rewrites activity from message times—or forever when history is empty or hydrate fails—those threads sort and appear as freshly active at import time.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ab7d3f0. Configure here.

}
if (navigation.kind === "new-chat") {
if (nextWorkspace === "work" && openWorkComposer()) return;
void router.navigate({ to: "/" });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Work switch opens Code landing

Medium Severity

When switching to Work and openWorkComposer fails, navigation falls through to / after setWorkspace("work"). The index route starts a Code draft for the most recent project, so the sidebar is Work while the main pane opens a Code composer—especially during Hermes setup when Work is not ready yet.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ab7d3f0. Configure here.

Comment thread apps/web/src/components/SidebarV2.tsx Outdated
@juliusmarminge
juliusmarminge force-pushed the codex/v1-v2-state-migration branch 2 times, most recently from 4e8f49c to 9fd6b62 Compare July 27, 2026 17:23
@juliusmarminge
juliusmarminge deleted the branch pingdotgg:codex/v1-v2-state-migration July 27, 2026 19:18
maria-rcks and others added 2 commits July 27, 2026 20:37
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- retry import hydration and log at error level so a transient gateway
  failure cannot silently leave a completed import without a transcript
- leave the inherited boundary unrecorded while history reads empty so a
  later full history still receives import normalization and rehydration
- resolve MEDIA output protocol inside rehydrated tool activities into
  durable attachment markers instead of leaving raw MEDIA: text
- historical settles stamp updatedAt from settledAt so imported threads
  keep sorting by when the work actually ended

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread apps/server/src/orchestration-v2/Adapters/HermesServeAdapterV2.ts
Comment thread apps/server/src/orchestration/decider.ts
maria-rcks and others added 5 commits July 27, 2026 21:38
- close() rejects sent in-flight mutations with
  HermesGatewayMutationIndeterminateError instead of a connection error
- reconcileMutation only touches the local fence when the queried
  mutation id belongs to the fenced operation
- HermesCron reuses one shared gateway client per provider connection so
  operationId fences survive across cron calls; duplicate operation ids
  map to invalid_input and blocked writes map to indeterminate
- projectProvider projects success:false cron list responses as a
  provider error instead of a ready empty inventory
- HermesProviderDirectory applies assessHermesConnectionSecurity, so
  remote wss endpoints no longer receive the broad local gateway token,
  and an empty endpoint resolves to the default loopback endpoint

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- EffectWorker: verify lease ownership before projecting permanent
  failures and keep effects retryable when the terminal projection fails
- HermesHistoryNormalization: stop unquoted MEDIA paths from swallowing
  a second MEDIA directive on the same line
- HermesServeAdapterV2: bound oversized tool property names and redact
  standard Authorization schemes plus OAuth parameters
- HermesSessionCatalog: route discovery through the serve runtime's
  ensureReady so managed local Hermes instances are started first
- HermesServeRuntime: relaunch an owned unhealthy process instead of
  reporting endpoint_in_use for T3's own listener
- ThreadLaunchService: still generate thread titles when workspace
  preparation is skipped
- HermesDriver: resolve default-model capabilities from the active
  provider on duplicate model slugs

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- SidebarV2: stay put instead of landing on the Code composer when the
  Work composer cannot open after a workspace switch
- SidebarV2: only blur the pin toggle on pointer activation so keyboard
  focus survives Enter/Space
- mobile: exclude Hermes threads from the Code workspace, matching web
  sidebar classification

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread apps/server/src/provider/Drivers/HermesDriver.ts Outdated
Comment thread apps/server/src/hermes/HermesServeRuntime.ts
Comment thread apps/server/src/orchestration-v2/Adapters/HermesServeAdapterV2.ts
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread apps/server/src/hermes/HermesCron.ts
Comment thread apps/server/src/hermes/HermesCron.ts
Comment thread apps/server/src/orchestration-v2/ThreadLaunchService.ts
Comment thread apps/server/src/orchestration-v2/EffectWorker.ts
maria-rcks and others added 2 commits July 27, 2026 21:52
…ture

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- EffectWorker: never re-execute permanently failed effects; persist a
  pending-terminalization marker so reclaims retry only the terminal
  projection
- HermesCron: close and evict stale gateway clients when a provider's
  connection identity (endpoint/token) changes
- HermesCron: only report duplicate-operation-id for actual duplicates
  via HermesGatewayDuplicateOperationIdError; map other configuration
  errors to a gateway diagnostic
- HermesDriver: omit the session catalog for disabled instances
- HermesServeRuntime: stop any lingering owned process before launching
  a replacement, even when the endpoint is unreachable
- sanitizeHermesToolValue: short-circuit object/array iteration when the
  size budget is exhausted

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread apps/server/src/provider/Drivers/HermesDriver.ts Outdated
Comment thread apps/server/src/hermes/HermesCron.ts
… message snapshots, and route drafts on workspace switch

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread apps/server/src/orchestration-v2/Adapters/HermesServeAdapterV2.ts
Comment thread apps/web/src/components/SidebarV2.tsx
…keep the index draft off the T3 Work backing project

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread apps/web/src/routes/_chat.index.tsx
Comment thread apps/server/src/orchestration-v2/Adapters/HermesServeAdapterV2.ts Outdated
…ort hydrate ledger, probe warnings, draft classification)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread apps/server/src/hermes/HermesCron.ts
…classify Hermes Code threads

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread apps/server/src/orchestration-v2/Adapters/HermesServeAdapterV2.ts
Comment thread apps/web/src/components/Sidebar.logic.ts
…response placeholder with attachments

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread apps/web/src/session-logic.ts
… dedup by id and time proximity

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

There are 4 total unresolved issues (including 3 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8b4f455. Configure here.

Comment thread apps/web/src/session-logic.ts Outdated
…amps are synthetic)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread apps/web/src/session-logic.ts Outdated
…nto committed entries

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fleps

fleps commented Jul 29, 2026

Copy link
Copy Markdown

I'm watching this and #4678 with attention and expectation.
One unsure topic on both PRs is if either supports remote Hermes, which as become a very common Hermes setup nowadays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants