Skip to content

feat(action-center): carry out a task through a tool, with a record of it - #833

Merged
gkhngyk merged 1 commit into
mainfrom
feature/task-execution
Sep 26, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/task-execution

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Phase 7 of #818, the last one. Phase 5 marked every task with who could carry
it out and whether carrying it out reaches outside Ansvisor; nothing acted on
either. This is the layer that does.

Four rules

Nothing reaches outside except through a tool. The registry is the
enumerable surface. Arguments are built from the action's own payload — no
query, no URL and no property id comes from anywhere a model could reach. The
analytics sync already works this way; it is the reason this layer can be
audited at all.

Nothing changes outside Ansvisor without approval. A tool that writes to a
third-party system is blocked until a person authorises that task, and the
authorisation is recorded on the task rather than inferred from whoever
triggered the run. The task also moves to waiting_approval, so the person
who has to decide can find it without reading a log.

Reading a system the brand connected is not a change and needs no approval.
Requiring one before every read teaches people to approve without looking,
which is how an approval step stops being one.

Every attempt is recorded — inputs, tool, result, error — and never the
model's reasoning. That is not evidence, it is not reliable as explanation,
and storing it invites people to read it as both. Anything a run wants to
claim it claims in output, where the next task reads it.

A failed run fails its task, not its action. A tool that throws costs one
step. The action stays open, the other tasks stay as they were, and somebody
does that step by hand.

The exit condition, against production

Both tools run read-only, so they were exercised directly against the live
database and a live integration:

visibility_window    ok in  517ms   writesExternally=false
  answers 12384 (prev 27207) · mentions 1037 · citations 1357

ga_traffic_window    ok in 2558ms   writesExternally=false
  199 pages · 748 sessions vs 722 the week before

The second is the one the phase is about: it reaches the brand's own
Analytics property through the connection they authorised, via the Composio
toolkit, and returns a before/after measurement. It reads live rather than
from ga_page_stats because that table stores the top pages of each day and
says so when it truncates — the right trade for a dashboard, the wrong one
for a measurement of specific pages, where a page outside the ceiling would
report zero sessions rather than none.

Honest gaps

Fourteen agent-mode tasks still have no tool. The runner names the
missing one rather than improvising, which is the difference between an
honest gap and a silent one. Tools arrive the way detectors and definitions
did — as each one is worth building.

No shipped tool writes externally, so the approval gate currently holds
nothing back. It is enforced and tested now, against a stand-in tool, rather
than written later under deadline against a real one.

No model in the loop. Both tools are deterministic. The runner, the
audit trail and the approval gate are what a model-driven tool would need
before it could be added, and they exist now; adding one is a smaller change
than building this was.

Deliberately not on the cron

The engine that produces these tasks spent six days failing silently before
anyone noticed (#829). An execution layer that runs unattended belongs after
the verification that the thing it executes for is running at all — which is
tomorrow morning, on the first clean nightly run.

src/scripts/run-action-task.js <taskId> invokes it deliberately;
--dry reports why a task would not run without running it, which is the
useful half when the question is "why has this task not moved".

Related issue

Refs #818

Type of change

  • feat — New feature

How to test

cd server && yarn test                                    # 603 tests, 17 new
node src/scripts/run-action-task.js <taskId> --dry        # why it would or would not run

Migration 00090 is applied to the hosted database. action_task_runs is
service-role only with no policies; action_tasks gains approved_by and
approved_at, both null on every existing row.

Checklist

  • Branch follows the naming convention (feature/)
  • Commits follow Conventional Commits
  • yarn lint passes
  • yarn format:check passes
  • Changes are focused — one concern per PR

🤖 Generated with Claude Code

https://claude.ai/code/session_01SQ2H6mSd9JDpmqonk2VWBj

…f it

Phase 5 marked every task with who could carry it out and whether carrying it
out reaches outside Ansvisor. Nothing acted on either. This is the layer that
does, under four rules:

Nothing reaches outside except through a tool. The registry is the enumerable
surface, and arguments are built from the action's own payload — no query, no
URL and no property id comes from anywhere a model could reach, the same rule
the analytics sync already follows and the reason this layer can be audited.

Nothing changes outside Ansvisor without approval. A tool that writes to a
third-party system is blocked until a person authorises that task, and the
authorisation is recorded on the task rather than inferred from whoever
triggered the run. Reading a system the brand connected is not a change and
needs no approval: asking for one before every read teaches people to approve
blindly. No shipped tool writes externally yet, so the gate currently holds
nothing back — it is enforced and tested now rather than written later under
deadline.

Every attempt is recorded: inputs, the tool, its result, any error. Never the
model's reasoning. That is not evidence, it is not reliable as explanation,
and storing it invites people to read it as both. Anything a run wants to
claim it claims in `output`, where the next task reads it.

A failed run fails its task, not its action. A tool that throws costs one
step; the action stays open and somebody does that step by hand.

Two tools ship. `visibility_window` reads our own rollups; `ga_traffic_window`
reads the brand's analytics property through the connection they authorised —
live rather than from `ga_page_stats`, because that table stores the top pages
of each day and truncates, which is the right trade for a dashboard and the
wrong one for a measurement of specific pages. Verified against production:
the analytics tool returned 748 sessions against 722 the week before, across
199 pages, in 2.5s.

Fourteen agent-mode tasks still have no tool. The runner says so by name
rather than improvising, which is the difference between an honest gap and a
silent one.

Deliberately not wired to the nightly cron. The engine that produces these
tasks spent six days failing silently before anyone noticed (#829); an
execution layer that runs unattended belongs after the verification that the
thing it executes for is running at all. `src/scripts/run-action-task.js`
invokes it deliberately, and `--dry` reports why a task would not run.

Refs #818

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01SQ2H6mSd9JDpmqonk2VWBj
@github-actions github-actions Bot added the needs-migration Adds or edits a migration — apply it to the hosted database label Sep 25, 2026
@gkhngyk gkhngyk mentioned this pull request Sep 25, 2026
33 of 37 tasks
@gkhngyk
gkhngyk merged commit dca74c2 into main Sep 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-migration Adds or edits a migration — apply it to the hosted database

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant