Commit Graph
116 Commits
Author SHA1 Message Date
Peter Steinberger f1805ab54d fix: centralize provider thinking profiles 2026-04-21 09:13:35 +01:00
Peter Steinberger e0c01bf956 perf: trim hot path allocations 2026-04-20 23:13:20 +01:00
Gustavo Madeira Santana f06493f0ea fix: preserve deleted main session targets 2026-04-19 19:24:58 -04:00
BitTobyandgumadeiras d41c9860d7 fix: invalidate orphaned sessions on agent deletion (#65986)
Merged via squash.

Prepared head SHA: bc7c167dd946fd9b2e76fc3022c60e655e01f1cd
Co-authored-by: bittoby <218712309+bittoby@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
2026-04-19 18:47:52 -04:00
Peter Steinberger 1f1ff0567a refactor(lint): reduce map spread patterns 2026-04-18 19:27:43 +01:00
Tak Hoffman c37e49f275 Add /trace toggle and fix Active Memory diagnostics 2026-04-12 13:20:22 -05:00
Vincent Koc f630e8d440 fix(utils): bypass delivery context wrapper for shared consumers 2026-04-11 17:26:38 +01:00
Vincent Koc 74e7b8d47b fix(cycles): bulk extract leaf type surfaces 2026-04-11 13:26:50 +01:00
Peter Steinberger d85b2a0e81 refactor: simplify core conversions 2026-04-11 01:17:51 +01:00
Peter Steinberger 5f3356a746 refactor: split session store key helper 2026-04-10 17:37:25 +01:00
Mulualem Eshetu 4977c4ab82 fix(control-ui): preserve configured model metadata in picker (#61382)
Merged via squash.

Prepared head SHA: c738f6f146edfd7468a67073cbe93660b3c0e4cd
Co-authored-by: Mule-ME <83214007+Mule-ME@users.noreply.github.com>
Co-authored-by: mukhtharcm <56378562+mukhtharcm@users.noreply.github.com>
Reviewed-by: @mukhtharcm
2026-04-09 16:28:43 +05:30
Peter Steinberger 3174c6919d refactor: dedupe gateway memory trimmed readers 2026-04-08 01:36:39 +01:00
Peter Steinberger b3ecabbbb7 refactor: dedupe gateway trimmed readers 2026-04-08 00:09:42 +01:00
Peter Steinberger 493e1c246e refactor: dedupe remaining lowercase helpers 2026-04-07 20:57:03 +01:00
Peter Steinberger e51a00ffc7 refactor: dedupe gateway infra lowercase helpers 2026-04-07 20:57:03 +01:00
Peter Steinberger eba04199f8 refactor: dedupe core lowercase helpers 2026-04-07 15:12:32 +01:00
Peter Steinberger 28d478dc52 refactor: dedupe session helper readers 2026-04-07 07:36:11 +01:00
Peter Steinberger d03985415d refactor: dedupe trimmed string readers 2026-04-07 05:06:54 +01:00
scoootscooob f4fcaa09a3 feat(gateway): add compaction checkpoints (#62146)
Merged via squash.

Prepared head SHA: e37542554aea39e23d0eb415f6408fbcfecc80f1
Co-authored-by: scoootscooob <167050519+scoootscooob@users.noreply.github.com>
Co-authored-by: scoootscooob <167050519+scoootscooob@users.noreply.github.com>
Reviewed-by: @scoootscooob
2026-04-06 17:27:43 -07:00
Peter Steinberger 5ab1b16098 test: add cli backend live image probe 2026-04-06 22:33:05 +01:00
Peter Steinberger 1fb44f0aad fix: separate selected session model resolution 2026-04-06 16:07:50 +01:00
Tak Hoffman d28b02a7b1 fix: preserve Foundry image capability through runtime 2026-04-05 08:36:11 -05:00
Peter Steinberger 32ebaa3757 refactor: share session model resolution helpers 2026-04-03 19:37:56 +09:00
SeanandAyaan Zaidi c6f2db1506 fix: prevent gateway attachment offload regressions (#55513) (thanks @Syysean)
* feat(gateway): implement claim check pattern to prevent OOM on large attachments

* fix: sanitize mediaId, refine trimEnd, remove warn log, add threshold and absolute path

* fix: enforce maxBytes before decoding and use dynamic path from saveMediaBuffer

* fix: enforce absolute maxBytes limit before Buffer allocation and preserve file extensions

* fix: align saveMediaBuffer arguments and satisfy oxfmt linter

* chore: strictly enforce linting rules (curly braces, unused vars, and error typing)

* fix: restrict offload to mainstream mimes to avoid extension-loss bug in store.ts for BMP/TIFF

* fix: restrict offload to mainstream mimes to bypass store.ts extension-loss bug

* chore: document bmp/tiff exclusion from offload whitelist in MIME_TO_EXT

* feat: implement agent-side resolver for opaque media URIs and finalize contract

* fix: support unicode media URIs and allow consecutive dots in safe IDs based on Codex review

* fix(gateway): enforce strict fail-fast for oversized media to prevent OOM bypass

* refactor(gateway): harden media offload with performance and security optimizations

This update refines the Claim Check pattern with industrial-grade guards:

- Performance: Implemented sampled Base64 validation for large payloads (>4KB) to prevent event loop blocking.
- Security: Added null-byte (\u0000) detection and reinforced path traversal guards.
- I18n: Updated media-uri regex to a blacklist-based character class for Unicode/Chinese filename support, with oxlint bypass for intentional control regex.
- Robustness: Enhanced error diagnostics with JSON-serialized IDs.

* fix: add HEIC/HEIF to offload allowlist and pass maxBytes to saveMediaBuffer

* fix(gateway): clean up offloaded media files on attachment parse failure

Address Codex review feedback: track saved media IDs and implement best-effort cleanup via deleteMediaBuffer if subsequent attachments fail validation, preventing orphaned files on disk.

* fix(gateway): enforce full base64 validation to prevent whitespace padding bypass

Address Codex review feedback: remove early return in isValidBase64 so padded payloads cannot bypass offload thresholds and reintroduce memory pressure. Updated related comments.

* fix(gateway): preserve offloaded media metadata and fix validation error mapping

Address Codex review feedback:
- Add \offloadedRefs\ to \ParsedMessageWithImages\ to expose structured metadata for offloaded attachments, preventing transcript media loss.
- Move \erifyDecodedSize\ outside the storage try-catch block to correctly surface client base64 validation failures as 4xx errors instead of 5xx \MediaOffloadError\.
- Add JSDoc TODOs indicating that upstream callers (chat.ts, agent.ts, server-node-events.ts) must explicitly pass the \supportsImages\ flag.

* fix(agents): explicitly allow media store dir when loading offloaded images

Address Codex review feedback: Pass getMediaDir() to loadWebMedia's localRoots for media-uri refs to prevent legacy path resolution mismatches from silently dropping large attachments.

* fix(gateway): resolve attachment offload regressions and error mapping

Address Codex review feedback:
- Pass \supportsImages\ dynamically in \chat.ts\ and \gent.ts\ based on model catalog, and explicitly in \server-node-events.ts\.
- Persist \offloadedRefs\ into the transcript pipeline in \chat.ts\ to preserve media metadata for >2MB attachments.
- Correctly map \MediaOffloadError\ to 5xx (UNAVAILABLE) to differentiate server storage faults from 4xx client validation errors.

* fix(gateway): dynamically compute supportsImages for overrides and node events

Address follow-up Codex review feedback:

- Use effective model (including overrides) to compute \supportsImages\ in \gent.ts\.

- Move session load earlier in \server-node-events.ts\ to dynamically compute \supportsImages\ rather than hardcoding true.

* fix(gateway): resolve capability edge cases reported by codex

Address final Codex edge cases:
- Refactor \gent.ts\ to compute \supportsImages\ even when no session key is present, ensuring text-only override requests without sessions safely drop attachments.
- Update catalog lookups in \chat.ts\, \gent.ts\, and \server-node-events.ts\ to strictly match both \id\ and \provider\ to prevent cross-provider model collisions.

* fix(agents): restore before_install hook for skill installs

Restore the plugin scanner security hook that was accidentally dropped during merge conflict resolution.

* fix: resolve attachment pathing, defer parsing after auth gates, and clean up node-event mocks

* fix: resolve syntax errors in test-env, fix missing helper imports, and optimize parsing sequence in node events

* fix(gateway): re-enforce message length limit after attachment parsing

Adds a secondary check to ensure the 20,000-char cap remains effective even after media markers are appended during the offload flow.

* fix(gateway): prevent dropping valid small images and clean up orphaned media on size rejection

* fix(gateway): share attachment image capability checks

* fix(gateway): preserve mixed attachment order

* fix: fail closed on unknown image capability (#55513) (thanks @Syysean)

* fix: classify offloaded attachment refs explicitly (#55513) (thanks @Syysean)

---------

Co-authored-by: Ayaan Zaidi <hi@obviy.us>
2026-03-30 20:54:40 +05:30
Peter Steinberger 168ab94eee refactor(config): pin runtime snapshot and drop ttl cache 2026-03-29 22:57:31 +01:00
Ted Li ebb919e311 fix: prefer transcript model in sessions list (#55628) (thanks @MonkeyLeeT)
* gateway: prefer transcript model in sessions list

* gateway: keep live subagent model in session rows

* gateway: prefer selected model until runtime refresh

* gateway: simplify session model identity selection

* gateway: avoid transcript model fallback on cost-only reads
2026-03-29 13:20:55 +05:30
Vignesh Natarajan 384a590e54 Agents UI: fix effective model and file hydration 2026-03-28 21:10:39 -07:00
Tak Hoffman 7fadb4f7ff fix(regression): preserve subagent session ownership metadata 2026-03-27 20:24:15 -05:00
Tak Hoffman 627d6c80f2 fix: preserve session thread ids in chat session snapshots 2026-03-27 20:21:06 -05:00
Tak Hoffman 48ff617169 fix: keep fast mode in gateway session rows 2026-03-26 20:11:13 -05:00
Peter Steinberger 4b40d4dfa8 perf: optimize cold import paths 2026-03-26 23:11:00 +00:00
Tak Hoffman cb46b08efc fix: include dashboard children in owner filters 2026-03-26 13:41:46 -05:00
Tak Hoffman 24dd7aec90 fix: prefer freshest duplicate store matches 2026-03-26 10:10:05 -05:00
Tak Hoffman cc7f18d6c2 fix: replace stale canonical duplicate rows 2026-03-26 08:03:24 -05:00
Tak Hoffman fde3871ee7 fix: prefer freshest duplicate row promotion 2026-03-26 07:54:43 -05:00
Tak Hoffman f48571bec6 fix: prefer freshest duplicate rows in session loads 2026-03-24 22:36:50 -05:00
Tak Hoffman 40f820ff7f fix: prefer freshest duplicate session rows in reads 2026-03-24 22:28:50 -05:00
Tak Hoffman 1b5b23d2b1 fix: prefer current parents in session rows 2026-03-24 20:00:17 -05:00
Tak Hoffman 475983a364 fix: prefer current subagent owners in session rows 2026-03-24 19:54:07 -05:00
Tak Hoffman ad818bda84 fix: ignore moved child rows in spawnedBy session filters 2026-03-24 19:47:36 -05:00
Tak Hoffman 16d2e68610 fix: ignore stale store ownership in session child lists 2026-03-24 19:47:36 -05:00
Tak Hoffman 369119b6b5 fix: ignore stale parent rows in session child lists 2026-03-24 18:29:03 -05:00
Tak Hoffman c90ae1ee7f fix: prefer latest subagent rows for session control 2026-03-24 17:25:14 -05:00
Peter Steinberger 2833b27f52 test: continue vitest threads migration 2026-03-24 08:37:00 +00:00
clay-datacurveandTyler Yust 7b61ca1b06 Session management improvements and dashboard API (#50101)
* fix: make cleanup "keep" persist subagent sessions indefinitely

* feat: expose subagent session metadata in sessions list

* fix: include status and timing in sessions_list tool

* fix: hide injected timestamp prefixes in chat ui

* feat: push session list updates over websocket

* feat: expose child subagent sessions in subagents list

* feat: add admin http endpoint to kill sessions

* Emit session.message websocket events for transcript updates

* Estimate session costs in sessions list

* Add direct session history HTTP and SSE endpoints

* Harden dashboard session events and history APIs

* Add session lifecycle gateway methods

* Add dashboard session API improvements

* Add dashboard session model and parent linkage support

* fix: tighten dashboard session API metadata

* Fix dashboard session cost metadata

* Persist accumulated session cost

* fix: stop followup queue drain cfg crash

* Fix dashboard session create and model metadata

* fix: stop guessing session model costs

* Gateway: cache OpenRouter pricing for configured models

* Gateway: add timeout session status

* Fix subagent spawn test config loading

* Gateway: preserve operator scopes without device identity

* Emit user message transcript events and deduplicate plugin warnings

* feat: emit sessions.changed lifecycle event on subagent spawn

Adds a session-lifecycle-events module (similar to transcript-events)
that emits create events when subagents are spawned. The gateway
server.impl.ts listens for these events and broadcasts sessions.changed
with reason=create to SSE subscribers, so dashboards can pick up new
subagent sessions without polling.

* Gateway: allow persistent dashboard orchestrator sessions

* fix: preserve operator scopes for token-authenticated backend clients

Backend clients (like agent-dashboard) that authenticate with a valid gateway
token but don't present a device identity were getting their scopes stripped.
The scope-clearing logic ran before checking the device identity decision,
so even when evaluateMissingDeviceIdentity returned 'allow' (because
roleCanSkipDeviceIdentity passed for token-authed operators), scopes were
already cleared.

Fix: also check decision.kind before clearing scopes, so token-authenticated
operators keep their requested scopes.

* Gateway: allow operator-token session kills

* Fix stale active subagent status after follow-up runs

* Fix dashboard image attachments in sessions send

* Fix completed session follow-up status updates

* feat: stream session tool events to operator UIs

* Add sessions.steer gateway coverage

* Persist subagent timing in session store

* Fix subagent session transcript event keys

* Fix active subagent session status in gateway

* bump session label max to 512

* Fix gateway send session reactivation

* fix: publish terminal session lifecycle state

* feat: change default session reset to effectively never

- Change DEFAULT_RESET_MODE from "daily" to "idle"
- Change DEFAULT_IDLE_MINUTES from 60 to 0 (0 = disabled/never)
- Allow idleMinutes=0 through normalization (don't clamp to 1)
- Treat idleMinutes=0 as "no idle expiry" in evaluateSessionFreshness
- Default behavior: mode "idle" + idleMinutes 0 = sessions never auto-reset
- Update test assertion for new default mode

* fix: prep session management followups (#50101) (thanks @clay-datacurve)

---------

Co-authored-by: Tyler Yust <TYTYYUST@YAHOO.COM>
2026-03-19 12:12:30 +09:00
Peter Steinberger 198c2482ee refactor: share gateway session store migration 2026-03-13 18:38:12 +00:00
Peter Steinberger d5bffcdeab feat: add fast mode toggle for OpenAI models 2026-03-12 23:31:31 +00:00
Gustavo Madeira Santana 60c1577860 Gateway: preserve discovered session store paths 2026-03-12 17:08:55 +00:00
Gustavo Madeira Santanaandgumadeiras 46f0bfc55b Gateway: harden custom session-store discovery (#44176)
Merged via squash.

Prepared head SHA: 52ebbf5188b47386f2a78ac4715993bc082e911b
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
2026-03-12 16:44:46 +00:00
c5ea6134d0 feat(ui): add chat infrastructure modules (slice 1/3 of dashboard-v2) (#41497)
* feat(ui): add chat infrastructure modules (slice 1 of dashboard-v2)

New self-contained chat modules extracted from dashboard-v2-structure:

- chat/slash-commands.ts: slash command definitions and completions
- chat/slash-command-executor.ts: execute slash commands via gateway RPC
- chat/slash-command-executor.node.test.ts: test coverage
- chat/speech.ts: speech-to-text (STT) support
- chat/input-history.ts: per-session input history navigation
- chat/pinned-messages.ts: pinned message management
- chat/deleted-messages.ts: deleted message tracking
- chat/export.ts: shared exportChatMarkdown helper
- chat-export.ts: re-export shim for backwards compat

Gateway fix:
- Restore usage/cost stripping in chat.history sanitization
- Add test coverage for sanitization behavior

These modules are additive and tree-shaken — no existing code
imports them yet. They will be wired in subsequent slices.

* Update ui/src/ui/chat/export.ts

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>

* fix(ui): address review feedback on chat infra slice

- export.ts: handle array content blocks (Claude API format) instead
  of silently exporting empty strings
- slash-command-executor.ts: restrict /kill all to current session's
  subagent subtree instead of all sessions globally
- slash-command-executor.ts: only count truly aborted runs (check
  aborted !== false) in /kill summary

* fix: scope /kill <id> to current session subtree and preserve usage.cost in chat.history

- Restrict /kill <id> matching to only subagents belonging to the current
  session's agent subtree (P1 review feedback)
- Preserve nested usage.cost in chat.history sanitization so cost badges
  remain available (P2 review feedback)

* fix(ui): tighten slash kill scoping

* fix(ui): support legacy slash kill scopes

* fix(ci): repair pr branch checks

* Gateway: harden chat abort and export

* UI: align slash commands with session tree scope

* UI: resolve session aliases for slash command lookups

* Update .gitignore

* Cron: use shared nested lane resolver

---------

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
2026-03-12 03:48:58 -04:00