Skip to content

fix: wait for an in-progress reply before sending after a reload - #59

Merged
jerelvelarde merged 1 commit into
CopilotKit:mainfrom
asasemahmed:fix/wait-for-active-run
Oct 6, 2026
Merged

jerelvelarde merged 1 commit into
CopilotKit:mainfrom
asasemahmed:fix/wait-for-active-run

Conversation

@asasemahmed

@asasemahmed asasemahmed commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Reloading the app while a reply is still running, then sending a message, fails with:

Thread <uuid> is locked

A Retry response button appears next to it, and retrying would ask for the earlier reply again.

The cause: hydrate() marks the conversation loaded as soon as replayed messages arrive, while connectAgent is still attached to the running reply. The next turn is therefore sent while the server still holds the thread lock. CopilotKit reports the refusal as agent_thread_locked, then again as agent_run_failed.

Now:

  • New turns stay queued until connectAgent returns. In connect mode it returns once the thread is idle, so after a reload the earlier reply finishes streaming in first, and queued messages then send automatically. The history still shows immediately, and the composer stays usable.
  • If a queued turn is still refused with agent_thread_locked (for example, another device is running the thread), the message goes back first in the queue and the queue is put on hold, instead of showing the raw lock error. Send queued messages resumes it. The server refused the turn before running it, so no work was done.
  • A choice from a choice card that is put back this way stays pending and settles when it is actually sent (runQueued does not resolve or forget it).
  • The lock filter applies only while a queued message is being sent. Retry response is not a queued turn, so a lock refusal on Retry still shows its error.
  • runConversationTurn keeps fix: keep failed turns in saved history from breaking the chat #54's ignore list and reports the first, specific failure; ConversationTurnError carries its code.

Interaction with #54

#54 ignores replayed RUN_ERROR events (agent_run_error_event) while history loads. Because connectAgent now also waits for a reply that was running before the reload, that window covers the rest of that reply: if it fails during the wait, its error is not shown as a banner, the same limitation #54 documents, now for longer. The failed turn stays in the transcript, and turns sent after the wait report errors as usual.

Verification

  • tests/conversation-sdk.test.ts (real CopilotKitCore where possible), together with fix: keep failed turns in saved history from breaking the chat #54's tests:
    • a run refused with AgentThreadLockedError rejects with code agent_thread_locked;
    • with replayed errors ignored, a later lock refusal is still the reported failure;
    • the banner rule hides replayed errors only while replaying and lock refusals only during a queued turn; a lock on Retry is shown.
  • apps/mobile/test/conversation-queue.test.ts: a refused message is restored first in line, once.
  • Rebased onto main. pnpm typecheck, biome ci on the changed files and pnpm build:web pass. pnpm test: 426 passed, 1 failed, 3 skipped. The failure is worker recovery preserves downloads when metadata cannot be inspected, which needs symlink permission on Windows and fails on main the same way.
  • The reload scenario (send a long browse request, reload, send a follow-up) was checked in the web app before this rebase: the follow-up showed as Up next, then sent and was answered, with no lock errors. It was not re-run live after the rebase.

Integration limits

Tested on web. The change is in shared chat state handling, and native layout is unchanged.

@davidmckayv

Copy link
Copy Markdown
Contributor

Needs a rebase before merge. It conflicts with #54 in chat.tsx and interacts with it: connect now spans the whole live run, which widens the window where #54 swallows a run error. Rebase onto main after #54 merges, document that interaction, and confirm Retry still surfaces an error, since the new global lock-error filter also hides lock errors from Retry.

@jerelvelarde jerelvelarde left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Value: recovering an active reply across reload and queueing follow-up messages is useful. Six queue/SDK tests passed; no new security blocker identified. Please integrate current main before approval: chat.tsx, conversation-run.ts and SDK tests have substantive conflicts with the merged history-error handling and Jev runQueued wiring. Preserve those behaviors alongside reconnect/queue behavior and rerun the combined regressions.

@asasemahmed
asasemahmed force-pushed the fix/wait-for-active-run branch from 3825375 to 1614381 Compare October 6, 2026 22:15
@asasemahmed

Copy link
Copy Markdown
Contributor Author

Rebased onto main with #54's history-error handling and the Jev runQueued wiring kept:

  • Retry: the lock filter is no longer global. It applies only while a queued message is being sent, so a lock refusal on Retry response still shows its error. showsRunError holds that rule and is covered by a test.
  • Choices: a choice put back by a lock refusal stays pending in runQueued and settles when it is actually sent.
  • fix: keep failed turns in saved history from breaking the chat #54 interaction: documented in the description. Waiting in connectAgent extends the window where a replayed-style run error is not shown as a banner.
  • Combined regressions: fix: keep failed turns in saved history from breaking the chat #54's SDK tests plus the lock-code, ignore-list-plus-lock and banner-rule tests all pass.

@jerelvelarde jerelvelarde left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Value: reconnect now holds queued turns until an in-progress reply completes. Template fit: current-main integration preserves history-error filtering, replay counters, Jev choice completion, and Android keyboard behavior; the description accurately states live-testing limits. Security: no introduced security issue found in the changed queue/SDK/UI paths. Verification: 19 focused tests, mobile typecheck, and formatting pass. Executing the actual runQueued handler confirms a held choice stays pending and resolves exactly once after resend. All seven CI checks pass.

@jerelvelarde
jerelvelarde merged commit 76a4678 into CopilotKit:main Oct 6, 2026
7 checks passed
matthewhand added a commit to matthewhand/openmuse-1 that referenced this pull request Nov 18, 2026
* docs: add Trendshift badge and embed demo videos (CopilotKit#113)

* docs: add Trendshift badge to README

* docs: simplify README header and organize demos

* docs: place navigation above framework attribution

* docs: position badges directly below section links

* docs: revert layout changes intended for OpenDots

* docs: embed playable mobile and web demo videos

* docs: use GitHub-uploaded demo video attachments

* Update README.md

* Fix link to CopilotKit team meeting (CopilotKit#129)

Updated link for meeting with the CopilotKit team.

* Add optional Parallel web search to chat and tasks (CopilotKit#84)

* Add Parallel as the built-in web search provider

* Retain valid search sources alongside malformed results

* Simplify web search calls and clarify session coverage

* Show web search progress and omit unconfigured browser tools

* Enable Parallel web search by default

* Run the agent computer on an E2B Desktop sandbox (CopilotKit#133)

* Run the agent computer on an E2B Desktop sandbox

Add COMPUTER_PROVIDER=e2b-desktop as an opt-in alternative to the Docker
computer. Each owner gets one E2B Desktop VM, matched by deployment and
owner metadata, with a graphical Xfce desktop, outbound internet, and
/workspace persisted across Stop (filesystem-only pause).

- Terminal and file tools reuse the existing lease, receipts, and
  files.py contract; commands keep the 30 second limit and output caps.
- New use_desktop agent tool (screenshot, click, type, key, scroll, wait)
  returns a screenshot to the model each step; chat history keeps text only.
- Desktop tab and a live desktop chat card stream the VM over noVNC.
- The E2B API key stays on the server; config requires a unique
  COMPUTER_DEPLOYMENT_ID for this provider.
- Docker remains the default; its code paths are unchanged.

* fix(computer): serialize first desktop connection with startup

Addresses review request 4166743396.

* fix(desktop): sandbox VM-controlled iframe content

Addresses review request 4166744178.

* docs(computer): disclose public VM ports and server exposure

Addresses review request 4166744714.

* fix(computer): budget PDF export timeout for response size

Addresses review request 4166745424.

* fix(chat): preserve desktop viewer across agent steps

Addresses review request 4166745927.

* fix(desktop): open native streams only on user request

Addresses review request 4166746392.

* fix(computer): keep desktop actions out of terminal receipts

Addresses review request 4166746967.

* fix(computer): preserve transient provider failure status

Addresses review request 4166747484.

* fix(computer): propagate file attachment errors

Addresses review request 4166747947.

* fix(desktop): retain success after screenshot or storage failures

Addresses review request 4166748434.

* perf(computer): limit polling and reuse verified sandbox info

Addresses review request 4166749058.

* perf(desktop): store screenshot bytes outside the record database

Addresses review request 4166749583.

* refactor(computer): share service behavior through provider backends

Addresses review request 4166750015.

* refactor(computer): share bounded output capture between providers

Addresses review request 4166750313.

* fix(desktop): preserve uncertain input outcomes after transport loss

Addresses follow-up review comment 5956520610. Persist uncertain intent before dispatch and never replay input after a lost response.

* fix(desktop): preserve uncertainty after partial input failure

* fix(actions): fence provider execution against task cancellation (CopilotKit#119)

* fix(actions): fence provider execution against task cancel

* test(actions): cover cancel after approval claim

* style(test): satisfy biome

* style(test): trim trailing blank line

* fix: let queued tasks start while a long task is running (CopilotKit#74)

TaskWorker.tick() awaited every run it claimed before releasing its lock,
so one slow task held up all queued work, scheduled watch checks and
approved tasks until it finished. Start the claimed runs and release the
tick right away, tracking started tasks in an inFlight set so a worker
still runs at most three at once and never starts the same task twice.

* fix: open the task already handling an email when its idea is accepted (CopilotKit#135)

Accepting an idea always created a new task, even when a task for the
same email was already in progress, for example one started from chat.
The person then had two identical tasks, two "Your details are needed"
notifications, and two replies to review.

decideIdea now links the idea to an existing task for the same email and
kind unless that task failed or was cancelled, and the app opens that
task. A repeat accept of a linked idea returns it without creating more
work.

* fix: abort chat computer commands when a turn stops (CopilotKit#138)

Co-authored-by: Codex <codex@openai.com>

* fix: validate resource IDs and harden file storage paths (CopilotKit#47)

File and browser routes accepted any :id string and file names could
collapse to an empty display name. Validate file and browser session IDs
against the UUID shape the services actually issue (matching the worker's
session check) so malformed IDs return 404 without probing storage or the
worker, resolve file bytes inside the files directory with a containment
check, fall back to document.pdf for empty sanitized names, encode session
IDs in worker request paths, require a JSON object for console input, and
require UUID draft IDs. Adds tests/resource-ids.test.ts regression coverage.

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* fix(actions): keep prepared review alive across lease handoff (CopilotKit#120)

* fix(actions): keep prepared review alive across lease handoff

* test(actions): cover lease handoff during review prep

* test(actions): refresh lease-handoff fixture types

* fix(actions): distinguish task stop from lease abort

* test: cover aborted lease loss versus durable task stop

* style: format lease-loss regression

* fix: bind desktop tool retries to durable receipts (CopilotKit#137)

Co-authored-by: Codex <codex@openai.com>

* Share a complete signing key across concurrent first starts (CopilotKit#125)

* fix: cancel delegated browser observations with task execution (CopilotKit#31)

* fix: port cancellation browser.ts

* fix: port cancellation browser.test.ts

* fix: port cancellation model-worker.test.ts

* fix: propagate cancellation through model.ts

* fix: propagate cancellation through service.ts

* fix(monitors): reject stale overlapping observe commits (CopilotKit#118)

* fix(monitors): version observe commits by checks

* test(monitors): cover overlapping observe commits

* test(monitors): type frozen task snapshot

* fix(browser): serialize concurrent download imports (CopilotKit#112)

* fix(browser): serialize concurrent download imports

* test(browser): dedupe concurrent download imports

* fix(worker): release browser slot when storage persistence fails (CopilotKit#115)

* fix(worker): release browser slot when storage persistence fails

* test(worker): cover close after storageState failure

* style(worker): satisfy biome in close resilience test

* perf(agent): scope read_workspace to the requested section (CopilotKit#110)

* perf(workspace): add section-scoped source reads

* perf(agent): scope read_workspace by requested section

* test(workspace): cover section-scoped reads

* perf(workspace): avoid duplicate connection lookup

* fix(worker): clean unpublished downloads after restart (CopilotKit#131)

* Fix conversation menu clicks blocked by the header layout (CopilotKit#124)

fix(mobile): keep header menu reachable through identity layout

* fix(computer): preserve Unicode across desktop stdin chunks (CopilotKit#136)

* Reject duplicate required transaction CSV columns (CopilotKit#114)

* fix: unpaired-surrogate attachment names no longer break Gmail sync (CopilotKit#121)

* fix: decode mail bodies with an unknown charset as UTF-8 instead of failing the list (CopilotKit#141)

Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>

* perf(api): read notifications without full workspace snapshot (CopilotKit#106)

* perf(api): read notifications without full workspace snapshot

* test(api): keep notification reads scoped

* test(browser): use controlled fixtures for lifecycle and Docker suites (CopilotKit#127)

* fix: upgrade image-size to 2.0.3 (CVE-2025-71329) (CopilotKit#104)

* fix: CVE-2025-71329 security vulnerability

Automated dependency upgrade by OrbisAI Security

* fix: patch Metro to use image-size's buffer API, fixing CVE-2025-71329 override

The workspace-wide image-size override to 2.0.3 broke Metro's asset
bundling: metro@0.83.3 is the only consumer of image-size in the
lockfile, and its getAssetData() passed the raw asset file path
(a string) to image-size's default export for every non-zip asset.
image-size@2.0.3 dropped synchronous file-path support in favor of a
Buffer-only sync API (file paths now require the async fromFile API),
so every normal PNG/JPEG asset would fail to get its dimensions during
expo export.

No non-breaking 1.x image-size release exists, and the only Metro
release that drops the image-size dependency entirely (0.83.8) is only
reachable via an Expo SDK 55 upgrade, out of scope for a security fix.
Instead, patch metro@0.83.3 via pnpm's patchedDependencies so
getAssetData() always reads the asset into a Buffer first, mirroring
the fix Metro itself later shipped upstream in 0.83.8.

Verified with `pnpm install --frozen-lockfile` and a real
`expo export --platform web` run bundling apps/mobile/assets/capybara.png:
the exported bundle now registers correct width/height (1254x1254,
matching the actual PNG) instead of failing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: OrbisAI Security <mediratta01.pally@gmail.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>

* fix: alert again when a watch condition clears and reappears (CopilotKit#83)

Co-authored-by: wangtao <328929485+wangtaotaotao95@users.noreply.github.com>
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* fix: reject nonexistent calendar dates before review or dispatch (CopilotKit#71)

* fix: reject nonexistent calendar dates before review or dispatch

* fix: preserve minute precision when validating calendar dates

---------

Co-authored-by: wangtao <328929485+wangtaotaotao95@users.noreply.github.com>
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* fix: reject malformed quoted transaction fields (CopilotKit#69)

Co-authored-by: wangtao <328929485+wangtaotaotao95@users.noreply.github.com>
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* Enable OpenMuse SDK telemetry for Intelligence signup reporting (CopilotKit#144)

* feat: connect OpenMuse runtime telemetry to signup reporting

* fix: include telemetry identity in Render template setup

* fix: clear the mail draft error and ignore stale loads (CopilotKit#99)

The MailScreen drafts effect never cleared its error, so a banner from a past failure stayed after a later load succeeded. It also had no active guard, so a slow response could overwrite newer drafts. Clear the error before loading and ignore responses from an unmounted or superseded effect, matching the other data loaders in the file.

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* fix: keep failed turns in saved history from breaking the chat (CopilotKit#54)

* fix: keep failed turns in saved history from breaking the chat

Connecting to a Rich Threads conversation replays its saved events,
including RUN_ERROR from any earlier failed turn. CopilotKit reports
those through onError as agent_run_error_event, so one failed reply
made the conversation fail to load ("Could not load conversation")
on every visit and showed a stale error banner.

While history replays, ignore agent_run_error_event only. Connection
failures (agent_connect_failed) still block loading, and errors from
new turns still stop the run and the follow-up queue.

* fix: count history replays so an old load cannot end a newer one

---------

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* fix: accept a byte order mark before the transaction CSV header (CopilotKit#146)

Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* fix: make file-producing task retries idempotent (CopilotKit#45)

* fix: make file-producing task retries idempotent

Reuse operation-scoped file identities across task and import checkpoint gaps. Publish complete PDFs without overwriting earlier results and recover metadata through insert-if-absent. Cover interrupted document/model/import flows and concurrent replay.

Assisted-by: OpenAI Codex

* fix: make keyed file IDs UUID-shaped

---------

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* fix: show a date for future activity timestamps (CopilotKit#100)

relativeDate computed Date.now() - timestamp and treated any value under a minute, including hours in the future, as Just now. Clock skew of a few seconds should stay Just now, but further future values now fall back to a date. Move the pure helper into relative-date.ts so it is covered by node:test.

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* fix: alert again when a change watch returns to a seen page (CopilotKit#147)

A change-condition watch keyed its dedup notice on the page content
hash alone, so a page that changed A→B→A never alerted on the return
to A. The alertSequence mechanism already added for contains/price
conditions in 96c2525 now covers change too: every notification-worthy
observation bumps the committed sequence and keys the notice on
sequence+hash, so publication replays still deduplicate.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* fix(mobile): prevent soft keyboard from obscuring chat input on Android (CopilotKit#142)

On Android devices, tapping the message input caused the soft keyboard to
display directly over the text input field, obscuring what the user was typing.

Root cause:
In `ChatScreen`, `KeyboardAvoidingView` was configured with:
`behavior={Platform.OS === 'ios' ? 'padding' : undefined}`.
On Android, behavior resolved to `undefined`. With React Native 0.81 and
edge-to-edge display enabled (`edgeToEdgeEnabled=true`), `KeyboardAvoidingView`
calculates displacement using `frame.y + frame.height - keyboardY`. On Android
edge-to-edge, `keyboardY` reports the window display bottom area, which results
in zero or negative displacement.

Fix:
- Register Android `keyboardDidShow` and `keyboardDidHide` listeners to track the
  exact virtual keyboard height.
- Compute dynamic bottom padding offset subtracting the bottom navigation bar height (74dp).
- Apply this padding to `KeyboardAvoidingView` on Android while leaving iOS `behavior="padding"` untouched.
- Tested and verified on physical Samsung Galaxy Android device.

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>
Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>

* fix: keep the calendar day view working when midnight is skipped by DST (CopilotKit#150)

* fix: keep the calendar day view working when midnight is skipped by DST

The events query built its day range with zonedInstant(date, '00:00'),
which deliberately throws for nonexistent local times. On days when a
zone springs forward at midnight (e.g. America/Santiago 00:00→01:00),
the whole day view failed with 'This time does not exist' and showed no
events. Day boundaries are a range-computation detail, not an entered
appointment time, so startOfZonedDay clamps to the first existing local
time instead of throwing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* style: format calendar date-time test imports

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>
Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>

* fix: keep goal-planning ideas attached to their original goal (CopilotKit#70)

fix: preserve the existing goal when accepting its plan idea

Co-authored-by: wangtao <328929485+wangtaotaotao95@users.noreply.github.com>
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>
Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>

* feat(chat): read the primary calendar for an explicit time range (CopilotKit#134)

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* Delegate existing goal milestones while keeping completion manual (CopilotKit#123)

feat(goals): delegate existing milestones without completing them

Co-authored-by: wangtao <328929485+wangtaotaotao95@users.noreply.github.com>
Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>

* fix: route OpenAI-compatible gateways to the Chat Completions adapter (CopilotKit#80)

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* fix: make the computer button label match its status (CopilotKit#77)

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* fix: normalize a typed browser address before opening a session (CopilotKit#102)

BrowserScreen posted the raw text from Open session, while the in-session address bar and the computer sheet both run browserAddress first. The server requires an absolute URL, so typing copilotkit.ai failed validation even though the same text works everywhere else. Normalize the address before the request; browserAddress already covers schemes, credentials, and malformed input in its own tests.

Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>

* fix: keep surrogate pairs whole when truncating file names (CopilotKit#148)

sanitizeFileName joined code points and then sliced the UTF-16 string,
so a non-BMP character straddling the 180-character boundary was split
into a lone surrogate that corrupted the stored display name.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* docs: document ANTHROPIC_BASE_URL and GOOGLE_GENERATIVE_AI_BASE_URL in .env.example (CopilotKit#79)

docs: document ANTHROPIC_BASE_URL and GOOGLE_GENERATIVE_AI_BASE_URL endpoint overrides

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* chore: Configure Renovate (#1)

* Add renovate.json

* Format Renovate configuration for repository checks

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>

* chore(deps): update pnpm/action-setup digest to b906aff (CopilotKit#151)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(monitors): preserve concurrent observe commits on pause (CopilotKit#116)

* fix(monitors): preserve concurrent observe commits on pause

* test(monitors): cover stale pause snapshot race

* chore: match repository formatting after main reconciliation

* fix: keep API failures readable when a response is not JSON (CopilotKit#95)

MuseApi parsed the body as JSON before checking response.ok, so a plain-text 404, an HTML proxy error page, or an empty body surfaced as a SyntaxError parse message instead of the real failure. Route session creation and requests through a shared reader that keeps JSON error messages, falls back to the response status, and reports unreadable success bodies clearly.

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* Recognize whitespace after dollar signs in price watches (CopilotKit#126)

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* chore(deps): update dependency @biomejs/biome to v2.5.15 (CopilotKit#152)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix: list calendars without an explicit time zone (CopilotKit#98)

Google marks CalendarListEntry.timeZone as optional. Requiring it made one zone-less calendar fail the whole listCalendars read, which also failed the workspace snapshot. Default the entry to UTC and keep the rest of the list readable. Add a fixture test for an entry with no timeZone.

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>
Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>

* harden: add resource limit in app.ts (CWE-770) (CopilotKit#103)

* fix: multi_agent.cwe-770 security vulnerability

Automated security fix generated by OrbisAI Security

* fix: bound rate limiter storage and derive identity from trusted policy

The /api/* rate limiter stored request identities in an unbounded Map
with no eviction or capacity limit, and it keyed solely off
client-supplied X-Forwarded-For/X-Real-IP headers, so direct callers
without those headers collapsed into one shared "unknown" bucket.

Replace it with a bounded fixed-window store (explicit expiry, hard
entry cap, fails closed at capacity) and derive identity from the
bearer token for authenticated requests, only trusting forwarding
headers when an explicit trustProxy config flag is set, falling back
to the real connection address otherwise.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* fix: key pre-auth rate limiter on connection, not bearer token

The /api/* limiter runs before authentication, so keying on the raw
Authorization header let callers mint a bucket per fake token, bypassing
the limit and exhausting maxEntries. Identity is now the connection
address (or the forwarded address only when TRUST_PROXY=true).

Add regressions for token spoofing, token rotation and capacity
exhaustion/recovery, and document TRUST_PROXY in .env.example.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: OrbisAI Security <mediratta01.pally@gmail.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>

* fix: decode folded adjacent MIME header words (CopilotKit#130)

Co-authored-by: xiehuanyi <xiehuanyi@users.noreply.github.com>
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>

* fix(computer): never execute or overwrite a dead command (CopilotKit#111)

* fix(computer): never execute or overwrite dead commands

* test(computer): cover dead-command races

* style(test): satisfy biome

* chore: match repository formatter

* chore: match repository formatter

* chore: match repository formatter

* ci: retry flaky browser download fixture

* fix: stop delegated model runs after a task outcome is decided (CopilotKit#81)

Co-authored-by: wangtao <328929485+wangtaotaotao95@users.noreply.github.com>

* fix: resume monitors from Activity through the recoverable transition (CopilotKit#82)

Co-authored-by: wangtao <328929485+wangtaotaotao95@users.noreply.github.com>

* chore(deps): update dependency hono to v4.13.13 (CopilotKit#154)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency image-size to v2.0.4 (CopilotKit#155)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix: never call the provider for a task cancelled during model setup (CopilotKit#101)

executeModelTask reads the agent identity and memories before registering its abort listener, and addEventListener never fires for an already-aborted signal. A task paused or cancelled inside that window still started a full model run. Check the signal after the setup reads so the run is rejected before any provider request. The new regression test cancels while the identity read is pending and asserts the fixture provider saw zero requests.

* feature: show what changed when a watched page changes (CopilotKit#66)

Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>

* perf(server): scope paused-goal task lookup by goalId (CopilotKit#108)

* perf(store): list tasks by goal id

* perf(server): scope goal pause task lookup

* test(store): cover goal-scoped task listing

* chore: match repository formatting after main reconciliation

* ci: retry flaky browser download fixture

* fix: wait for an in-progress reply before sending after a reload (CopilotKit#59)

* fix: harden Gmail message parsing (CopilotKit#97)

A single message could break or distort a mailbox read: an unknown charset label threw from TextDecoder, RFC 2231 language tags blocked header decoding, a quoted display name containing an address was preferred over the real sender, a bare angle-addr From produced an empty sender, and an attached message/rfc822 had its nested text merged into the parent body. Decode bodies with a UTF-8 fallback, strip language tags, ignore addresses inside quoted display names, fall back to the bare address, and stop recursing into attachment parts. Large remote bodies stored behind attachment IDs are still hydrated and read as message text.

* perf(server): scope refreshIdeas status queries (CopilotKit#109)

* perf(store): list records by status

* perf(server): scope refreshIdeas status queries

* test(store): cover status-scoped listing

* chore: match repository formatting after main reconciliation

---------

Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>

* chore(deps): update dependency tsx to v4.23.15 (CopilotKit#158)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update dependency pg to v8.23.1 (CopilotKit#156)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix: keep attached mail lazy and expose unnamed forwarded messages (CopilotKit#169)

* fix: skip hydration of attached MIME message trees

* Expose unnamed forwarded messages as attachments and cover thread reads

* chore: check text files out with LF so Windows clones pass lint (CopilotKit#175)

Biome expects LF, but a fresh Windows clone with the default
core.autocrlf=true produced CRLF working trees and ~172 formatter
errors before any code change. eol=lf pins the checkout to LF for
text files; the binary rules are unchanged and Linux/macOS checkouts
are unaffected.

* test: allow telemetry probes more time on Windows (CopilotKit#177)

Co-authored-by: sean0407 <22557931+sean0407@users.noreply.github.com>

* perf(server): scope task detail to the rows the task names (CopilotKit#174)

`AgentService.detail()` read every file, browser, run event and artifact the
owner has ever stored and filtered them in JavaScript, so showing one task cost
the whole workspace. The app calls it once per task card, and a workspace keeps
its run events and artifacts forever.

Measured against PGlite with unrelated rows of each kind (500 of them browsers,
the rest 1:1 with the table size), 15 calls, median:

   200 rows/table: 805 rows read,   6.1 ms -> 5 rows read, 0.8 ms
 2,000 rows/table: 6,505 rows read, 48.8 ms -> 5 rows read, 1.5 ms
10,000 rows/table: 30,505 rows read, 309.2 ms -> 5 rows read, 5.6 ms

The task already names the files (`artifactIds`) and the browsers
(`state.browserId`, `state.sessionId`), so those two become `listByIds`, and the
two kinds that carry a `taskId` become `listByTaskId`, both with the ordering
`list` used. The same rows come back in the same order, and the four queries now
run together instead of one after another. A task row without `artifactIds`,
which the type says cannot exist, reads nothing instead of throwing.

What this does not remove: the `data->>'taskId'` filter still scans the
(owner, kind) prefix in SQL, which is the 5.6 ms left at 10,000 rows. An
expression index would remove that too, as it would for `listByGoalId`.

* fix(finance): enforce the CSV size cap in UTF-8 bytes (CopilotKit#202)

* fix(browser): align PDF download detection with import checks (CopilotKit#201)

* fix(calendar): reject clock times that normalize to the next day (CopilotKit#198)

* fix(gmail): honor unnamed attachment dispositions (CopilotKit#197)

* fix(gmail): tolerate dates outside the JavaScript date range (CopilotKit#196)

* fix(finance): accept CR-only transaction CSV records (CopilotKit#195)

* feat(server): revoke the current session on DELETE /api/session (CopilotKit#200)

* feat(server): revoke the current session on DELETE /api/session

* fix(server): delete expired session rows when they are rejected

Auth.owner returned 401 for an expired session but kept its row, so every sign-in that was never revoked left a dead row behind. Remove the row when it is found expired. Also applies biome formatting to the session-logout test.

* fix(server): keep expired-session rejection a clean 401 if cleanup fails

The expiry cleanup delete runs before the 401 is thrown; a failing remove would surface as a 5xx instead of the intended 401. Make the cleanup best-effort so rejection is unaffected.

* fix: keep every answer when a model task asks again (CopilotKit#191)

Each model run starts with only the task prompt, so the reply to an
earlier ask_user question has to come from saved state. Answering
overwrote state.answer, so a task that asked two questions lost the
first reply and the model never saw which question a reply answered.

Keep the replies as a list with their questions and send all of them.
Tasks saved with a single answer still read it.

* fix(monitors): ignore extra whitespace in contains watch text (CopilotKit#185)

* fix: limit PDF decompression on load and drop invisible characters from drafts (CopilotKit#206)

* fix(files): limit how much a PDF may decompress while it is loaded

* fix(domain): drop invisible characters from email and event drafts

* fix(server): scope signed links to their methods and give new installs their own computer name (CopilotKit#204)

* fix(server): accept signed links only for the methods their pages use

* fix(computer): give new installs their own Docker deployment name

* fix(gmail): exclude address comments from mailbox extraction (CopilotKit#203)

* fix: keep surrogate numeric character references from failing the mail list (CopilotKit#183)

Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>

* Ship the product as OpenFuse without breaking existing installs (CopilotKit#224)

* chore: rename OpenMuse to OpenFuse

Rename the product in docs, UI strings, the agent's default name and
prompt, the API root, package names, the Expo app name, slug, scheme
and bundle/package ids, Render services, disks and env names, compose,
Docker image tags, test fixtures and temp prefixes. Rename the demo
video file and its title metadata, and the PDF test fixture text.

github.com URLs to the repository are unchanged; they redirect after
the repository rename.

* fix: keep installs from before the rename working

Existing installs keep what they already created under the old name:

- OPENFUSE_ACCESS_KEY falls back to the previous variable name.
- Without DATA_DIR or WORKER_DATA_DIR, an existing data directory under
  the previous name is still used, and it stays ignored by git and Biome.
- Credentials encrypted under the previous associated data still decrypt.
- Choice messages saved in older threads still parse and display.
- An install that started before the rename keeps its computer's
  container, volume, labels, E2B metadata and files.py path; a new
  install records a computer-name file and uses the new names. Without
  COMPUTER_IMAGE it still accepts its existing containers' default image,
  and the image links the previous files.py path.

* chore(telemetry): tag runtime telemetry as OpenFuse

Runtime telemetry now carries accessibility_title "OpenFuse". The
PostHog queries in docs/TELEMETRY.md filter on the new tag.

* Remove demo media that shows the old name, and rename the Muse client hooks

The demo videos, GIFs and cover images, and the document screenshot, show
the old product name in the picture. They are removed along with every
link to them, as are the two README videos hosted on GitHub. MuseApi and
useMuseThread become FuseApi and useFuseThread.

* Link to the repository under its new name (CopilotKit#225)

Point the repository links at CopilotKit/openfuse

* Update dependencies affected by critical and high advisories

* Handle completed download journals disappearing during listing

---------

Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>
Co-authored-by: George Pickett <george@parallel.ai>
Co-authored-by: Ondrej Drapalik <43215019+OndrejDrapalik@users.noreply.github.com>
Co-authored-by: Kevin Rajan <7121943+kvnloo@users.noreply.github.com>
Co-authored-by: Lucky Reddy <lkanthareddya@gmail.com>
Co-authored-by: jz-krono <jz@kronowave.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Felix-Ayush <67006255+Ayush7614@users.noreply.github.com>
Co-authored-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
Co-authored-by: Excelius <57819425+Excelius-Wang@users.noreply.github.com>
Co-authored-by: wangtao <wangtaotaotao95@gmail.com>
Co-authored-by: kevin <5299031+kevin9327@users.noreply.github.com>
Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>
Co-authored-by: Anupam Mediratta <mediratta@gmail.com>
Co-authored-by: OrbisAI Security <mediratta01.pally@gmail.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: wangtao <328929485+wangtaotaotao95@users.noreply.github.com>
Co-authored-by: nvtoan0201-swe <nvtoan0201@gmail.com>
Co-authored-by: Asem ahmed <94972604+asasemahmed@users.noreply.github.com>
Co-authored-by: Mrdifferent <97079945+Mrdifferent2022@users.noreply.github.com>
Co-authored-by: Madiraju Meher Sai Preetam <51680175+mehersaipreetam@users.noreply.github.com>
Co-authored-by: Jeff <36680501@qq.com>
Co-authored-by: Cocoon-Break <54054995+kuishou68@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Huanyi Xie <74809554+xiehuanyi@users.noreply.github.com>
Co-authored-by: xiehuanyi <xiehuanyi@users.noreply.github.com>
Co-authored-by: BigDataDZ <76271875+BigDataDZ@users.noreply.github.com>
Co-authored-by: sean0407 <sean0407@gmail.com>
Co-authored-by: sean0407 <22557931+sean0407@users.noreply.github.com>
Co-authored-by: Paolo Valletta <paovalletta@hotmail.it>
Co-authored-by: Ayush <ayush421301@gmail.com>
Co-authored-by: Andrew Barnes <169967362+Bortlesboat@users.noreply.github.com>
Co-authored-by: Raphael Fakhri <rjf11@mail.aub.edu>
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.

3 participants