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>
DecomposeGoalsWithProvider built its session without a DynamicBoundary,
and Norma reads 0 as "no cache breakpoint", so every turn of goal
decomposition resent its tools and system prompt uncached on Anthropic
profiles. It now sets 1 for its single static segment, the breakpoint
docs/context-telemetry.md still said deferredSystem returns 0 without
a global deferred-MCP block. It now describes the always-on boundary
and what system_dynamic holds on each lane.
Tests: TestDecomposeGoalsValidStructuredToolCallAccepted checks the
boundary on every request (needs Postgres); it fails with the fix
reverted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part 1 of 4 of the proxy pool design in #545: storage and a CRUD API.
Nothing activates an entry yet, so the global proxy is unchanged.
- Migration 0028 adds proxy_pool: a unique keyed address hash, at most
one active entry (partial unique index), a CHECK that the active entry
is enabled, and nullable egress_ip, last_check_at and last_check_ok for
the health check.
- Addresses are normalized, sealed at rest (AAD proxy_pool.address) and
covered by the startup key check and key rotation. Uniqueness uses an
HMAC under a sub-key kept on secretBox; RotateSecretKey locks the table
and rehashes in its transaction, and pool writes seal under that lock.
- GET/POST /api/proxy-pool and PATCH/DELETE /api/proxy-pool/{id} never
return an address; a masked address on update keeps the stored one.
- Test the 401 login fallback when the body is not JSON.
- Flag bare sendBeacon calls and parse .js, .mjs and .cjs as JavaScript.
- Record the change-password 403 in the CHANGELOG.
- 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>
requirePerm now applies the recorded permission instead of only checking
that one exists: a perm.Authenticated pattern answers 401 without a valid
session. requireAuth exempts /api/auth/ by prefix, so a wildcard pattern
such as "GET /api/{kind}/items" would otherwise be public for
/api/auth/items.
Handler builds its chain with handlerFor, and TestUntaggedRouteIsForbidden
uses handlerFor, so removing requirePerm from the production chain fails
the test. A wildcard route is tested with a path under /api/auth/.
TestNoRawRouteRegistration allows only root.Handle("/api/", ...) and
root.HandleFunc("/", ...) in server.go; any other root route would skip
requireAuth.
TestHandlerDeniesAuthenticatedRoutesWithoutSession checks every
authenticated route through the real Handler.
Every /api route is now added with s.handle(mux, pattern, perm, h), which
records the permission the route needs. There are two permissions for now:
perm.Public for the routes requireAuth already exempts (/api/auth/*,
/api/health, /api/ready) and perm.Authenticated for all others.
A new check runs after requireAuth and answers 403 when the matched pattern
has no recorded permission, so a route added with a plain HandleFunc call is
denied instead of served. requireAuth itself is unchanged.
Tests check that every route has a permission, that the public routes are
exactly the ones requireAuth exempts, that no file registers a route outside
s.handle, and that an untagged route returns 403.
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 probe looked for task B under /app/data/tasks, which the worker
image does not mount, so it always reported TASKB_BLOCKED. Probe
/workspace instead: secret-a.txt is the positive control that the
task's own workspace is mounted, and secret-b.txt must stay invisible.
docker version has no .Server.Engine field, so the previous check never
matched. Read .Server.Platform.Name instead and run detection even when
DOCKER_HOST is explicit, so the unverified-Podman warning also fires for
the common compat-socket setup.
Docker Desktop publishes /var/run/docker.sock as a symlink, so stop
refusing symlinked sockets; test -S follows them and find -L checks the
target's mode.
The changes filter only ran for pull requests, so every push to main
(each merge) ran every job, e.g. the full Go suite twice (pinned and
stable) after a docs- or web-only merge. Pushes are now filtered too:
dorny/paths-filter diffs a push against the commit before it (git-based,
so the job checks the repository out first).
A manual run and any failure of the changes job still run everything.
govulncheck keeps running on every push to main, since new advisories
are published against unchanged code and it is the only regular check
for them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>