Repository navigation
Description
Summary
An agent working on a triage task can queue another triage of the same record from inside its own run, and the bridge then hands that new task to the agent too. Nothing stops each run from queuing the next.
Found while testing #22 end to end with a real agent (Pi, through agent-app <dir> bridge start) on the pocketbase-react starter. It happened in both real runs. The cause is in the starter design every blueprint shares, not in the PocketBase adapter.
What happens:
- The person clicks "Ask an agent";
request-triagequeues task A and stores its id in the record'sagentTask. - The bridge claims A and starts the agent.
- To understand the task, the agent opens the record's screen (
a2app . planning tasks <id>). That screen listsrequest-triageas available, because its only condition isstatus ne done. - The agent runs it. That queues task B for the same record (its payload names A as
previous, so it is a new occurrence and is not deduplicated), and pointsagentTaskat B. - A completes. The bridge picks up B and starts the agent again, which can repeat step 4.
Evidence (PocketBase request log; user agent node is the a2app CLI the agent drives, not the browser):
10:41:55 POST /api/_a2app/tasks/tsk_7daa9505e25f7995/claim 200 ← bridge claims A
10:42:07 GET /api/collections/tasks/records/6fq5hdnxkn14gk8 200 ← agent reads the record
10:42:10 POST /api/ops/request-triage 200 ← agent queues B
10:43:12 POST /api/_a2app/tasks/tsk_7daa9505e25f7995/complete 200 ← A done
10:43:19 POST /api/_a2app/tasks/tsk_7885361b92a50133/claim 200 ← bridge claims B
The agent noticed, in its own result for A: "an extra triage request was inadvertently queued while inspecting the task, so the task record now references tsk_7885361b92a50133 as its agentTask."
Effects:
- Repeated runs: each run can queue another, so agent time and cost keep growing, and the record is edited again on every pass. In testing, the bridge was stopped after A finished.
- The answer goes off screen: the record now points at B, so the View follows B, and A's result is no longer shown on the row.
Affected: every blueprint's starter. request-triage in react-node (a2app.schema.mjs), go-react (schema.go), rust-react (src/schema.rs), rails-vue (lib/a2app_schema.rb), python-fastapi (schema.py) and pocketbase-react (pb/pb_hooks/operations.js) is available on any task that is not done, and none checks for a run already in progress.
Proposal
- Starter guard (every blueprint):
- Rule:
request-triagerefuses while the record's current agent task (agentTask) is unfinished (submitted,workingorinput-required). It answers409with a code such asalready_queuedthat names the open task. - Why it works: the agent's own run is unfinished at the moment it tries to re-queue, so this blocks exactly this case. It also covers a person asking from a second tab. Asking again after a run finishes (completed, failed or canceled) keeps working as today.
- Reading the task: where a runner cannot read a task's state, the blueprint gives it a way. The PocketBase runner toolbox, for one, has no task read today.
- Rule:
- Bridge prompt (framework): the prompt in
framework/cli/src/lib/bridge.tstells the agent not to run operations that queue agent work for the record it was handed. This is a backstop for app-specific operations that do not have the guard; on its own it is not enough, since agents do not always follow instructions. - Docs: the creator skill's app→agent section and each
reference/blueprint.mdsay that an operation which queues agent work must refuse while that record already has open agent work.
Acceptance
- Guard: in every starter,
request-triageon a record whoseagentTaskis unfinished answers409and queues nothing. Once that task is finished, it queues new work. - Real run: a harness run through
agent-app <dir> bridge starton a starter ends with exactly one task for the record, even when the agent callsrequest-triageduring its run. - Prompt:
agent-app <dir> bridge start --dry-runshows the new instruction. - Tests: each starter's own tests (or gate self-test, where a stack has no test suite) cover the refusal and the re-ask after completion.
Activity
blueprint-pocketbase-react: guard PocketBase's own routes, finish the…