A successful load after a failed search must clear the error even when
the rows, total and counts match the state the failed search left
behind. Without the !dslError check the reducer returns that state and
the error stays visible.
Converts the chat page, chat view and draft chat, the dashboard, the
shared browser page, and the login and setup pages to typed reducers in
_state/. The selected conversation and approval focus stay in the URL.
The chat list poll (2 s) and the dashboard live (5 s) and system (15 s)
polls return the same state when the data is unchanged.
Part of #546.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Converts these pages to typed reducers in _state/, on the shared list
and request slices. The chat bridge status poll returns the same state
when the bridge is unchanged.
Part of #546.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Converts the intercept rules page and judge card, the asset intercept
page, and the notify page and its delivery list to typed reducers in
_state/, on the shared list, request and pagination slices.
InterceptPage's regexErr state is removed: it was only ever set to "",
so its error message could never render.
Part of #546.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Converts the LLM page and profile sheet, the tools page, tool editor and
custom tool dialog, and the create-agent dialog to typed reducers in
_state/, on the shared request slice.
Part of #546.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The unchanged-poll comments now say what the code guarantees: the same
state object is returned, so React can bail out of the update. The
assets list comment now says when loaded is reset (first load and a
manual refresh, not tab, page or query changes).
Tests, as requested in review: a poll that changes one nested field of
one row updates that row (assets and credentials), and a successful load
after a failed search clears the error and shows the rows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- change-password returns 403 for a wrong current password and keeps 401
for an invalid or expired session, like authInit's bad setup token.
- apiFetch only treats a 401 from /auth/login as bad credentials; every
other 401 clears the session and returns to /login.
- Tests cover change-password with an expired session and with a wrong
current password, and the direct-network check parses the AST so
comments, strings and test files cannot produce false positives.
- apiFetch treats a 401 from /auth/* as bad credentials, not as an
expired session: the session is kept and the server message is
exposed instead of reloading /login.
- Test the openSSE constructor wiring, the login 401 path, the absence
of Content-Type on the three FormData uploads, and broaden the direct
network check to window/globalThis/self fetch, XMLHttpRequest,
EventSource and sendBeacon in .js, .mjs, .cjs and .jsx files.
- apiFetch forces credentials same-origin and redirect error after the
caller init, so a caller cannot widen either and a future redirect is
refused like in SSEStream.
- clearToken reuses the cookie deletion clearSession uses, including
SameSite=Lax and Secure over HTTPS.
- loadOlderHistory catches the ForbiddenError and shows the server
message instead of leaving an unhandled rejection.
With the category Combobox of the New task sheet open, an overlay click
closed the whole sheet: isRadixOverlayOpenNow did not match the Base UI
popup, whose open state is data-open, not data-state. Add
[data-slot='combobox-content'][data-open] to the selector.
Add web/src/lib/utils.test.mjs, run by test:reducers: a DOM-free test of
preventDismissUnlessOverlayClick with a stub document, covering Select,
popper content, Combobox, menu triggers, the open sheet/dialog trigger
and an expanded Collapsible. The alias loader now adds the JSON import
attribute so tests can import modules that depend on @/i18n.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The review asked for a rebase onto main. A rebase cannot be published to
this fork: ruleset "prevent-force-push-any" (id 13967828) applies
non_fast_forward to ~ALL branches, so every force-push is rejected. The
branch is therefore brought up to date by merge, which is a fast-forward
push and leaves the reviewed commits in place.
The merge result is byte-identical to the rebased result: the staged tree
hashes to 7d33b7fc, the same tree as the rebase I verified locally
(tsc, biome, test:i18n 11/11, test:reducers 59/59, build:static).
Conflict resolution:
- CHANGELOG.md: main's Added section grew (Slack channel, log rotation);
this branch's target-gate entry is kept between them.
- overview-tab.tsx: main refactored TaskInterceptRulesCard onto
useReducer (b9388fb7), so the gate was ported into the new shape rather
than the reverse. The gate keeps its own local state beside the reducer
and the rules read feeds the existing `rulesLoaded` action; the task-id
and request-stamp guards from the review apply to both reads. Nothing
from the refactor is reverted: the diff against main on this file is
additions only, apart from the two lines the guards replace.
http() and twelve calls that used fetch directly (uploads, downloads,
exports, the report, tool-config and the logs history) each built their own
Authorization header. Only http() and the HAR export handled a 401, with two
inline copies of the session clean-up, and openSSE had a third.
All of them now use apiFetch (src/lib/api-fetch.ts):
- 401: clearSession() (src/lib/auth.ts) drops the token and the cookie and
goes to /login, then the call throws, as http() did before.
- 403: throws ForbiddenError, an ApiError with status 403 and the server's
message, ready to show in a toast.
ApiError moves to api-fetch.ts and is still exported from api.ts. The SSE
client keeps its own fetch and now calls clearSession on a 401.
SheetContent and DialogContent each carried a copy of the same
onInteractOutside guard, and losing one copy is how the Sheet guard
disappeared. Move it to preventDismissUnlessOverlayClick in lib/utils.ts
and call it from both. No behavior change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
isRadixOverlayOpenNow treated any element with aria-expanded=true and
data-state=open as an open popover. The trigger of the open sheet or
dialog itself (aria-haspopup=dialog) and an expanded Collapsible match
that selector, so with the guard in place an overlay click never closed
a sheet or dialog that was opened through SheetTrigger/DialogTrigger
(Tasks category management, Agents create dialog). Count only triggers
that announce a non-dialog popup; popover content is still matched by
the Radix popper wrapper.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With a Select/Popover open inside a Sheet, any click (inside the form or
on the backdrop) closed the whole sheet and dropped unsaved input. The
onInteractOutside guard added in aef0376 was lost when 32ec7fe restored
the pre-fix sheet.tsx. Restore it, mirroring DialogContent: only a click
on the overlay with no popover open closes the sheet.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fr and pt-BR dictionaries landed on main after this branch was cut, so
the dictionary checker reported the Slack help text as missing in both.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Converts the remaining task detail tabs to typed reducers in
tasks/detail/_state/, on the shared list and pagination slices.
The assets (10 s) and credentials (15 s) polls return the same state
when nothing changed, so an unchanged poll does not re-render the tab.
Part of #546.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
feedLoaded returned a new state on every 8 s poll, even when the page,
total, unread count and fresh marks were the same, so the whole tab
re-rendered with no visible change. It now returns the same state then,
and keeps the current content objects when only the counts change.
Tests, as requested in review: the unchanged-poll no-op, the return to
page 1 after a search, type filter or page-size change, and the active
profile fallback in profileIDsChanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The request counter alone was not enough: a rule write started for task A
holds A's loadRules closure, so when it resolved after a switch it fetched
A's rules and — being the newest request — painted them into task B's card.
The card now also reads a taskIdRef that names the task it shows. Every
read and write returns early when that ref has moved, and the counter
still drops a response that a newer request for the same task replaced.
add, saveEdit and toggleTargetGate return early too, so a late response
cannot clear the next task's half-typed form or leave its switch busy.
Verified: npx tsc --noEmit clean, npx biome ci . 0 errors (196 files),
npm run build:static compiled.
Review of 43f6d20 asked for three fixes.
- The "not audited" claim was stale: db.UpdateTask records every
target_gate change in the task activity as target_gate_changed with
the operator, the client address and the before/after values since
#816. README and CHANGELOG now say so instead of the opposite.
- The gate switch and the rules list could paint another task's state:
the card stays mounted across task switches and neither read nor the
toggle guarded its response. Each read and write now stamps the
request it belongs to, and a response that is no longer the latest
one is dropped. The reset effect also clears the busy flag and the
rules, so a switch never shows the previous task's rules.
- The create-sheet "Off + block rules" warning counted switched-off
rules. It now requires r.enabled, as the overview card already did.
The merge of origin/main brought fr.json (added by #795) which lacked
the gate strings this branch added to the other four dictionaries, so
npm run test:i18n failed on the merged branch. The two superseded
strings were replaced and the fourteen gate strings translated.
Verified: npx tsc --noEmit clean, npx biome ci . 0 errors (196 files),
npm run test:i18n 11/11, npm run build:static compiled.
Brings the branch up to date with main so the PR is mergeable again.
The only conflict was the Unreleased "Added" section of CHANGELOG.md,
where this branch's target-gate entry and main's log-rotation entry
both inserted at the top; both entries are kept.
Converts the task detail page (and its LLM control), the overview tab
(and its intercept rules card) and the broadcast tab to typed reducers
in tasks/detail/_state/, on the shared request and pagination slices.
The pending intercept summary polled by the page (upstream e605578e)
lives in the page reducer and is still passed to the sessions tab.
Part of #546.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moves the sessions tab's ~30 useState calls into one typed reducer
(_state/sessions-tab.reducer.ts), grouped into the session store,
navigation, main-agent segments, workers, composer, worker chat,
worker control, task status and request flags. The activity
merge/dedup helpers move with it.
Pending intercepts stay a prop from the task page (upstream e605578e).
Part of #546.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review of the first commit found defects in the new control and copy that
overstated what the gate does. Fixes, all frontend plus docs:
- The gate read and the rules read no longer share one Promise.all: a
failing /intercept-rules call used to leave the switch disabled forever
with no retry. They load independently, a failed gate read offers Retry,
and the error renders next to the switch instead of inside the add-rule
row.
- A task row without target_gate now reads as unknown (switch disabled)
instead of a confident "off"; state resets when the task id changes, so
the switch cannot show or write another task's gate.
- The amber warning counts only enabled block rules: allow-only and
switched-off rules are unaffected by the gate.
- Rule mutations reload the rules only, so a concurrent toggle is no longer
overwritten by a stale snapshot.
- The switch is disabled on a finished task, where no call is left to gate.
- Copy: the gate checks the targets a call declares, not "every outbound
network target"; an unpinned target waits the 300 s bound and is then
refused; allow rules do not apply to the gate; sandbox mode gates the
call, not the worker's sockets, and turns on the panel-hosted browser.
The create sheet warns when "Off" is chosen with block rules present, and
the advanced-settings summary now lists the gate and coverage.
- updateTask keeps its original signature (no call sites, and the wider
shape type-erased plan_quiet_mode); the dead variant is gone.
- README: the gate is no longer "off by default, API-only"; the changelog
entry is scoped to tasks and records the known limits.
The target gate was API-only: POST /api/tasks and PATCH /api/tasks/{id}
accepted target_gate, but the panel never sent, read or displayed it. A
task-level block rule added to a task whose gate was off therefore never
reached a network target, because intercept.CheckTargets returns before
any rule is matched while the gate is disabled.
- create-task sheet: a "Network target gate" selector (auto / on / off).
Auto sends nothing, so the backend default stays in force: on for scoped
tasks (linked company or task-level rules), off otherwise.
- task overview rule card: a switch that shows the stored state, warns
explicitly while block rules exist with the gate off, and PATCHes
/api/tasks/{id} so the next tool call sees the new value.
- lib/api: createTask(targetGate), updateTask({targetGate}) and
setTaskTargetGate(); lib/types: Task.target_gate.
- mock handler mirrors the backend default on create and PATCH.
- i18n: zh-CN, tr, pt-BR and vi entries for the new strings.
fuzzy_domain is a substring match, so an allow rule meant to cover a
site and its subdomains (".example.com") also admits names that merely
contain it, such as "a.example.com.other.net", whose owner chooses where
it resolves. There was no kind for "this domain and its subdomains" on a
label boundary.
domain_suffix matches the domain itself and any name ending in
"." + domain; "*.example.com" and ".example.com" are stored as
"example.com". This is the semantics the sandbox egress policy already
applies to scope domains, and taskSandboxRunInfo already read a
domain_suffix allow rule. fuzzy_domain is unchanged, so existing rules
keep their meaning.
Migration 0026 widens the kind CHECK constraint of asset_intercept_rules
and task_intercept_rules; schema.sql carries the same list for new
databases.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- B1: count retrying rounds toward MaxPlanningFailures with exponential backoff
- B2: exclude planner-authored writes from fingerprint; capture start snapshot
and include non-agent task_scope and linked assets
- B3: expose planner recovery state in task API DTO and task detail UI
- B4: clear recovery state again when Engine.Resume lands mid-round and add
dedicated resume_planning control action + UI button
- B5: skip stale time.Ticker heartbeats fired during a long planning round
- B6: move planner_progress DDL from db/schema.sql to migration 0021
(0020 reserved for security batch chat_type backfill)
- i18n: add matching vi.json translations alongside tr.json and zh-CN.json
- tests: initialize secrets-at-rest key in TestPlanningCredentialUpdateReopensPlanning