Repository navigation
Agent thread aligned with KohakuTerrarium, safer local file reads, lighter chat memory - #134
Merged
Merged
Conversation
… not sent Re-expresses the page-level test 'still sends to the default agent even when project-model storage exists' the same way 07edffe (G3-9) re-expressed the useCanvasGenerationWorkflow test: handleSendCanvasItemsToAgent resolves true when the local delivery is only scheduled (the Agent column does not acknowledge it yet), and the generation dialog then shows the warning 'project_canvas.generation.delivery_scheduled' (已安排向默认 Agent 投递,尚未确认 接收), never the old success '已发送给默认 Agent 生成候选图'. There is no confirmed-delivery path in the product today, so the test pins the scheduled notice: exactly one warning with that key, no success notice before or after the send, and still no qapp:switch / qapp:apply-task-pack event. ProjectCanvasPage.designInspectionHistory.test.tsx: 22/24 -> 24/24. Test-only. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
Crop confirm stores the overlay's updates unchanged, so only the overlay decides the frame of a cropped image, and no test drove the real overlay for it: reporting the old frame (the kept region stretched into it) passed the whole canvas directory. - ProjectCanvasImageCropOverlay.test.tsx: drive the real overlay with pointer events for a first crop and for a crop of an existing crop; the frame equals the crop size in source pixels, and scale and position compensate so the kept pixels stay where they were drawn. - ProjectCanvasPage.designInspectionHistory.test.tsx: the mocked overlay now follows the same rule, so the saved item is a state the app can reach (frame 300 x 224 for a 300 x 224 crop, as the test expected before crops stopped being flattened). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…scheduled The page test only checked that nothing is reported before the send button is clicked, so a "scheduled" notice shown before the hand-off resolves (when preparing the selection can still fail or be cancelled) passed both the page test and the hook tests. - Page test: nothing is reported right after the click either, while the hand-off is still pending. - Hook tests: a send that resolves false shows no notice at all; a pending send shows nothing until it resolves, then the scheduled notice once. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
finishTaskRun writes the task's end through the lead's save chain, which runs its resolver only when its turn comes. While a lead save was in flight the member was already idle and the lead still showed the task running, so team management offered (and accepted) a reset that turned a successful run into 'interrupted'. finishTaskRun now records the task in a ref until its persistLatest settles (success or failure), and isTeamTaskOwnerBusy counts the owners of those tasks as busy, so no reset is offered or accepted meanwhile. New runtime test: a lead save is held, the member finishes, no reset is shown, the task ends done without the "save failed" warning (it fails without the fix). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
isTeamTaskOwnerBusy read React state only, so the click-time re-check of 重置 saw the last render, not the moment of the click. It now reads loadingSessionIdsRef, externalLoadingSessionIdsRef, sendingSessionIdsRef and queuedSessionSendsRef (plus the pending-finish ref) and keeps the rendered state as well: busy whenever either says so. Tests: a Canvas Target run that starts after the last render, followed by a reset click in the same act, saves nothing (fails without the change); the reset works again once the run ends; the menu re-asks isOwnerBusy at click time. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
validateTeamTasks rejected the graph when lastOutcome held a value this version does not know, so a record written by a later version blocked every task action, done tasks included. lastOutcome is display-only: an unknown string is now ignored on read (teamTaskOutcome returns undefined, the menu shows no outcome) and dropped by the task's next status change (setTeamTaskStatus already removes it); a non-string value and every other field still fail closed. The old unit test that expected 'done' and '' to throw now expects them to be ignored; 1, null, objects and arrays still throw. Tests: unknown outcome on done and pending tasks, dispatch (claim and exact release), reopen and reset still work, the value disappears on the next status write; known outcomes and old records unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…lled A Stop pressed while the member send of a task was still in preflight made the send return without reporting, and the dispatch fallback recorded 'interrupted'. terminateSession now remembers the termination epoch of the user's own stops (manual Stop, member stop, stop-all; not scope termination or deletion), and the fallback records 'cancelled' when such a stop happened after the task's send began, 'interrupted' otherwise. Tests: stop-all while the member preflight is held -> pending + cancelled (fails without the change); the member record changes during the preflight -> pending + interrupted; no request in either case. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…r match dispatchSelectedTeamTask's finally skipped the 'interrupted' fallback when the task send sat in the owner's queue (queuedSessionSendsRef ... onTaskCompleted === complete). That never happens: the dispatch checks the owner with isSessionBusy right after the claim, with no await before sendMessage, and sendMessage queues only on that same busy test, so the task send always runs directly. Removed rather than kept as a safety net: had it ever matched, it would only have deferred the outcome to a queued item that every stop drops without reporting, leaving the task running. The comment now states the invariant. No behaviour change; the 18 task/reset runtime tests pass. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
Only a direct user send released a stopped member's holds, so a task the user dispatched from team management ran the member while its held team messages stayed held until a later direct send. The decision is now one exported rule, sendReleasesStopHolds (teamMemberStop.ts): the user's composer, '@member' and edit-resend sends, and a task send marked userTaskDispatch, release the holds (releaseStopHolds) when their user turn is accepted; a team-message delivery, a drained queue item (released in its lease) and a task send without the mark (a dispatch by the lead or by automation) never do. dispatchSelectedTeamTask, which only the user's click in team management calls, sets the mark. The held messages then follow after the task's run, in order, because the member is already loading when the turn is accepted. Tests: real page - stop-all holds the writer, the user dispatches its task, the task request comes first and the held message follows exactly once, the task ends done (fails without the mark); unit - which sends release and which never. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…team messages Stop-all only held the members it stopped (running, waiting or preparing). A member whose run ended a moment before the click but still had a queued team message was left alone, and the next 500 ms pump restarted it. The lead's composer stop now goes through stopTeamMembersAndHoldQueued (teamMemberStop.ts): it stops the working members as before and also holds every other member for which the dispatcher still has a queued, unclaimed record (new TeamMessageDispatcher.hasQueued). Those members stay held until the user's own next send to them, like a stopped member. Tests: real page - the writer's Canvas Target run ends and stop-all is clicked in the same act; the queued member message is not delivered for 2 s (it is without the change) and follows once after the user's next send; unit - the helper and the dispatcher for the 'run ended just before stop-all' case. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…rds instead of refusing messages The dispatcher now lives for the whole team in a pane, so its 1000-record log (and the TeamMessageService below it) no longer reset on a pane switch and a busy team eventually got '团队消息无法排队' for every new member message. When the limit is reached the dispatcher now drops the oldest messages whose records are all settled (response_received, unavailable, unknown) and not claimed, and tells the service to forget them (new TeamMessageService.forget). Queued, held, started and claimed records are never dropped; when they alone fill the log the old refusal stays and nothing is dropped. A channel message is dropped only as a whole. Dropped IDs are still refused as duplicates (bounded set, 4x the limit). Claimed records are tracked by a stable record ID instead of their index, so a delivery in flight still updates its own record after older ones were dropped. The old unit test that expected a settled 'unavailable' record to block the log now uses a queued record. New tests: 1005 delivered messages plus an unavailable one, then a new message is accepted and delivered; a log of 1000 queued records still refuses and keeps everything; claimed/held/started records survive pruning and the claimed delivery ends on its own record; channel messages go as a whole; service.forget frees capacity. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
… every 500 ms Since the dispatcher keeps running in a hidden pane, every hidden pane with team members called listAgentTeamMessages every 500 ms. A hidden pane only claims intents into queued records (delivery waits for the pane), and MAIN keeps an unclaimed intent for 60 s, so a poll every 3 s is enough. The interval is now a self-rescheduling timer (teamMessagePolling.ts): 500 ms while the pane is visible, 3 s while hidden; when the pane is shown again an effect wakes it, so it polls and delivers at once and returns to 500 ms. Effect: 60 list calls per 30 s hidden became 10 (fake-timer test). Tests (fake timers): call counts visible (60 / 30 s) vs hidden (10-11 / 30 s), a message posted while hidden is claimed by the next hidden poll and delivered at once after the pane is shown, polling continues after a failed poll and stops on stop(). The real-page hidden-pane test still passes. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…parted members
teamMessageDispatcherRef still stored visibilityEpoch, which nothing reads since
the dispatcher outlives pane switches; it is removed. heldTeamMembersRef
('scope\0member') was never pruned and grew for the page's lifetime. A new
pure helper, pruneTeamMemberHolds (teamMemberStop.ts), drops the holds of a
scope whose member is no longer in a live team (team ended, lead archived or
deleted, member archived, deleted or of an older generation); an effect runs
it whenever the sessions change, only once the current scope's sessions are
loaded, so a scope that is still loading never loses its holds.
Tests: team end (ended, archived or deleted lead), member removal (archived,
deleted, missing, older generation), current members and other scopes kept.
The K3 hold tests on the real page still pass.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…llows once isSessionBusy counts externally loading sessions since K3, so a user send to a session with a Canvas Target run is queued and drained when the run ends, but no ChatPage test dispatched 'chat:set-external-loading'. The real-page channel suite now does: with the lead externally loading, an Enter send makes no request for 1.5 s; after loading:false it is requested exactly once, the lead stores the user turn and the reply in order, and nothing follows in the next 1.5 s. Tests only. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
The four task warnings that were still hard-coded literals in
dispatchSelectedTeamTask and finishTaskRun ('任务不可执行…', '任务已领取但团队
状态发生变化…', '任务执行结果已返回,但任务状态保存失败', '无法领取任务…') are
now t() keys (chat.team_task_unavailable, team_task_claim_changed,
team_task_result_unsaved, team_task_claim_failed) with short English texts
and the unchanged Chinese texts. The runtime tests that expected the old
literals now expect the English default. i18n strict-source count 128 -> 124;
check:i18n and check:text-encoding pass.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…it test The renderer type check refused passing a task send without userTaskDispatch to sendReleasesStopHolds (TS2559, no property in common with the weak type). The test now casts it like the team-message case. Follow-up to 260f6563 (K23b part 6); tests only, the check is unchanged. tsc web is clean. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
On win32, terminal.run now launches the command through the verified
magicpot-command-job helper when it is present (fixed candidates, SHA-256
manifest and the 'atomic-job-list-empty-v2' capability; a missing, unverified
or differently answering helper counts as absent). The helper gets no limits
('-' '-' '-' '--') and the command as an absolute path, resolved first exactly
as Node/libuv resolves spawn(shell:false) today (cwd first, name as given only
with an extension, then .com and .exe, PATH from the passed env with Node's
case-insensitive key dedup, parent PATH as libuv's fallback), so the same file
runs. Anything the helper cannot launch the same way (unresolvable names,
batch files, drive-relative results) keeps the direct spawn.
A stop (timeout, output limit, cancel) terminates the helper; it holds the only
handle to its KILL_ON_JOB_CLOSE job, so Windows kills every process of the
tree, including processes created while the stop runs. The outcome is still
reported only after the helper has closed, and the audit records
processTreeStop 'job-object'. Without the helper the single taskkill remains
(next commit). POSIX is unchanged.
Measured: 26 new unit tests (libuv lookup, argv vector and command-line round
trip through the helper, stop/close ordering, helper refusal cases) pass on
Linux; toolHost + HTML/shell/stop-diagnostic suites 271 passed, tsc node clean.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…t helper is available Without a verified helper (a dev checkout without Rust, or a helper that fails verification) a stopped terminal command still gets today's immediate `taskkill /PID <pid> /T /F`, but that single enumeration is no longer trusted. The new shared module toolHost/windowsProcessTree.ts then takes process-table snapshots (fixed %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe, constant -EncodedCommand script, Get-CimInstance Win32_Process as JSON with pid, parent pid and FILETIME creation time, parsed strictly), kills every live process that descends from a recorded member (members are remembered across rounds because the tree's links point at dead pids; a process created before its claimed parent is not its child; a live non-member holding a member's pid owns the children it predates) and repeats until one snapshot shows no live member, bounded by about 5 s. The first snapshot starts in parallel with the taskkill, so the first kill is not delayed. Only integers reach taskkill. If no snapshot can be taken or the deadline passes, the behaviour is today's and the terminal.run audit says processTreeStop 'tree-unconfirmed' (otherwise 'tree-swept'). The result is still reported only after the child closed and the stop finished. The module has seams for spawn, snapshot, clock and protected pids, so it is unit-tested on Linux. Measured: 16 new unit tests (fake process table: grandchild born after the first kill and another after the second, pid reuse, non-converging sweep ends at the deadline, integer-only command lines, missing PowerShell) pass; toolHost + HTML/shell/stop-diagnostic suites 287 passed, tsc node clean. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…and jobs commandJobs.finishTermination on win32 now distinguishes confined and unconfined jobs explicitly (the permit asked for OS confinement, so the job was spawned through the adapter). Confined jobs keep the existing taskkill of the child, which is the Job Object helper itself: ending it closes its KILL_ON_JOB_CLOSE job, so every process in the job dies (a new test pins that the taskkill targets the helper's pid and that no sweep runs). Unconfined jobs no longer rely on one taskkill enumeration: they use the shared stopWindowsProcessTree sweep (immediate taskkill /T /F first). The outcome is 'known' only when the initial taskkill exited 0, the sweep converged and the child closed; a missing snapshot or a sweep that hits its deadline is reported as controllerFailed / controllerTimedOut and stays 'termination-unconfirmed' and quarantined, as before. The 3 s child-close wait is unchanged; the sweep adds at most about 5 s before it. Unconfined jobs are not routed through the helper. Test seams: platform and windowsProcessSnapshot options. The fake spawner now closes every /PID of a taskkill and answers the PowerShell snapshot, so the existing Windows-only tests keep their meaning on a real Windows PC. Measured: 3 new tests on Linux (survivor born during the first taskkill is swept before the stop is known; no snapshot keeps the stop unknown; confined stop ends the helper without a sweep); toolHost + HTML/shell/stop-diagnostic suites 290 passed, tsc node clean. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…r the stop is reported
The real-process test 'kills a process tree that is still growing at the
bounded timeout' now checks the product promise instead of a delayed marker:
every grandchild appends Date.now() to its own heartbeat file every 50 ms, and
after the timed-out result arrives the test waits 1.5 s and requires that no
heartbeat is later than the result plus 250 ms. The parent still creates one
grandchild every 25 ms and the kill still comes right after the first.
The comment explains why it passes on POSIX (process-group SIGKILL), on
Windows with the Job Object helper (closing the job kills every process in
it) and on Windows without it (taskkill plus sweep before the result), and why
it fails against the former single `taskkill /PID <pid> /T /F` (one
enumeration; a grandchild created between it and the parent's termination
keeps writing heartbeats).
Measured on Linux: 5 consecutive runs pass; with the POSIX stop mutated to kill
only the parent the test fails ('heartbeat-<pid>: 1480 ms after the result'),
so it is not vacuous. The unit tests for the helper path and the sweep path
landed with their parts.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…r in Windows-only assertions Follow-up to the commandJobs part of the Windows tree-kill work. On win32 an unconfined stop now also starts the PowerShell process-table snapshot through the injected spawnProcess. Three Windows-only assertions counted every non-taskkill spawn as a command launch (or deleted the job store on every non-taskkill spawn); they now treat taskkill and the snapshot as stop controllers, so they keep checking that exactly one command was launched. Measured: commandJobs.test.ts passes on Linux (38 passed) and, run once with process.platform forced to win32 and win32 path helpers in a throwaway copy, also passes there (38 passed), which is how the coordinator's Windows run is expected to behave. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
… what it cannot reach Review fixes for the Windows tree-kill work, using the evidence from a real Windows 11 PC (a node-only tree collapses by itself through libuv's kill-on-close job, so it can never show a wrong stop). Sweep safety: a child is accepted only inside the lifetime of its claimed parent. Every member gets an upper bound (a successful kill, or the first snapshot that lacks it), and a root that had already exited before the stop gets its 'exit' time from terminalRun / commandJobs: no taskkill is aimed at its pid any more and nothing created after the exit counts as its child. The snapshot taken in parallel with the first kill only records members. At the deadline the members known to be alive are killed once more. Honesty: 'tree-swept', `confirmed` and the commandJobs comment now say "no live process linked by parent pid to the command was found". Orphans (their parent exited before the stop) and children of members no snapshot saw alive stay out of reach without the Job Object helper; two unit tests pin that. Snapshot script: selects only the three properties it needs and uses plain pipeline output, so it also runs under Constrained Language Mode. Helper path: a command path or working directory beyond the classic Windows length limits keeps the direct spawn (stricter than libuv, tested). Real-process tests: the growing tree and a new orphan tree start their leaves detached on win32, so they can fail there; every leaf exits by itself after 20 s and is killed by pid in finally. With an installed helper the stop must report 'job-object'; without it the growing case must pass through the sweep and the orphan case asserts the documented gap. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…he helper, bound the close wait Follow-ups of the independent panel on the Windows tree stop: - The root's death is dated by its 'exit' event (Node keeps the handle until then, so the pid cannot be reused earlier), also when the first taskkill exits non-zero; a sweep batch that exits non-zero is retried one pid per taskkill, so exit 0 or 128 dates each death. Before, both cases stretched the window in which a child of a reused pid was taken for a tree member and killed. - Protected pids are protected by identity (a holder older than the root); a live linked process that may not be killed makes the stop 'protected-member', never 'converged'. - A .cmd/.bat name as given keeps the direct spawn (Node refuses it with EINVAL), instead of resolving to e.g. npm.cmd.exe on the search path. - After a Windows stop, the wait for the command's 'close' is bounded (3 s): a process out of reach holding the pipes no longer keeps the run pending; it ends with what was read and is reported unconfirmed. - An unconfined command job whose sweep could take no snapshot (PowerShell blocked by policy) is judged as before the sweep existed, instead of quarantining the job host until a restart. - A packaged app never loads the helper from its start directory. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…t's key The autosave mirror's IndexedDB fallback took whatever the store held for an item id (keyed, per-item or bare blob). Since the dual write gives every blob version of an item id a per-item blob, an unreachable remote image brought back by undo was mirrored with the bytes of another version under its URL's key; the slot then counted as staged and the prune deleted the real last copy. The mirror now reads only the keyed blob of the slot's key, or for a content (b-) key a per-item blob whose SHA-256 matches that key. Without a key (while planning derives it from the bytes) no stored copy is used. Refused bytes leave the slot unsafe, so its previous copy stays carried and protected. Test: move, replace, delete, then undo back to the remote version keeps the original snapshot copy (failed before: the copy was pruned). Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
The per-source cache of mirror entry names keyed every source the save walk
saw as `${assetDir}\n${source}`. Hashing that key flattened a full copy of
every data: URL (several MB each) and the module-level map kept it until
20,000 newer sources arrived, although a data: URL can never point into the
mirror folder (its value was always null).
Sources that cannot name a local file (anything but local-media://, file://
or an absolute path, judged from their first characters) now return null
before a key is built, and sources longer than
CANVAS_SOURCE_STRING_KEY_CACHE_MAX_LENGTH are resolved without caching.
Test: a save of five 20 KB inline images plus a history snapshot adds only
the one local source to the cache and no key longer than 2304 characters
(before: 7 entries, each inline image kept whole).
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
The free-space guard on mirror copies did not hold: three concurrent copies
each passed one statfs check and together filled the volume, and a refused
copy went around the guard through the renderer (read the file, send it
through writeCanvasMirrorAsset, which never checked).
Main now reserves the bytes of every asset it is about to write per volume
(device id): after reading the free space it checks and reserves in one step,
gives reserved bytes back as they reach the temporary file, and releases the
rest when the publish ends. The check runs inside publishCanvasMirrorAsset,
so copy and write share it, and an asset that already exists is still
reported as 'exists'. A refusal resolves { status: 'no-space' } instead of
throwing. The renderer treats it as final for this save: the slot stays
unsafe (its previous copy is carried, or nothing is pruned) and the bytes
are not sent again; the next save asks once more.
Tests: three concurrent copies with room for one publish one; a copy and a
renderer write share the reservation; a write on a full volume publishes
nothing; the renderer sends nothing twice and keeps the previous copy. The
existing 'refuses a copy the free disk space cannot hold' test now expects
the 'no-space' result instead of a rejection.
Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…ving The rollback-safe dual write put the keyed blob and the per-item blob of a new asset in one transaction, and every put clones its value, so two serialized copies existed together while the bytes read for the save were still held through the whole mirror phase (about three copies of a new asset in flight). - The per-item copies are written in a second transaction opened once the keyed batch has committed; the commit's copies from a stored keyed blob are issued one put at a time. - Only the bytes the mirror writes from the renderer (a source main cannot copy, or a content key written as it is) are kept for the mirror; the others are released before the copies start, and each kept entry is dropped once its asset is staged. - The test double in canvasStorage.test.ts now returns a request from put, as IndexedDB does. Peak bytes in flight for a new path-backed asset drop from about three copies to one plus one clone. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
The mirror step runs inside the exclusive canvas save, so a multi-GB copy on a slow disk held every later IndexedDB save (and loadCanvasItems) behind it; pasted images that exist only in the renderer were not stored until it ended. A file of 64 MB or more is now copied by main in a detached job, one at a time. The save does not wait for it: the slot stays unsafe for that save, so it carries the copy the mirror held before (or the save does not prune), exactly like an asset that could not be staged. The job's file is kept by every prune until a save that listed the folder after the job settled has written its project file, which then names it. A job that failed is consumed by the next save, which copies within the save with the usual fallback through the renderer; 'no-space' stays final for the job. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…ee times per save Every save, metadata-only blur flushes included, deserialized the whole stored record up to three times on the renderer main thread: the save baseline, the commit (for the record it replaces) and the IndexedDB prune. Each commit now also writes a small revision marker next to the record (<storeKey>::canvas-save-revision, same store, same transaction) and keeps a summary of what it committed in memory: the legacy per-item blob keys, the item ids and the content keys the items reference. The baseline, the commit and the prune read the marker; when it names this session's last commit they use that summary, otherwise (another window's commit, a clear, no marker) they read the record as before. A load drops the summary, so the first save after it reads the record once. clearCanvasItems deletes the marker. The previous release only gets and puts the record by its own key and never sees the marker. Two tests that counted the puts of the metadata transaction now expect the marker put as well. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…hout blobs After a reopen every image of the board was read from IndexedDB into the renderer and wrapped in a new Blob and object URL (createCanvasBlobUrlMap) that nothing revoked; the WebGL layer needs the bytes only while it uploads. The managed-media reference scanner also loaded every board of every project through loadCanvasItems on start, on every window focus and every 5 minutes, making object URLs for all their images each time and never revoking them, although it reads only the items' media references. - loadCanvasItems lists the board's autosave mirror first. An image of a record this version wrote whose content key has a file in the mirror (assets/<key><ext>, written once, never rewritten) is restored from that file: its bytes are not read from IndexedDB and no object URL is made. The layer, a crop, a save or an Agent hand-off (which imports it into managed media) read the file when they need the bytes; IndexedDB still holds them under the same key, so the next save moves nothing. The mirror is used only when the window may read it through local-media: one sample file goes through the same check the loaders use (resolveAuthorizedCanvasLocalMediaSourceUrl), so a mirror main does not serve (a network share) and POSIX systems, where local-media:///tmp/x is mapped to the network path //tmp/x and refused, keep the IndexedDB restore. Previous-release records, images whose mirror file is missing and other item types are restored as before. - loadCanvasItemsMetadata reads only the record (no binary, no URL); the scanner uses it. A board without a record is still loaded fully. Measured (100 images of 4096x3072 PNG, reopen, 30 s later; Linux with a harness shim that maps local-media paths as on Windows): renderer working set 504 -> 409 MB, all processes 1419 -> 1149 MB; first pixels 4.7 -> 1.6 s, board complete 5.3 -> 10.0 s (images are read from files). Without the shim (POSIX fallback) the numbers match the base. Not done: object URLs still made by a restore (images without a usable mirror file, videos, models, files) have no owner that revokes them. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
… run chatStorage.test.ts failed now and then under parallel runs, each time in a different test. Its fake transaction completed on a fixed 5 ms timer, while each get answered on a 0 ms timer. Node runs all due timers of one duration before it turns to another, so on a busy machine, with an earlier 5 ms timer still pending (the read of the test before, which resolves on its get), a transaction's completion could run before the onsuccess of its own get. A save then resolved before its put, and the test saw a missing record or an extra put. The fake now behaves like IndexedDB: each request holds its transaction open until its callback has returned, and the transaction completes once no request is pending and 5 ms have passed. The flakiness is older than the M4 work; with a setup file that stalls the thread after some timer callbacks, the base 05abcdc failed 5 of 18 seeds and the branch before this change 10 of 18, and none fail with it. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
… timeout The idle migration of a conversation's stored inline images ran its imports inside that conversation's save chain: rewriteStored's callback awaited the import of every image, with no timeout. The pause rules apply only when an attempt starts, so a message the user sent during an attempt, its reply placeholder and the reply waited for every import, and for good when main did not answer; a crash in that window lost them. The migration now imports first, outside the chain, each image within 30 s (an image that takes longer stays inline and the others are still migrated). Only the compare-and-write runs in the chain, through the same helper the save guard's background imports use: the references go into the newest record the page expects (its save baseline, which a save made meanwhile has moved) and into the live conversation, whose unsaved snapshot moves with it; a deleted conversation, another writer's record or nothing left to replace writes nothing, and the imports are handed back for reclaim. The read path's migration gets the same per-image timeout. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…nce write-back A background write-back (the save guard's finished imports, the stored image migration) swaps the live conversation object for one with the same content and managed references in place of its inline images. A save bound to the exact object it was asked for, queued behind that write-back, then found another object live and gave up: a team receipt reported "message was not queued" and a draft save returned silently. Nothing was lost, but the user's action failed for no reason of their own. The save baseline now remembers which object took the place of which (noteReplaced): the write-back and the adopt step of a stored form record each swap they make. A save bound to an object (persistExact, used by the page's identity-bound saves and by the snapshot save before it retries on the live object) follows those records and saves the object that stands for it now. A real change that replaced the object still makes the save write nothing, as before. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
The save guard keys its import caches by the length and two hashes of every character of an oversized inline image, and it computed that key on the save path the first time it saw an attachment object: about 30-50 ms per 10 MB on the main thread, inside the stored form's prepare step of the save the user is waiting for. The save path (needsImport, externalizeKnown) now uses only keys that are already known. An image whose key is not known yet counts as still to import, so the save writes it as it is and asks the background import, which computes the key in slices of 512 K characters with a turn of the event loop between them, then reuses a finished import of the same image or imports it; the write-back puts the reference in. The key is the same full-content hash as before, computed once per attachment object, so two images that differ anywhere still never share an import. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…lder The local-media protocol and the svcFs media reads (readImageFromPath, readFileFromPath, copyCanvasMirrorAsset) used the whole userData folder as a root. It holds config.json with every API key, the grants file, chats, custom skills and Chromium's profile. A board item, a chat attachment or an imported skill's reference attachment can name any path, and those bytes go to the model as a data URL or into a project's shared assets. So a skill naming local-media:///<userData>/config.json would send every key to the user's model. Every media read now uses the folders of userData that actually hold media: .chat_media (managed media, ComfyUI and provider outputs, derivatives and figplugin outputs), project-canvas-thumbnail-cache, qapp-input-images, .report_bundles and report-bundles, plus the temp media folder, the project and autosave folders. The producers take their folder names from the same list, so a renamed folder cannot drop out of the roots. Managed-media imports, thumbnails, native regions and the scoped-path check use the same roots. A folder the user once granted that holds userData (their home folder) would still have served config.json, so grants no longer reach into the data folder; its media folders are served as roots. One-use import grants are untouched: they are for the very file the user just picked. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…ol may The Hunyuan3D and Tripo3D clients read any local path an image attachment named (local-media:, file: or a bare drive path) with fs.readFile, then uploaded the bytes to the provider. A chat request carries attachments from anywhere, a skill's reference images or a stored chat included, so a URL naming config.json would have uploaded every API key. On POSIX the local-media and file:/// forms also lost their leading slash and never worked. Both now read through one helper: the path is authorized by the media policy (a file the user granted or one in the app's media, project or autosave folders) off main's event loop and under the deadline, then the canonical file is read with a size cap. Managed chat images, such as a generated concept image passed on to the model step, keep working. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
The page names the temp file that is handed to Photoshop, and that path is written into a JSX script (Windows) or an AppleScript (macOS) between double quotes. Quotes were already refused, but a newline or another control character could still break the script's syntax. Such a name now falls back to a generated one, like any other unsafe name. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
The breaker started every call at once, up to 2048 per root and with no limit on the number of roots, until the first one had been pending for two seconds. libuv has four threads and runs queued calls in order without cancelling any, so a board of a thousand images on a share that went offline held the threadpool for its whole OS timeout. Slowness was also counted from when a call was submitted: healthy realpaths waiting in libuv behind dead ones passed two seconds and closed their own folder, such as the home folder with the app's data. And one stall at /Users/x.png closed all of /Users. Now at most three calls run at once in all, slow ones included, so the breaker never takes every thread and a call it starts never waits in libuv behind another of its calls. At most two calls that are not slow run on one root; the others wait in an O(1) FIFO per root, bounded in length (2048 per root, 8192 in all) and in waiting time (10 s), then are refused. A call is counted as slow only from when it started, so a call waiting its turn never closes anything. A closed place never reaches the root of a local drive or a first directory, nor a home folder directly in one: a stall there closes only the stalled file. A mount (a share, /Volumes/<name>) can still close as a whole. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
A canvas image whose load failed was kept in failedLoadSrcByIdRef and not loaded again until its source changed. When main's per-image breaker or the path deadline held the request back (the protocol answers 503, the scoped-path check answers nothing), the image stayed broken for the whole session, although the drive or the breaker answered seconds later. A failed local-media load now asks main again with a HEAD request. On a 503, or when the file is served by then, the image is loaded again after 0.5, 2, 8 and 30 seconds, then it stays failed as before. A refused (403) or missing (404) file and any other kind of source are never retried. A successful load, a new source or an item leaving the board starts over. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
A stall at /Volumes/nas/a.png closed all of /Volumes/nas at once, because the folder of a stalled call could be the root of its mount. The file may be a link to somewhere else, so one stall now closes only that file when its folder is the root, as for a drive or a first directory. Once a second place of the mount stalls, their common folder, the mount itself, closes as before. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
- Records inside the window an older build still claimed within are never stranded: the queue marker now also stores the position of the 1000th unarchived record at the first poll (one row, read with a new `offset` option of listResources), and only records after it count as stranded. - A record this build enqueued is never stranded, whatever its caller-supplied requestedAt: enqueue marks it `unboundedQueue`. - maxCatchUpRuns holds while the dead-letter batch keeps failing: a poll records each trigger's floor as soon as it knows it, and floors only move later, so a doomed record left pending by a failed batch is not claimed once the newer ones ran (one page or many). A marker without the window edge (an earlier build of this rule) still bounds by time only; one this build cannot read marks nothing stranded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
Grants no longer reach into the data folder, but a configured root that holds it (a storage or project folder set to the home folder) still served config.json. A root now serves a path in an excluded folder only when the root itself lies inside that folder (the app's media folders). The grant tests compare paths in the platform's own spelling, and a comment no longer spells the NT prefix the encoding check reads as broken text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
The breaker keeps a home folder open by closing nothing shallower than two levels below the root's first directory (/Users/x/Pictures). A drive letter counts as its own segment, so on Windows that limit was the home folder itself (C:\Users\x): two stalls in different folders of it shut every image under it. A drive root now needs three levels. The renderer-path and thumbnail tests now compare paths in the platform's own spelling, the POSIX-path breaker cases run off Windows only, and a Windows case covers the drive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
The renderer-path check resolves a path before the media policy sees it, so on Windows the NT object-namespace spelling reached the policy as C: followed by the prefix and passed the text check: main then called realpath on it (Windows reads that form as an invalid local name, so no host was contacted, but no filesystem call may happen for it at all). The check now matches the prefix after a drive too. Tests that encode POSIX spellings (//dir/file for a local file, a //host share) now use the Windows form or run off Windows only, compare paths in the platform's spelling, give two heavy trigger tests 30 s on a slow machine, and the bridge configuration test mocks the bootstrap file name its module now imports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…tting A reply that was being written when the app reloaded, crashed or quit looked finished after the restart. The placeholder now carries runState 'streaming'; every ending writes a new message, so the field lasts exactly as long as the reply is unfinished. A message that still has it and is not the live reply shows the existing "interrupted" line after its text or tool rows, as a broken stream already did. Nothing is rewritten at load, and the field never reaches MAIN (request messages are rebuilt from role, content, attachments and tool history). A Stop settles the reply it ends in the same update that ends loading (an empty placeholder goes, a partial reply stays without the field), so a reply the user stopped is never marked; only when the run was live, so an older reply that really was cut off keeps its mark. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…e files The team menu, member form, queue rows and team notices showed Chinese written straight into the code, so English users saw Chinese and the i18n check failed. The texts now live in zh-CN and en-US renderer.json. Tests read the same locale files: a react-i18next mock for the team menu tests, a shared i18next setup for modules that translate outside React, and a fallback for the keys that only exist in the locale files. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
Kohaku's read tool takes an offset and a limit, so an agent can look at part of a long file without filling its context. files.read now takes the same two arguments for plain UTF-8 text: offset is the 0-based first line, limit the number of lines. The result says which lines it holds (lineOffset, lineCount) and how many the file has (totalLines; a lower bound when the file was longer than the bytes read). The byte limits stay as they were: the window is cut from text that was already read under them. Images, PDFs and Office documents refuse a window. The desktop read path now checks the arguments against the tool schema too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
Brings in the dependency audit fix from master (#131). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…advisories CI's production audit refused sharp 0.34.5 (GHSA-f88m-g3jw-g9cj, GHSA-rgj7-g3m4-5g8c, GHSA-wq5f-xc86-pv6w). 0.35.5 carries the fixed libraries. The image input and image review code uses only sharp's metadata, resize and encode calls, which did not change; their tests pass on 0.35.5. npm audit --omit=dev now reports no vulnerabilities. Both lockfiles change only sharp, its @img platform packages and its own semver. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
On CI a generated image was auto-saved twice: while the first save was still running, the next scan saw the image under another identity and the saved-key check could not match it yet. A slot (session, message, attachment) whose auto-save is running is now skipped until that save ends. The two cross-layer team tests also follow the current page: - Team management opens from the conversation header. The composer no longer has a team menu. - After End, MAIN refuses the approval's continuation, so the writer's note is not saved. teamEndCutTurn.test.ts already covers this rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
CodeQL flagged four test lines on this pull request: - The proxy redirect test matched a host by URL prefix. It now compares the parsed host name. - The HTML shell test took the script text with a case-sensitive pattern. The pattern now ignores case. - The approval center test stripped tags from textContent, which has none. It now checks textContent directly. Each test still checks the same thing, and all three pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
A closed sheet keeps retrying to hand the focus back for a moment. When the sheet unmounted during that time, the pending retry still ran and read a document that was gone, and the CI run counted that as an uncaught error. The retry timer is now cleared on unmount, and a retry that still fires does nothing once the sheet is gone. The attachment acknowledgement test in runtimeFlow now counts only its own conversation's auto-save. Only its own save waits on the gate. An earlier test's page can finish a save after it unmounts, and that save reached the shared mock and was counted as a second one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
…ease Two backup restore tests left a stale lease that names process 123 and expected it to count as gone. On a CI runner a live process had that id, so the lease counted as live and both tests failed. They now use 2147483646. That id is above the Linux pid_max ceiling and is not a multiple of 4, which every Windows process id is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
172908710
pushed a commit
that referenced
this pull request
Nov 22, 2026
The private repository's CI runs the open-candidate audit, which refuses public source that names private paths or the Codex and ChatGPT backends. It found 31 hits that came in with #134. Public CI does not run this audit. - Test fixtures that used "private" as a synthetic folder name now use "hidden". The tests still check the same paths. - The image tool test used the Codex backend's real URL as a fixture endpoint. It now uses a synthetic one. - A comment in the report bundle registry gave the macOS /var link as an example by its target path. It now names it without that path. node scripts/create-open-candidate.mjs --verify now passes. The touched tests pass: 3601 node tests and 234 web tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
172908710
pushed a commit
that referenced
this pull request
Nov 22, 2026
…can install A local checkpoint commit in #134 moved eight vendor submodules (ComfyUI and seven custom nodes) to newer commits. The bump was never reviewed or packaged. The newer ComfyUI-RMBG asks for nobg, which needs huggingface-hub>=1.22. The embedded runtime pins huggingface-hub==0.36.2 and transformers needs <1.0, so pip cannot resolve the requirements. The private repository's Windows package job fails at that step. All eight return to the commits master had before #134, which are the last ones the Windows package was built from. Moving ComfyUI forward can come back as its own change, with a package run to check it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND
172908710
added a commit
that referenced
this pull request
Nov 22, 2026
…ackaged ComfyUI submodules (#135) * fix(open-candidate): keep private-looking names out of the public source The private repository's CI runs the open-candidate audit, which refuses public source that names private paths or the Codex and ChatGPT backends. It found 31 hits that came in with #134. Public CI does not run this audit. - Test fixtures that used "private" as a synthetic folder name now use "hidden". The tests still check the same paths. - The image tool test used the Codex backend's real URL as a fixture endpoint. It now uses a synthetic one. - A comment in the report bundle registry gave the macOS /var link as an example by its target path. It now names it without that path. node scripts/create-open-candidate.mjs --verify now passes. The touched tests pass: 3601 node tests and 234 web tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND * fix(vendor): restore the ComfyUI submodules that the Windows package can install A local checkpoint commit in #134 moved eight vendor submodules (ComfyUI and seven custom nodes) to newer commits. The bump was never reviewed or packaged. The newer ComfyUI-RMBG asks for nobg, which needs huggingface-hub>=1.22. The embedded runtime pins huggingface-hub==0.36.2 and transformers needs <1.0, so pip cannot resolve the requirements. The private repository's Windows package job fails at that step. All eight return to the commits master had before #134, which are the last ones the Windows package was built from. Moving ComfyUI forward can come back as its own change, with a package run to check it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qq9PmGwv8Hc1iHFPsAUfND --------- Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This branch carries the Agent thread work since the last merge: the Agent column follows the KohakuTerrarium VS Code extension, local file reads go through main's grants, and chat images leave the renderer's memory sooner. It also merges master (#131).
What changes for the user
npm run lintpasses again.files.readline windows.files.readtakesoffset(0-based first line) andlimit(number of lines) for plain UTF-8 text, as Kohaku's read tool does. It reportslineOffset,lineCountandtotalLines. The byte limits are unchanged.Security and data
Checks run on Windows
tsc(node and web): clean.npm run lint: exit 0, warnings only.check:i18n: passes.crossLayerScratchpad/crossLayerTeamMessages(temp-folder lock, timeout) and a few node suites (figplugin audits, skill packages, provider admission). The Linux run in CI is the reference.Open for the owner
Generated by Claude Code