# Making Automated Capture Safer

May 18, 2026. VALESKA narrows automated capture, redacts obvious secrets, and keeps runtime preparation from blocking other work.

Language: en
Canonical: https://avanticomplex.com/en/blog/making-automated-capture-safer/

Published: 2026-05-18T12:00:00.000Z

May 18, 2026. Automated capture is useful only when it preserves evidence without turning every tool interaction into retained material. Today’s change narrows that responsibility. The capture hook retains the exclusion of failed tool calls, uses the FastAPI memory endpoint directly, and redacts several obvious forms of secret-bearing content before capture. At the same time, the classifier’s runtime preparation moves off FastAPI’s event loop. These changes share an operating question: can the system record useful work without making capture itself a source of misleading records, exposed values, or stalled requests?

## The working question

What should an automatic memory path retain when it encounters error output, configuration files, credentials, and slow local runtime work? The answer cannot be “everything.” Failed calls often describe an attempt rather than a completed action; retaining them as ordinary memory can create a false history of success. Configuration paths can point to material that should never be copied into a record. A blocking subprocess can delay unrelated API work while it checks whether a local model is ready. Each condition needs a specific control, because convenience is not a sufficient reason to retain or block.

## Capture now has narrower rules

The hook’s HTTP path now sends its capture payload through the documented FastAPI memory endpoint using a lightweight standard-library request. This removes a dead client import from that path and leaves the direct service import as a fallback when the API is unavailable. The capture content is prepared before it is persisted. Patterns cover environment-style secret assignments, bearer authorization values, AWS access-key forms, GitHub personal-access-token forms, and OpenAI-style key forms. When a path itself signals sensitive material, including common environment, password, key, or credential files, the hook records only the action and path while suppressing the content or response preview.

These are controls for recognizable cases, not a claim of universal secret detection. A value outside the listed patterns can still require careful handling, and a filename rule is only as strong as the path information supplied to the hook. The important evidence is that redaction occurs before the capture request, so the ordinary persistence path is not asked to clean up a value after it has already received it. The hook also retains a reusable fallback service instance rather than repeatedly constructing and closing the expensive direct-import path.

## Classification should not stall the API

Runtime preparation can take far longer than an ordinary request: it may need to ask the shared manager to select a model, claim graphics processing unit (GPU) memory, and start a local runtime. The classifier still needs that preparation, but it should not freeze FastAPI’s asynchronous event loop while the blocking work happens. The preflight introduced in [Preparing the Classification Runtime](/en/blog/preparing-the-classification-runtime/) is therefore moved into a worker thread with `asyncio.to_thread`. Other in-flight requests can continue while the classifier waits for its readiness result. This change does not make an unavailable model available; it protects the service’s responsiveness while the existing preflight reports the actual state.

## What was checked and what comes next

The May 18 change records an end-to-end check of the hook path from standard input through HTTP capture to the database, with the configured redactions applied, along with a Docker rebuild and eight task tests. That is evidence for the paths exercised, not a guarantee that every caller, secret form, or runtime condition has been covered. The next test should use representative safe fixtures to confirm that failed calls remain excluded, that each redaction class reaches persistence only as a marker, and that a slow or unavailable runtime leaves unrelated API requests responsive. The next review should also look for new secret formats and capture sources, because the rules need to follow the work they actually receive.

**Historical basis:** May 18, 2026 commit `895579c`.


## Translations
- en: https://avanticomplex.com/en/blog/making-automated-capture-safer/
- es: https://avanticomplex.com/es/blog/making-automated-capture-safer-es/
- pt: https://avanticomplex.com/pt/blog/making-automated-capture-safer-pt/
