Skip to content

fix(agent): refuse insert_assets when intercept rules cannot be loaded - #336

Merged
BaaRai merged 2 commits into
BaaRai:mainfrom
Coff0xc:fix/insert-assets-fail-closed
Nov 18, 2026
Merged

BaaRai merged 2 commits into
BaaRai:mainfrom
Coff0xc:fix/insert-assets-fail-closed

Conversation

@Coff0xc

@Coff0xc Coff0xc commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

insert_assets discarded errors from ListAssetInterceptRules and TaskInterceptRulesSplit. A failed read left both rule sets empty, and EvaluateAssetGate then allowed every asset. CheckAssetsIntercept already fails closed on the same loaders.

The call is now refused when either load fails. The tool result is a generic message; the driver error is written to the process log.

Tested: go test ./agent -run TestInsertAssetsRuleLoadFailure pass. TestInsertAssetsRefusesWhenInterceptRulesUnavailable skips without ARTEX_PG_DSN (closes the store, then asserts the same refusal).

Copilot AI balanced review requested due to automatic review settings November 18, 2026 11:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@BaaRai BaaRai left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fail closed is right: an empty rule set from a failed read allowed every asset. The tool result stays generic and the driver error goes to the log, so the model never sees database internals. The closed-DB test exercises the real path. Thanks.

offset+length > size wraps when length is near MaxInt64, so the cap is
skipped and make([]byte, length) can exhaust memory. Compare length
against size-offset instead.
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.
@BaaRai
BaaRai force-pushed the fix/insert-assets-fail-closed branch from bf182ce to 20b278c Compare November 18, 2026 16:22
@BaaRai
BaaRai merged commit b4b4ade into BaaRai:main Nov 18, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants