Redact only masked URL userinfo when url.Parse succeeded. A password
with an unencoded # / ? or % fails to parse, so the startup config
snapshot and the ping error logged it in full.
Every save rewrites all four price columns, so an API client that sent
the profile without price fields reset them to 0. Decode the prices as
*float64 and keep the stored value for any that are missing.
- Require https for base_url. The bot token travels in the URL path and
the responses are the updates the bridge acts on, so plain http is
accepted only with ARTEX_NOTIFY_ALLOW_LOCAL=1, for a local test server.
- Cut replies by UTF-16 code units, which is how Telegram counts its 4096
limit, so emoji-heavy text is no longer rejected. A cut never splits a
character.
- Cap a server-sent retry_after at the backoff ceiling (1 minute).
- Pause one second after an empty poll, so a self-hosted Bot API that
ignores the long-poll timeout cannot spin the loop.
- When the refused-chat memory is full, start over instead of muting
every new chat, which also muted the operator's own chat. Saving the
configuration of the same bot keeps the memory.
- Fix two stale comments that said an empty allowlist keeps the bridge
off (migration 0015 is unreleased, so editing its comment is safe).
Co-authored-by: krad <222954346+dar1k0@users.noreply.github.com>
Review follow-up:
- formatTokens keeps one decimal and drops a trailing ".0" instead of
dropping the decimal from 10k up, so dashboard axis ticks keep their
.5 steps (12.5M, not 13M) and tooltips show 123.5k, not 123k. From
999,950 it switches to "M" so values never read "1000k".
- transcript.tsx: the UserRow doc comment sat above fmtBytes on main and
was removed with it; it is back above UserRow.
- src/lib/format.test.mjs covers the shared formatters under plain
`node --test` (the "@/i18n" import is stubbed with a fixed locale).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
recordViews decoded gzip/deflate/br bodies (up to maxIndexBody each)
while holding wmu, so concurrent proxied responses waited on the
decode. indexBody is pure, so compute the decoded index text before
taking the lock and apply it after spill.
Also keep the text decoded before the cut when a compressed stream is
truncated (io.ErrUnexpectedEOF) instead of dropping it, and skip
decoding when the Content-Type is already binary, since that text is
never indexed.
A WebSocket over a default port is recorded as ws://host or wss://host,
so host:80 and host:443 searches still missed it. Also match the ws and
wss portless forms.
company_id and task_id ignored the operator, so company_id!=N and
task_id!=N compiled to the equality and returned exactly the assets
they were meant to exclude, and company_id>N silently meant =.
!= now excludes (an asset without a company is kept, as for the other
fields), = and == stay equality, and any other operator is rejected
like on the other fields.
GET /api/report renders one task's report, but its "Assets:" summary line
was built from QueryByType over the whole asset library, so it reported
every task's and every company's assets as this task's. It also loaded up
to 100000 full rows per type only to count them.
Use CountsByTypeForTask, the per-task count the assets tab already uses.
The proxy records bodies as they crossed the wire. A response sent with
Content-Encoding gzip, deflate or br (what Go tools such as nuclei,
httpx and ffuf, Python requests and browsers ask for) was stored
compressed, seen as binary and left out of the full-text index. Body
search found nothing in it, and ResponseContaining could not tie a fact
to it.
Index the decoded text of such bodies, bounded to the index limit, and
let ResponseContaining match the decoded response. The stored bytes are
unchanged.
isScopeExpansion asked company_scope for kind IN ('root_domain','subdomain')
and compared against the value column. company_scope only has kind 'domain',
and a domain rule keeps its host in the domain column with value NULL, so
the query never matched. Every domain the agent added under a company that
was already in the task's declared scope was recorded and reported as a
scope expansion.
Match kind='domain' rules on the domain column, exactly or as a parent
domain.
Clients leave :80 and :443 out of the Host header, so a capture of
https://host is recorded without a port. traffic_search with host:443,
host:80 or a URL naming the default port constrained the URL authority
to the explicit port and returned no traffic for those captures. Also
match the scheme's portless form when the port is the default.
An asset DSL exclusion compiled to `col NOT ILIKE $n` for text fields and
`col != $n` for numeric ones. Both are NULL when the asset has no value for
the field, and WHERE treats NULL as false, so `page_title!=login` or
`status_code!=404` also dropped every asset with no title or no status
code, from both the page and its count.
Compile `!=` to `(col IS NULL OR col NOT ILIKE $n)` for text fields and to
`col IS DISTINCT FROM $n` for numeric fields. Array fields are NOT NULL and
already behave.
telegramHTML packed digest lines by their raw text, then wrote them
HTML-escaped. A title or asset with <, > or & (an XSS finding, a URL
with a query string) grows when escaped, so the message passed the
4096-character limit and TruncateHTML cut the last items and the footer.
Those items were still reported as kept, so the notifier marked them
delivered and they never reached Telegram.
Measure each line as it is written: escaped, with its newline.
The same helpers were copied across the frontend: fmtBytes / fmtSize /
formatArchiveBytes (10 copies, 5 behaviours), fmtTokens (7 copies, 3
behaviours), fmtTime / fmtDateTime (11 copies), fmtDuration and statusTone
(4 identical copies). They now live in one place:
- src/lib/format.ts: formatBytes, formatTokens, formatDurationMs,
formatShortDateTime (with seconds / year / empty options)
- src/lib/status.ts: httpStatusTone
Intentionally distinct formats stay local (ISO log timestamps, full-locale
finding date, the translated seconds-based task duration, unix task times).
Visible changes from using one canonical output each:
- sizes of 1 GiB and up show as GB instead of thousands of MB
- dashboard / intercept token counts show "25k" instead of "25.0k"
- LLM records show "2.5M" instead of "2500.0k"
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The cost ledger (#70) stores four prices per profile and the usage API
turns them into cost_eur, but the UI never got the follow-up: the profile
list did not return the prices and the dialog had no inputs for them.
That also made prices fragile. SaveProfile always rewrites the price
columns, and the dialog's save payload had no price fields, so editing a
profile in the UI reset prices set through the API to zero.
Return the prices in LLMProfileDTO, add the four inputs to the dialog and
send them on save. A negative price is stored as unset.
TestConnection passes an empty Tools slice so the model gets a bare chat
request, but agentcore still appends its background-task tools (TaskOutput,
TaskStop, TaskList, Monitor) unless DisableBackgroundTasks is set. The
request therefore carried four tool definitions, and models answered the
"ping" with a TaskOutput call or tool-like text instead of OK (#526).
Against a local gemma4:e4b the streaming test spent its whole 30 s budget
reasoning about those tools and failed; with them gone it answers OK in
under a second.
Set DisableBackgroundTasks, as goal decomposition already does, and add a
test that checks the request body has no tools.
First part of #5: the transport-agnostic bridge core, the Telegram
adapter, the mandatory chat allowlist, storage, API and settings page.
Task commands, main-agent routing and remote approvals follow in
separate PRs on top of this one.
- chatbridge: Transport interface and Router. The router enforces the
allowlist (an unknown chat gets one refusal naming its chat ID, then
silence, bounded memory), drops updates older than two minutes so a
backlog is never executed, ignores bot senders and commands addressed
to another bot, and dispatches commands (/help, /whoami for now).
- Telegram transport: getUpdates long polling (no inbound port),
plain-text sendMessage truncated to the Bot API limit, getMe for the
identity. It reuses notify's dial guard and redirect policy through
small exported wrappers, and its errors never carry the token.
- Storage: migration 0015 adds chat_bridges, one row per kind. config
is sealed at rest (added to secretColumns) and masked in the API with
the notification-channel convention. The update cursor is committed
before a batch is acted on, only moves forward, and is written only
for the config_version the poller read, so a poll of a replaced token
can never move the new bot's cursor. A token change clears it.
- Server: one loop per transport started by server.New; it re-reads its
row each round and Reload interrupts a poll in flight, so saving the
form applies without a restart. Exponential backoff on errors, honours
Telegram's retry_after, logs under [tgbot] without message text.
- API: GET /api/chat-bridges, PUT /api/chat-bridges/{kind},
POST /api/chat-bridges/{kind}/test. A bridge may run with an empty
allowlist: it then serves no chat and only sends the one-time refusal
naming the chat ID, which is how an operator finds the ID to add.
- Web: System -> Chat bot page with live status, zh-CN and tr strings.
- Docs: docs/chat-bridge.md; README lists the token among stored secrets.
The migration test lists 0015; the pre-0012 test rolls it back with the
others and it re-applies (the migration is idempotent).
Co-authored-by: krad <222954346+dar1k0@users.noreply.github.com>
Follow-up to #488. Replaces the remaining 18 log.Printf calls in these four
packages with structured slog calls, keeping the [tag] prefix that the log
sink uses. Format arguments become key/value attributes.
PR_SET_NO_NEW_PRIVS is per thread. PrepareExecPrivilege set it on a server thread that never execs, so the flag was not inherited by agent processes. The shims set it in enterExecutor, but runBashShim and runDropShim did not lock their goroutine, so it could migrate between prctl and exec.
Move the prctl out of PrepareExecPrivilege. Lock the thread at the top of runBashShim and runDropShim; the lock is never released because exec replaces the process.
Replace the test with a deterministic one: the drop shim runs as root with GOMAXPROCS=1, and a wrapped setNoNewPrivsFn forces the goroutine off its thread. Without the lock the exec'd program reports NoNewPrivs 0; with it, 1.
FactOnlyIntents now returns only terminal intents (done, blocked, exhausted,
stopped), so an open, running or deleted intent is no longer reported as
finished. The summaries go into the planner block inside env.wrap, and the
telemetry docs, the llmrec comment and the db comment match the on-by-default
flag with 0|false|off|no to disable it.