Issue #85: typed object tools replace read_database_table (budget-gated writes) #94

Merged
gotoi-agent merged 12 commits from issue/85-typed-object-tools into agent-develop 2026-10-08 14:35:39 +02:00
Collaborator
No description provided.
The single untyped read_database_table table browser is replaced by
per-object tools that project explicit fields, page with an opaque
cursor, and enumerate valid fields/statuses on a bad request:
plan_read, rule_read, incident_read, executions_for_plan, execution_read.
read_machine_context is renamed machine_read.

Writes gain plan_update, plan_delete, plan_test, rule_update and
rule_delete: all blocked in plan mode, operator-request gated, and
authorized per row via inScope. plan_test reports the dry run
(compatibility + kill switch + concrete commit) without calling
decide(), so it never enqueues and never leaks a lease.

middleware/src/ai-table-reader.ts is deleted; hub publishes remove
events for plan/rule deletes through the new optional hubRemove dep.

Refs #85
(Refs #85)
Rewrites the use case around per-object reads and writes, updates the
tool lists in UC-MW-151/UC-MW-169, the catalog index, and the two
plan documents that named read_database_table / read_machine_context.

Refs #85
(Refs #85)
(Refs #85)
The ControlScope interface hunk in 2afb694 replaced the denial member with
canWrite, but four call sites still use scope.denial (runOne, run_on_machines,
dispatch) and resolveControlScope still returns it — tsc reported TS2339/TS2353
on control-agent.ts. Refs #85
UC-MW-136 claimed every listed write runs blockInPlanMode +
requireOperatorRequest; plan_test runs neither (it is filtered from the
plan-mode tool list and has no operator-request gate), so the story and main
flow now separate it from the mutating writes. The permissions-audit plan
still told the reader to edit ai-table-reader.ts / readDatabaseTable, both
deleted by this issue — Task 3a and its test step now describe ControlRowVisibility
and the plan_read visibility check. Refs #85
Refs #85
This reverts commit 086f5aa50c.
Refs #85
The budget gate advertised 14 of 21 tools on a tiny window while the
system prompt still told the model it operated through all of them, so
the first write attempt burned a turn on a harness tool error — in the
very window the gate exists to protect. The prompt now states which
tier was dropped; reads and the gate itself are unchanged.

Refs #85
fitControlTools had no direct assertions — only the end-to-end UC-MW-115
tiny-window chat. Two tests now pin the contract: a 2048-token window
drops exactly the seven write tools and keeps every read tool, and a
fitting or unknown window returns the tool list untouched.

Refs #85
EduarD3V approved these changes 2026-10-08 14:34:55 +02:00
gotoi-agent merged commit 0a3e3553ee into agent-develop 2026-10-08 14:35:39 +02:00
Sign in to join this conversation.
No description provided.