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>
The Test button on System -> LLM always sent the output cap as max_tokens,
because POST /api/llm/test never read the profile's max_tokens_field. OpenAI
reasoning models (o-series, GPT-5) reject max_tokens with
unsupported_parameter, so a profile set to max_completion_tokens failed the
test with HTTP 400 while conversations with the same profile worked.
testLLM now accepts max_tokens_field from the form and falls back to the
stored profile's value when the field is omitted (list-view test). It is
normalized like profile saves: only the openai format with
max_completion_tokens keeps it. The form passes its current selection.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
renderTemplate walked the param map and replaced into the string so far,
so a value containing {other} could be expanded on a later key. Replace
each {name} in the original template only.
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 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.
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>
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.
The slog migration dropped the [traffic], [egress], [enrich] and [evidence]
tags, so the logs view lost the badge and the level was guessed from the
message text. Put the tag back in each message and teach parseLog to read the
slog level word (2026/11/23 13:48:50 WARN [traffic] ...) before the tag.
Adds parseLog tests for the real slog line, the level words and the legacy
no-level shape.
The threshold is written by the settings path and read by the report_finding
worker, so a plain float global is a data race. Store the bits in an
atomic.Uint64, restore the default on 0 or negative, and accept 0 in
applyTriageThreshold so a reset takes effect.
Adds a two-goroutine -race test and the Set(0) reset test.
parseTarget pulls the first URL out of the goal with https?://[^\s'"]+,
which keeps any punctuation that follows it. "Assess http://juiceshop:3000."
matches "http://juiceshop:3000.", url.Parse rejects the port, and the seed
logs "could not parse a target host/IP" even though goalGateCheck accepted
the same goal. A dotted host only survived through the domain fallback,
which takes the scheme from the port, and a sentence-final period stayed
in the host.
Trim trailing punctuation before parsing the URL, including full-width
punctuation from pasted text. A closing bracket is trimmed only when the
URL has no matching opener, so a bracketed IPv6 host like http://[::1]
still parses.
Fixes the three blockers and three shoulds from the review of #470, rebased
onto current main.
Blocker 1 — no way out of a wrong suppression. The suppression note told the
agent to register a distinct defect again, but report_finding had no override:
the retry hit the same check and was suppressed again. report_finding now takes
force_register, which skips the duplicate check for that call and logs the
override. Covered end to end: suppress, then register with the flag.
Blocker 2 — id mismatch. The suppression answer returned duplicate_of_finding_id
(the findings-table id) while update_finding_report addresses the exploration
NODE. The answer now carries duplicate_of_finding_node_id as well, and the note
names the node id to pass. withNodeID resolves it from the candidates the
question offered, so an id the model was never shown maps to nothing.
Blocker 3 — unguarded HTTP client. SystemOneClient.http() returned a bare client,
so a stored triage profile could point the server at an internal host. The client
is now built by the server under the same endpoint guard as the model-list path:
ARTEX_LLM_PRIVATE_ENDPOINTS allow-list, private and metadata addresses refused,
no proxy, redirects not followed. A refused base_url leaves triage off (fail
open, as every other triage failure). TriageHTTPTimeout is exported so the
injected client uses the same budget instead of a second number.
Should 4 — UTF-8 truncation. capText and buildDuplicateState cut by byte index,
splitting a multi-byte rune on CJK or Cyrillic summaries. Both now cut on a rune
boundary.
Should 5 — settings validation. putSettings accepts and stores any
triage_profile_id and any confidence. Both are validated before anything is
written: a negative or unknown profile id and a threshold outside 0..1 are
rejected with 400; 0 still turns the check off.
Should 6 — the threshold is a setting (triage_min_confidence), read on boot and
on change; the description matches the code.
Verification: go build ./... and go vet clean; gofmt clean. go test ./agent/
./db/ ./llmrec/ ./server/ with ARTEX_PG_DSN on a local PostgreSQL — green except
TestManagerSOCKS5UDPOptInAndAssetBlockRuleDropsDatagram (binds 127.0.0.2) and
TestPauseShiftsTaskDeadlineOnResume, which fail the same way on clean main on
macOS. Red/green: with the force_register branch disabled the override test
fails naming the ignored flag; restored, it passes.
Duplicates are the cheapest way to lose reviewer trust, and the only guard today is
a prompt instruction: the worker is told to check list_findings before registering.
It does not hold — in one run against a deliberately vulnerable app three defect
classes were registered twice each (two SQLi, two IDOR, two admin-endpoint
findings), and one of the pairs differed only in wording.
A decision model answers exactly this kind of closed-list question (same defect as
one of these N findings, or not?) with probabilities and no generated text, so the
judgement costs one small request instead of a main-model turn over a six-figure
context. Measured on our own findings before writing any of this (15 candidates,
hand labels): the correct partner 8/8 on a 27B decider and 7/8 on the flash one,
against 7/15 for the constant "always distinct", at 0.66 s and ~1.7k input tokens
per call with zero output tokens. Repeated calls were stable (30/30 identical).
Changes
- agent/triage.go: TriageClient interface, a /v1/systemone HTTP client, and the pure
pieces (state builder, criteria builder, answer parser, threshold) so the logic is
testable without a server.
- report_finding: consults the client before registering. On a duplicate above the
confidence threshold the finding is not registered again; the caller is told which
finding_id it matched and to extend it with update_finding_report.
- Wiring: agent.SetTriageClient on the worker/planner ToolSets, a triage_profile_id
setting (any llm_profiles row whose base_url serves the decision contract; 0 = off),
exposed through the settings API.
Fail-open, by construction
Triage changes an outcome only when it is confident; every other path behaves exactly
as today: no client, no existing findings, empty summary, transport error, non-200,
malformed body, an id the question never offered, or confidence below the threshold
all fall through to normal registration. A wrong suppression loses evidence, a wrong
registration only costs a row — hence the threshold, and hence "advisory".
Verification
- go test ./agent/ passes, including new tests: request shape (model/state/criteria
carry every candidate), distinct answer, unknown id reads as distinct, probability
fallback when confidence is absent, error on 500, no HTTP call without input, state
cap, threshold boundaries.
- red/green on two independent breakages: forcing the threshold false and accepting
an unoffered id both fail the suite; restored, it passes.
- go test ./server/ shows one failure,
TestManagerSOCKS5UDPOptInAndAssetBlockRuleDropsDatagram (bind 127.0.0.2 —
environment), reproduced on clean main in a separate worktree.
- gofmt -l agent/ server/ clean.
Notes
- The profile must serve /v1/systemone. A chat-only decider endpoint (one that refuses
/v1/chat/completions) needs a thin adapter; a decision endpoint works directly.
- Off by default: with no triage_profile_id the platform behaves as before.
The cap on offered findings is a SELECTION, not "the newest N": with a wide graph
the true partner falls out of a newest-first list, so candidates are ranked by
relevance (same class, overlapping endpoint, another task on a shared asset) with
recency only breaking ties. Per-entry summary capping replaces the whole-state
truncation, which used to cut mid-line and leave criteria ids whose state line had
been dropped.
Threshold is a knob, not a constant (live acceptance): on a run with the wider
cross-task pool the model named the right partner in 8 of 9 questions, but its
confidence moved with the question's width — 0.73-0.79 on a small pool, 0.30-0.53
with twenty candidates. Six duplicates were suppressed, and exactly the two that
slipped were the 0.30 and 0.47 ones, both with the correct partner named. A fixed
0.5 cannot fit both ends, so the threshold is a setting (triage_min_confidence,
default 0.5); the low end is affordable because the suppression result tells the
agent to re-register explicitly when the finding is in fact distinct.
Cross-task pool (found by re-measuring the live miss): task_relations only links
spawned tasks, so two tasks created independently against the same target never see
each other's findings and a defect registered in both is invisible to the dedup
question. FindingsSharingAssets joins on the candidate's own asset ids (jsonb
containment, GIN-served) and adds those findings to the question, marked with their
task. On three real cross-task duplicates the wider question names the right partner
in all three (confidence 0.58-0.73, above the threshold), where the own-task pool
could only answer "none".
Regression note (found on a live run, not in CI): FindingID is filled from the findings table, so building the candidate list straight from the nodes dropped every entry and triage never fired ("nodes=6, no usable existing findings"). Covered by TestTriageCandidates_SkipsNodesWithoutFindingRow; findings inherited from a directly related task are kept and marked in the question.
---
Found while running the platform against a live target.
limits: triageDupMinConfidence 0.5 - калибровка 538 пар одной цели (stage3_calibrate.py, 2026-11-22): recall 1.00 при FP 0.47 на 75 жёстких негативах; на истинных дублях в живом прогоне 0.30-0.79
limits: triageMaxExisting 10 - ширина вопроса на реальном дубле (stage3_width.py, 2026-11-22): уверенность 0.81-0.91 до 11 кандидатов, 0.64 на 19, 0.56 на 29; латентность 0.44->1.29 с
limits: triageMaxSummaryChars 400 - p90 длины сводки 334, максимум 564 по 53 находкам графа (2026-11-22)
limits: triageMaxStateChars 6000 - арифметика при потолке 10 записей: 10*(400+60)+480 ~= 5.1 КБ, запас 1.17x
limits: triageHTTPTimeout 20s - наблюдаемая латентность decider 0.26-1.29 с, 3.83-3.96 с на 27B; запас ~5x к худшему
limits: findings pool query limit 50 - самый широкий пул по ассету 31 находка (53 в графе, 2026-11-22), запас 1.6x
limits: ответ decider 1 MiB - наблюдаемый ответ 0.3-2 КБ, запас ~500x
The executor environment kept every name starting with LC_, so a secret supplied under an LC_ name crossed the allowlist even though the comment promised a fixed set of names. The POSIX locale categories are now enumerated and the prefix rule is gone.
Found by jamesKhor in the review of #478.
The timeout trigger used the task id as a watermark, but tasks time out
in deadline order. When a newer task timed out first, the watermark moved
past every older running task, so their later timeouts were never fired.
Keep fired timeouts in a persisted set, the same way met goals are
tracked. On first start the set is seeded with the tasks already timed
out, so nothing replays.
writeTaskArchivePackage opened every entry of the staged workspace that is
not a directory. Opening a FIFO blocks until a writer appears, so a named
pipe left by a command (mkfifo backpipe for an nc relay) stopped the single
archive worker in openat for good, with the task files already moved to
staging and every later archive, restore and delete job queued behind it.
A Unix socket failed the archive instead, and a device file was packed but
refused by extractTaskArchivePackage on restore.
Skip every entry that is neither a directory nor a regular file, as is
already done for symlinks.
Skill usage and missing-skill stats already returned a fixed message. Skill
visibility and its toggle still sent err.Error() to the client. Those two
now log the driver text and return a fixed message. A closed pool test
covers all four handlers.
Reset the stream panel's filter and request state when the exchange changes.
Keep recording-limit warnings visible while reporting only actual messages
in the header, including first-page and warning-only counts.
Add message_total to the stream page without changing raw pagination totals
or existing Go paging signatures. Cover the count and pagination boundaries
in the stream and HTTP route tests.
The self-test probe tried only the first host of the DSN. It now tries
each host and port the DSN lists, fallbacks included, and nothing else,
and a DSN it cannot parse fails the self-test instead of skipping the
database check.
docker-compose.yml sets POSTGRES_HOST_AUTH_METHOD=scram-sha-256: a TCP
connection from another container, artex's included, needs the
password. It takes effect when a new pgdata volume is initialised.