Commit Graph
244 Commits
Author SHA1 Message Date
Coff0xc 5f29af7d35 merge origin/main into fix/llm-test-log-line 2026-11-22 18:42:00 +00:00
BaaRai ead1a126ae Merge pull request #457 from NikolayGusev-astra/feat/skill-index-in-prompt
agent: list available skills in the system prompt
2026-11-22 10:46:26 +01:00
BaaRai 7b8be967cc Merge pull request #469 from cyberd4ch/fix/factprovenance-doc-comment
agent: attach the factProvenance doc comment to its function
2026-11-22 07:55:23 +01:00
dach-a 1e7696c572 agent: move the factProvenance doc comment off the closing brace
The comment sat on the closing brace of factEvidenceLines, so Go attached it
to no declaration and godoc showed it nowhere. Noted in the review of #441.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-22 01:02:23 +00:00
Coff0xc a61932c4da fix(agent): keep LLM connection-test logs on one line
The logged response body was inserted raw. A newline in that body became
another log record. CR and LF are now spaces before the line is written.
2026-11-21 19:54:18 +00:00
Николай Гусев 6ef6d0dbdb agent: list available skills in the system prompt
The Skill tool's description carries the skill listing, but a description is
only read once the model decides to open the tool: on a live run with 36 skills
assigned the agent invoked Skill zero times across 485 trace records, hunting
every class with raw Bash. Put the names where every turn already looks, with
the rule to invoke the matching skill before hunting a class.

Names-only, bounded at 1200 bytes, empty for skill-less agents (prompt stays
byte-identical). The index rides the same seam as FindingGuidance, so the
cached-prefix path keeps its two segments byte-identical to the unsplit prompt.
2026-11-21 22:00:22 +03:00
Николай Гусев 25217afdce refactor(agent): remove unused finding traffic guidance 2026-11-21 21:30:58 +03:00
Nikolay Gusev 55e2a4d037 agent: state on the tools that traffic binding is off when the switch is off
With agent_traffic_binding disabled (the default) findingWorkflowTools strips
bind_finding_traffic from every agent toolset and removes traffic_refs /
evidence_hint_id from the report_finding and hint schemas, but the tool
descriptions keep promising the binding path: prove_goal says a finding closes
a goal once a traffic_ref is bound, and the report_finding error path says
already-registered findings can be bound later via bind_finding_traffic. An
agent then chases a tool that is not in its toolset.

Observed on a live run (v0.7.0, local OpenAI-compatible model): a worker spent
minutes on it — "the tool bind_finding_traffic must be invoked as a tool", a
bare Bash true, then grepping the transcripts and the strings of the binary.
The task registered findings with poe_level 3, zero bound traffic, and closed
no goal; a run with the switch on bound traffic and closed 4 of 6 goals.

Fix: attach binding-off notes to the same tools the capture-off notes ride on
(report_finding, add_hint / add_task_hint, prove_goal) in the disabled branch,
so the standing guidance stays empty — the contract the PG test asserts — while
the agent is told the tool and the parameters are absent, that findings stay
unverified, and that an operator can enable binding or bind manually.

Test: agent/finding_workflow_test.go asserts the notes exist on the tools and
name the absent tool; red on the planted break, green with the fix. Verified
against the PostgreSQL-dependent server test that CI runs
(TestFindingWorkflowAutoHintToPlannerAndSetting) and go test ./agent/ ./server/.
2026-11-21 20:58:25 +03:00
BaaRai c65034c50f Merge pull request #448 from BaaRai/feat/traffic-capture-off-notice
feat(agent,web): surface traffic-capture-off notice in agent tool descriptions, setup, settings, and dashboard
2026-11-21 18:10:40 +01:00
BaaRai 1adfc21346 perf(agent): read traffic capture setting once per findingWorkflowTools pass 2026-11-21 17:01:15 +01:00
BaaRai c3a055135d fix(db,agent): keep goal met when another valid proof remains and share invalidating status list (#269) 2026-11-21 17:01:10 +01:00
BaaRai b56ad38b43 feat(agent,web): explain that traffic capture is off and required for provable findings 2026-11-21 16:35:31 +01:00
BaaRai bfaec521ac test(agent,db): document and lock risk_accepted goal-proof semantics (#269) 2026-11-21 16:29:53 +01:00
BaaRai 2411943de6 Merge pull request #441 from cyberd4ch/row1-provenance
record_fact: tie evidence to recorded activity and proxy captures
2026-11-21 16:04:01 +01:00
lab 9f2c290e9f fix(finding): accept evidence_hint_id 0 and degrade to explicit traffic_refs
report_finding rejected whole findings over the optional evidence_hint_id
field in two ways seen in a live DVWA run:

- the key was present but 0, an error, although the field is optional and
  models emit 0 for "absent" (21 rejections in one task);
- a fact node id was passed instead of a hint id, an error even when the
  caller supplied complete traffic_refs.

Both sink an otherwise provable finding. Now 0 means no hint, and a hint id
that does not resolve to a local hint node degrades to the explicit
traffic_refs. Only a call with no usable hint and no usable refs fails.

Verified end to end: after the fix a worker registered the DVWA UNION SQLi
finding, bound the captured proof exchange itself and quoted the response
body verbatim; the server accepted verification_status=verified (POE L3).
Tests fail on the unfixed tree with the exact production errors.
2026-11-21 14:29:23 +01:00
dach-a 42ce6ea5c8 db: pick the newest activity across all evidence lines
ActivityContainingEvidence queried one line at a time and returned on the
first match, so an older activity matching line 0 beat a newer one matching
line 1. A single query over unnest() orders by id and keeps the global newest,
and a regression test covers the reversed-order case.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 10:20:45 +00:00
dach-a c92c784987 Tie fact evidence to recorded activity and proxy captures
record_fact trusted a model-written source, so target text labelled
tool_output could prove a goal. The server now matches the fact's evidence
against the intent's recorded activity and pins the activity id. If the same
bytes were captured coming back from the target through the proxy, the fact is
stored as target_response with the traffic id, whatever the model declared,
and prove_goal refuses it (#124 row 1). An untied claim downgrades to
inference/inferred and is refused instead of silently trusted.
2026-11-21 09:50:45 +00:00
Coff0xc 30fce2621f fix(rsi): honor triage status in goals and lesson scope
The planner overview now carries finding status, and prove_goal refuses
false_positive, duplicate, and ignored findings. A lesson with no company
is visible only to tasks that also have no company. Retraction withdraws
evidence, runs on disposition change, and still runs after a task gains
a second company.
2026-11-21 08:50:26 +01:00
BaaRai 01e00ca5e2 style(agent): gofmt the adversarial bench capture-case cleanup
gofmt keeps a one-line function literal only while its body stays short; the asset cleanup in TestAdversarialBenchTrafficRefMissingFromCaptureRefusedPG exceeded that, so gofmt -l flagged the committed file. No behavior change.
2026-11-21 08:14:56 +01:00
BaaRai c0e3a3189f security(db): mark an agent scope addition as expanded when classification fails
AddAgentScope only took isScopeExpansion's answer when it returned no
error; on an error (for example the declared-scope read failing) Expanded
stayed false and the row was recorded as if it were inside the declared
scope, a silent widening.

Choice: mark expanded=true (fail closed) rather than return the error.
By design an agent may widen the task scope without approval as long as
the row is flagged expanded with its source and reason; the flag is the
control, so its fail-closed value is true. The callers do not treat a
classification failure specially: the add_task_scope tool only reports
per-entry errors from AddAgentScope, and returning one here would turn a
failed read of an audit classification into a refusal of a write the
design permits, with the outcome depending on whether the read or the
insert hit the fault. Manual (UI) additions are unchanged; they are not
classified.

Test: adversarial bench case TestAdversarialBenchScopeExpansionErrorMarkedPG
breaks the declared-scope read in a dedicated database (companies renamed,
so ListTaskScope fails while the task_scope insert succeeds); on 5ba19cd the
row is stored with expanded=false, here with expanded=true. The database is
dropped by the test.
2026-11-21 08:10:52 +01:00
BaaRai 49ab244f44 security(agent): wire the capture check into prove_goal and fail closed without it
prove_goal's finding proof was meant to confirm that each bound traffic_ref
still exists in the live capture, but SetTrafficProofChecker was only called
from tests: Planner.Plan built its ToolSet without it, exchangeExists was
nil, and VerifyFindingProofForNode skipped the check silently.

Decision: wire it (option a). The capture store is reachable when Plan()
runs: server/task_llm.go (agentsForTask) already gives the planner
SetFindingRecorder(s.evidenceStore()), and that evidence store is built on
s.m.traffic, the live capture. So:
- traffic.Traffic.ExchangeExists looks the id up in the capture index
  (nil store or lookup failure is an error).
- evidence.Store.TrafficExists delegates to it.
- agent.TrafficCaptureChecker is the interface; Plan() wires the recorder's
  TrafficExists into the ToolSet when the recorder implements it, so the
  production planner gets the check with no extra server wiring.
- VerifyFindingProofForNode treats a nil checker as unavailable and returns
  an error, so prove_goal answers "refused (fail-closed)" instead of
  accepting the proof; a lookup error does the same.

The capture store is global, not partitioned per task: the check proves the
exchange is in this server's capture, and the host match against the
finding's assets ties it to the target.

Tests: adversarial bench case TestAdversarialBenchTrafficRefMissingFromCaptureRefusedPG
builds the planner like agentsForTask (NewPlanner + SetFindingRecorder(evidence
store)), with nothing injected into the ToolSet, and checks that a traffic_ref
absent from the capture is refused, that a capture-less evidence store and a
planner without a recorder refuse (fail-closed), and that a captured matching
ref still closes the goal. The three refusal subtests fail on 5ba19cd. Existing
ToolSet-level tests now set an explicit checker, and the existing bench round 2
binds an exchange that is in the capture and runs with the production recorder.
2026-11-21 08:10:52 +01:00
BaaRai 34619b1a5c security(db): never prove a finding that has no linked asset
VerifyFindingProofForNode matched bound traffic against the finding's
assets, but when the finding had no asset_ids (or its assets resolved to
no host) hostMatchesFinding returned snapHost != "", so any bound
traffic, e.g. https://unrelated.example.test/, proved the finding and
prove_goal closed the goal.

Fail closed: such a finding returns Proven=false with an explicit reason
("finding has no linked asset ..." / "finding's linked assets have no
host ..."). The finding stays recorded and visible; non-HTTP goals still
close through an observed tool_output fact.

Tests: adversarial bench case TestAdversarialBenchFindingWithoutAssetNotProvenPG
(fails on 5ba19cd with Proven=true, passes here). The two existing tests that
relied on an asset-less proven finding now link a matching HTTP service asset.
2026-11-21 08:10:52 +01:00
BaaRai 57b95a3d9d test(agent): add deterministic adversarial CI benchmark for #124 agentic attack classes 2026-11-21 08:10:52 +01:00
BaaRai bba14c03e5 security(agent,db): enforce server-side finding traffic proof in prove_goal and mark scope expansions 2026-11-21 08:10:52 +01:00
BaaRai 687b743b88 security(agent): frame worker assets, stagnation, agent credentials, todos and refuse symlinks in openScanOutput 2026-11-21 08:10:52 +01:00
BaaRai 752d0cfab4 test: clean remaining residual rows across db, agent, and server test suites 2026-11-20 22:54:57 +01:00
BaaRai 79119ae9bd test: clean up residual findings, retest conversations, parent assets, and test rows 2026-11-20 22:18:53 +01:00
BaaRai 0d85fc9b06 Merge pull request #427 from BaaRai/feat/worker-cache-prefix
feat(agent): opt-in worker cache-prefix split (P3.5 phase C)
2026-11-20 20:57:10 +01:00
BaaRai 0dbb6de8d5 feat(agent): opt-in worker system cache-prefix split (P3.5 phase C) 2026-11-20 20:29:17 +01:00
BaaRai 5e1c55db4d fix(server): recognise the released record_fact descriptions as known defaults
The releases v0.4.0 to v0.6.0 seed a record_fact description without the source bullet and their own facts property description. Neither was in the list of known defaults, so the one-time refresh kept both texts on a database seeded by a release and logged the description as an operator edit.

Both released texts are now known defaults, taken byte for byte from agent/tools.go at those tags, and the log line says the description does not match a known default.
2026-11-20 18:48:06 +01:00
BaaRai c5cb1afad7 fix(agent): keep the record_fact harness opt-out through tool wrappers
record_fact opts out of the harness schema check (norma Spec.RawInput) and
validates its own input. The harness finds the opt-out with a type
assertion on the tool it is handed, and that tool is a wrapper: catalog
tools are metered (meteredTool), and guardPanic wraps every tool last
(guardedTool). Both embed CoreTool, which hides AcceptsRawInput, so the
opt-out was lost and a malformed call was answered by the SDK ("invalid
tool input: facts: expected array") instead of by the handler.

guardedTool and meteredTool now forward AcceptsRawInput, as overriddenTool
already does.

Test: TestFix410AcceptsRawInputSurvivesWrappers covers each wrapper and
record_fact through wireTools, AugmentTools and harness.Query.
2026-11-20 18:11:16 +01:00
tglemserandClaude Mythos 5.1 6e906b4920 fix(agent): publish record_fact as a facts-only contract
The schema the model sees for record_fact declared every fact field twice:
at the top level (single-fact shape) and inside facts[] (batch shape), with
the handler deciding which shape a call is. A model that fills every
declared property sends the single fact inside facts[] and a copy, or a
placeholder such as "", [] or "x", of each field beside it; since PR #282
every such call is refused by name, and the refusal text ("summary is not
allowed at the top level") leads the model to send a dummy value next, so
the same refusal repeats until the intent ends. Observed with a model over
the OpenAI Responses API: 209 of 212 record_fact calls of two tasks were
refused, 156 of them identical in one intent.

The published schema is now {facts:[{...}]} and nothing else (required:
facts, additionalProperties false). The handler keeps the strict contract
of PR #282: unknown or mis-cased fields, invalid or foreign asset ids,
missing summaries, empty batches and any top-level field beside facts
(other than the legacy intent_id) are refused before anything is written,
with an error that names the fields and the one accepted shape. It still
accepts the legacy single fact and the legacy batch with a top-level
intent_id. An item without intent_id is linked to the intent the worker is
running (SetOwnerNode), as report_finding already does.

record_fact opts out of the harness schema check (norma Spec.RawInput) so
the stricter published schema does not reject the legacy shapes before the
handler sees them; the catalog decorator forwards the opt-out.
RepairRecordFactSchema republishes stored and cached schemas as facts-only
and keeps the annotations of facts and its items. A one-time startup
refresh replaces the stored description and the texts that referred to the
top level when they equal the previous defaults; operator edits stay and
are logged. seedFactSourceSchema adds the source enum on the items.

Tests: the handler contract (TestRecordFactSummaryContract,
TestRecordFactStrictFields, TestRecordFactBatchTopLevelConflicts,
TestRecordFactRefusesTopLevelCopiesBesideFacts), the published schema and
its repair (TestRecordFactSchemaIsFactsOnly, TestRecordFactStoredContractRepair,
TestRecordFactInputSchemaUpgrade, TestRecordFactSourceSchemaUpgrade,
TestWireTools), the running-intent default, the one-time refresh
(TestRefreshRecordFactContract) and a synthetic replay of the call shapes
(TestRecordFactShapesReplay).

Co-Authored-By: Claude Mythos 5.1 <noreply@anthropic.com>
2026-11-20 10:03:52 +00:00
BaaRai 73d35835c5 test(agent,server): run the tests in a temp directory of their own
Norma keeps background-task output in os.TempDir()/norma. A test that starts
a Norma session without a private TMPDIR wrote into the host's /tmp/norma.

TestMain of the agent and server packages now creates a directory with
os.MkdirTemp("", "artex-test-tmp-"), sets TMPDIR to it before m.Run and
removes it afterwards on every exit path. The directory is world-writable
and sticky like /tmp: MkdirTemp creates it 0700, which the executor of the
root tests could not traverse. In the server package the setup comes after
RunExecShimIfRequested, which stays the first call; the database suffix,
the test key and the advisory lock run in the same order as before. A test
that sets TMPDIR itself keeps its own.
2026-11-20 06:38:10 +01:00
BaaRai 7520c6e588 security(agent): command-output spills go to a root-owned per-task dir
Norma's tool.Capture writes an oversized tool output to a file in
ToolOutputDir, from the server process. ARTEX passed <run dir>/cmd-output:
the executor can write in the run directory and could turn cmd-output into
a symlink, so root wrote the spill where the link pointed.

- With the privilege drop on, ToolOutputDir is <data>/spill/tasks/<id> for
  the worker, the main agent and the planner of a task, and
  <data>/spill/sessions/<id> for a chat. The server creates it when the
  run starts (agent.SetSpillDirMaker, same style as SetRunDirMaker):
  root:<exec gid> 0750 below root:root 0755 parents, each level through a
  descriptor opened with O_NOFOLLOW. A directory that cannot be created
  leaves the run without a spill directory (output is truncated), never
  with the run directory. Without the drop the path stays
  <run dir>/cmd-output.
- Norma v0.4.11 writes the spill file 0600 (directory 0700), so the
  executor could not read it. The runs wrap their hooks (agent.SpillHooks):
  after a tool call whose result carries the spill marker, the server makes
  the files of the directory root:<exec gid> 0640. The agent reads a spill
  with Bash; the file tools do not reach outside the run directory.
- The spill directory follows the task: stageTaskFiles moves it to the
  delete staging with tasks/<id>, stageTaskArchiveFiles packs it as
  files/spill/tasks/<id>, and installTaskArchiveFiles restores it and puts
  its ownership back. Deleting a conversation removes
  spill/sessions/conv-<id>.

Tests: TestToolOutputDir (agent); TestDeleteTaskFilesRemovesSpillDir,
TestRemoveConversationSpill and the archive round trip (server); root-only
TestSpillDirAsRoot, and the spill directory in
TestTaskArchiveRestoreRunDirOwnershipAsRoot. SECURITY.md drops the spill
from the residual list.
2026-11-20 05:35:55 +01:00
BaaRai e73cdeda93 security(agent): share only run-dir leaves; main agent gets its own leaf
The task and chat workspace trees were shared whole with the executor
group, and the main agent and the planner worked in tasks/<id>, the parent
of every worker directory: the executor could rename, remove or replace a
run directory, its own included, and plant entries beside them.

- Layout: no agent working directory is an ancestor of another. The main
  agent and the planner work in tasks/<id>/main, a worker in
  tasks/<id>/i<N>, a chat in sessions/<id>. With the privilege drop on,
  tasks/, sessions/ and tasks/<id> are root:root 0755 and only the leaves
  are root:<exec gid> 2775.
- PrepareExecPrivilege no longer shares tasks/ and sessions/. It sets the
  parents, shares the leaves found on disk with what they hold, and
  registers the run-directory maker (agent.SetRunDirMaker). ensureRunDir
  and the chat session directory go through it: each level is created
  with Mkdir and set through a descriptor opened with O_NOFOLLOW, parents
  before the leaf, so a link planted where a run directory goes is
  refused. Without the drop both stay a plain MkdirAll.
- Uploads for the main agent land in tasks/<id>/main/uploads, and the
  attachment paths given to it use the same directory; session uploads
  create sessions/<id> by the same rule.
- Task archives still pack and delete the whole task directory, so the
  package holds files/tasks/<id>/main and i<N>. The package keeps neither
  owners nor directory modes: the restore puts the layout back
  (installTaskArchiveFiles takes the privilege).
- Existing data is not migrated. Files a task wrote directly in
  tasks/<id>/ stay there with their owner and mode; the main agent starts
  in an empty tasks/<id>/main and its file tools no longer reach them.

Tests: TestRunDirLayout and TestIsRunDirName (agent); root-only
TestRunDirLayoutAsRoot, TestRunDirSiblingsProtectedAsRoot,
TestRunDirLayoutOnExistingTreeAsRoot and
TestTaskArchiveRestoreRunDirOwnershipAsRoot (server). The archive tests
use the main/ and i<N> leaves. SECURITY.md states the invariant, names the
race that remains and drops ensureRunDir from the residual list.
2026-11-20 05:35:55 +01:00
BaaRai c1c1fe9141 security(agent): confine ingest_bbot; write tool scripts outside the run dir
Two root file operations took a path the agent controls.

- ingest_bbot opened the path it was given with os.Open in the server
  process, which is root in the image: any root-readable file could be
  named, and the result counts told its line structure. The tool now opens
  the file through the file tools' confinement (openWorkRoot on the run's
  working directory under the data directory, then os.Root): an absolute
  path elsewhere, "..", a symlink, a hard-linked file and a run directory
  reached by a symlink are refused. It fails closed without a data
  directory or a working directory. The worker passes its data directory
  to the ToolSet (SetWorkBase); the tool reads the ToolContext for the
  working directory, like ingest_scan_output.
- execPython wrote the script of a custom tool as root to
  <run dir>/.tools and then chowned it. The executor can write the run
  directory, so it could turn .tools into a symlink and have root create
  and chown a file elsewhere. With the privilege drop on, the script now
  goes to <data>/exec-scripts, created by PrepareExecPrivilege as
  root:<exec gid> 0750, outside tasks/ and sessions/: the executor reads
  the 0640 script and cannot create, rename or replace an entry. An
  enabled drop without that directory is an error, not a fallback to the
  run directory. Without the drop nothing changes. PrepareExecPrivilege
  takes the privilege by pointer to record ExecPrivilege.ScriptDir.

Tests: TestOpenBbotOutputConfined and TestIngestBbotToolConfined (no
Postgres), TestExecPythonNeedsScriptDirWhenDropping, and the root-only
TestExecPythonScriptDirAsRoot (.tools planted as a symlink to a root-only
directory). TestIngestBbotScopeSplit now places its file in a run
directory. SECURITY.md: the two paths leave the residual list; the
command-output spill stays.
2026-11-20 05:35:54 +01:00
BaaRai ebcfe532e0 security(agent): refuse run dirs reached by symlink; scrub S3 archive keys
- openWorkRoot: refuse the run directory when its resolved path differs from
  the path under the data directory, so a relative symlink that stays inside
  the data directory (run -> traffic/_ca) no longer reaches root-only files.
- Test: TestConfinedFileToolsRunDirRelativeSymlinkInside targets <base>/traffic/_ca.
- secretEnv: add ARTEX_ARCHIVE_S3_ACCESS_KEY_ID, ARTEX_ARCHIVE_S3_SECRET_ACCESS_KEY,
  ARTEX_ARCHIVE_S3_SESSION_TOKEN; the sealed-env test covers them.
- SECURITY.md: document the run-dir race and the residual root writes through
  agent-influenced paths (cmd-output spill, .tools, bbot ingest).
2026-11-20 05:35:54 +01:00
BaaRai eb5d3d73c1 security(agent): confine the file tools and close the executor review
The SDK file tools Read, Write, Edit, MultiEdit, LS, Glob and Grep run in
the server process, which is root in the image, and took any absolute or
relative path: Read returned /app/keys/jwt.key or the config file, and
Write could plant a skill or rewrite the config past the approval gate.

- agent/filetools.go: defaultTools replaces the seven tools for every
  agent kind (chat, main agent, planner, worker). Same names, prompts and
  schemas; every path goes through an os.Root on the run's working
  directory, opened component by component below the data directory, so
  absolute paths elsewhere, "..", symlinks leading out, a run directory
  swapped for a symlink and files with extra hard links are refused. Grep
  no longer starts ripgrep. The LLM connection test passes an empty tool
  list instead of nil (nil meant the unconfined defaults).
- traffic: chmod the go-mitmproxy CA private key to 0600 after the proxy
  creates or loads it; the CA certificate stays readable.
- server: the executor gets HOME and XDG_CACHE_HOME in <data>/exec-home,
  owned by it, on the bash shim, the MCP drop shim and the custom-tool
  credential path.
- server: ARTEX_LLM_PROXY and ARTEX_LLM_BASE_URL can carry user:pass@;
  they are scrubbed and sealed with the other startup secrets.
- docker: no-new-privileges for the artex service, setuid/setgid bits
  stripped in the image, PLAYWRIGHT_BROWSERS_PATH kept at root's cache.
- db: the persistence approval seed inserts each rule only when no rule
  of that name exists, so a re-run does not duplicate rules.
- Root-gated tests run the bash shim, a custom tool and an MCP stdio
  command as the executor and check the uid, a 0600 root file, the
  server's /proc environ and a cache write.
2026-11-20 05:35:54 +01:00
BaaRai 04a7ab3c39 security(server): keep server secrets from agent processes
GHSA-prm8-vw2v-wjwh: the agent command executor ran as root in the server's
container and PID namespace, so it could read /app/keys and recover the
server secrets from /proc/<pid>/environ.

Deliverable 1, executor identity. Agent processes (Bash, the interactive
shell, custom tools, stdio MCP servers) run as the uid/gid set by
-exec-uid and -exec-gid (default 10001). Custom tools use
SysProcAttr.Credential. Norma starts Bash and the shell itself, so a PATH
shim (the server binary named bash) drops the identity before exec; MCP
stdio commands run through the same binary in drop mode. The task and chat
workspace trees are shared with the executor group (setgid, group rw,
umask 002). The key files and the config file become root-only, and
/app/keys is 0700 in the image. An explicit -exec-uid that cannot be applied
stops the start; the default logs once that same-uid isolation is
unavailable when the server is not root.

Deliverable 2, sealed environment. On Linux, SealProcessEnv re-executes the
server once with the secret variables removed from its environment block,
passing the values through an inherited pipe. The new image restores them
into the Go environment, so readers see the same configuration. Off Linux it
logs that the environment is not sealed.

Deliverable 3, approval gate. Custom tools, MCP servers and skill files
(create_/update_ of custom tool and MCP, create_skill, update_skill_file)
meet built-in ask rules seeded once (intercept_persistence_rules_v1). A user
allow rule cannot skip them; a user deny still wins. The rules are data the
agent cannot edit.

Tests: resolution and refusal of root identities, drop command wrapping,
sealed-environment encoding, and an end-to-end handoff test on Linux that
checks the kernel environment block and a child process hold no secret
names and that the values survive (empty and multi-line included). Approval
matching is tested in intercept.
2026-11-20 05:35:53 +01:00
Alexandrelab-200 db0aae3657 Refactor PostgreSQL test skipping logic
- Introduced uniform skipping functions in the db package: SkipPGUnavailable and SkipNoPG.
- Updated all relevant test files to utilize these new functions for better consistency and readability.
- Added new db/testpg.go file to house the skipping logic.
- Created architecture and operations documentation to provide a comprehensive overview of the ARTEX system.
- Added a verification script to streamline local testing and ensure code quality.
2026-11-19 14:23:29 -03:00
Coff0xc 2a9743eb9e fix(agent): reject unsafe ChatAgent session ids
Chat joined sessionID into <workDir>/sessions with no allow-list, so
".." or a separator would escape that directory. Production callers
use conv-<id>, but the exported method accepted any string.

Accept only [A-Za-z0-9_-] up to 64 bytes, then confirm the cleaned
path still sits under sessions/.
2026-11-18 22:40:21 +01:00
Coff0xc 20b278cf98 fix(agent): refuse insert_assets when intercept rules cannot be loaded
insert_assets swallowed ListAssetInterceptRules and
TaskInterceptRulesSplit errors and evaluated an empty rule set, which
allowed every asset. A load failure now refuses the whole call. The
tool result is generic; the driver error stays in the process log.
2026-11-18 17:22:36 +01:00
Mike ReadandClaude Opus 5.5 03e216d032 fix: report provider refusals, do not rerun them as idle turns
A turn the provider's safety system declines (Anthropic stop_reason
"refusal", OpenAI-compatible finish_reason "content_filter") has no text
and no tool calls. Norma passes the stop reason through and the harness
ends any tool-less turn with ReasonCompleted, so the run summary said the
model "ended this turn normally", and steerHooks.Stop took the empty turn
for an idle one and resent the conversation up to the empty-response retry
count.

The LLM recorder is the one layer that sees the stop reason. It now hands
each completed call's stop reason to an optional context sink
(llmrec.WithStopSink). captureRunSession installs a per-run tracker
(agent.WithStopTracker) on that sink. With it:

- steerHooks.Stop does not inject the idle-turn rerun after a refusal;
- terminalText reports "provider refusal (stop_reason ...)" and says the
  intent was not completed, instead of the completed wording.

Other terminal states and ordinary empty turns are unchanged.

Fixes #327

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 00:41:18 -06:00
Chubboy Ren c833130c28 fix: enforce exact record_fact fields and validate asset anchors 2026-11-18 01:51:41 +00:00
Chubboy Ren c0c568b31f Merge remote-tracking branch 'upstream/main' into codex/fix-record-fact-input-contract 2026-11-18 01:34:26 +00:00
BaaRai 9777163bbf fix(agent): frame intent summaries as data
The wake lines interpolated a planner-written intent summary into the trusted sentence, and the overview kept every summary in the plain JSON, so an inherited summary crossed tasks as if this planner had written it (#124, F3). Frame the summary on the wake lines and move the open/running/recent-done summaries into one framed block; the structured intent fields stay plain.
2026-11-17 23:44:36 +01:00
BaaRai 9bc5856565 Merge pull request #302 from Protonmatter/protonmatter/budget-restore
Restore task spend from the lanes the live ledger counts
2026-11-17 22:52:23 +01:00
BaaRai d646f6999b fix(test): check each coverage tool on the set that carries it
list_untested_assets is a planner tool, not a worker tool; the fail-open assertion can only be made against PlannerTools.
2026-11-17 22:18:54 +01:00
protonmatter 133dc68668 Test that a failed coverage read stays enabled, including auto-scope writes.
A missing task and a query error both leave the flag on. The worker keeps the coverage tools and still records auto scope when the stored flag is off.
2026-11-17 15:52:04 -05:00
protonmatter 40de6ba898 Say what a restored task budget still allows, and test the lanes that count.
A task already inside the wrap-up reserve only has that reserve left. The worker estimate starts from the defaults because usage rows have no run boundary.
2026-11-17 15:50:00 -05:00