Skip to content

A schedule created by a non-owner-tier person silently loses the shell on every run, and the run still reports success #4281

Open

Description

@vybe

Summary

A cron schedule whose recorded creator is neither an admin nor the agent's owner is rated a shared person's turn on every run. The ent#926 guard hook then refuses Bash and every owner-added MCP server for the whole run, with a message that describes a chat that is not happening. The turn still completes and the execution row still reads success, so nothing on the platform shows that the scheduled work did not run.

Three things are wrong, in order of how much they cost:

  1. The failure is permanent and invisible — every run of that schedule, forever, with no platform surface carrying it.
  2. The refusal message names the wrong cause, sending the owner to look for a sharing problem in a conversation that does not exist.
  3. Nothing checks this when the schedule is created or enabled, though it is fully computable then.

The classification itself is working as designed (the 2026-10-19 ruling: a share holder may create a schedule, so its runs must not be the owner's). This issue is not asking to change that rule.

Cause (read from the code at 1a5d90ba1)

services/turn_tier_service.py → turn_actor. A schedule run carries no source_user_id, so it is rated by its schedule's creator:

has_schedule, schedule = _schedule_of(db, agent_name, execution)
if has_schedule:
    if schedule is None:          return SHARE, VISITOR, None
    creator = schedule.owner_id
    if creator is None:           return OWNER, None, None
    if _user_tier(creator) == OWNER: return OWNER, None, None
    return SHARE, PERSON, creator          # <- every run of this schedule

_user_tier is OWNER only when the creator is an admin, or passes can_user_share_agent — which is role == "admin" or being the agent's recorded owner row (db/agent_settings/sharing.py:298). So the rating is SHARE/PERSON whenever the schedule's creator is a non-admin who is not that agent's recorded owner — including the case where the agent has no owner row at all, since get_agent_owner returning None makes the predicate falsy.

Note OWNER_CONFIGURED_TRIGGERS (which contains "schedule") is unreachable for a real schedule run: the has_schedule branch returns first. A triggered_by="schedule" row is therefore never rated owner because it is a schedule.

shell_allowed then gives this turn no shell and offers no owner-facing override:

if tier == OWNER:                      return True
if tier == SHARE and kind == VISITOR:  return visitor_shell_allowed(...)
return False

visitor_shell does not reach the PERSON path, so there is no setting, guardrail or UI control that restores the shell for such a schedule. The only remedies are to make the creator an admin or the agent's owner, or to delete and re-create the schedule as an owner-tier person — and nothing tells anyone that.

In the agent, docker/base-image/hooks/turn-tier-guard.py → guard_shell refuses Bash, every mcp__* tool that is not the platform's own trinity server, and the MCP resource tools, with SHELL_OWNER_ONLY / MCP_OWNER_ONLY.

Why it is invisible

  • The run succeeds. A PreToolUse deny is exit 2 with a message to the model (hooks/lib.py). The agent reads the refusal, answers around it, and the turn exits 0. Any monitoring keyed on failed executions is structurally blind to this class.
  • The deny record never leaves the container. lib.deny writes a structured row to /logs/guardrails.jsonl. On a running agent that path is a plain container directory on no volume (recreated at container start), and config/vector.yaml's only source is docker_logs — container stdout/stderr over the Docker socket. It does not read that file. The comment at hooks/_skill_gate.py:820 describing the path as "(Vector)" is inaccurate.
  • The backend is never told. The hook's only outbound call is the GET .../turn-tier; it posts no decision. So by construction no execution field, condition, alert or audit row can carry a hook refusal.

The only surface this appears on is an agent choosing, on its own initiative, to raise an operator ask about it.

Reproduction

  1. Agent A is owned by an admin. Person P is a share holder on A (not owner, not admin) with schedules.manage, or A's owner row is absent.
  2. P creates a cron schedule on A whose message does real work through the shell (a script run, a git push, a file-processing job) or through an owner-added MCP server.
  3. Let it fire.

Expected: either the schedule runs its work, or it fails visibly and says why.

Actual: every Bash call and every non-platform MCP tool is refused for the whole run with "This turn is for a person the agent is shared with, and running commands is owner-only. Answer without the shell, or ask the agent's owner to run it." The execution ends success. Repeats on every tick indefinitely. GET /api/agents/{A}/executions/{run}/turn-tier returns {"tier":"share","kind":"person","shell":false}.

For contrast, on an instance where schedules were created by an admin the same route returns {"tier":"owner","kind":null,"shell":true} and the hook allows.

Observed

Seen on two agents on one instance, on four separate schedules (an hourly data-drain job and a dashboard sync among them), all reporting success throughout — found only because the agents each raised an operator ask. Both affected agents were 100% success for the day. The work refused was idempotent catch-up work, so there was no loss; a schedule doing non-idempotent or outbound work would have failed the same way, just as quietly.

Acceptance criteria

  • A schedule run refused because of its creator's tier says so: the message names the schedule and its creator as the cause, and names the remedy (an owner-tier person re-creates or takes over the schedule). It must not describe the turn as a person chatting with the agent.
  • A hook refusal in a schedule-backed turn is visible on a platform surface — at minimum the execution does not read as a clean success. (Open decision: execution outcome field vs. a platform condition on the schedule vs. both. Worth ruling with the one-row-per-subject alert seam in mind.)
  • Creating or enabling a schedule whose runs would be rated share/person is refused with a named reason, or recorded on the schedule row and shown wherever schedules are listed — the rating is computable at that moment.
  • A schedule already in this state is discoverable without opening a container (a fleet-health or schedule-list read is enough).
  • hooks/_skill_gate.py:820's "(Vector)" comment is corrected, or /logs/guardrails.jsonl is actually collected.
  • Tests cover: a schedule created by a share holder (refused or flagged at creation), and the refusal message for a schedule-backed turn.

Notes

  • Lineage: the ent#926 turn fence. Adjacent but not this: Abilityai/trinity-enterprise#978 item 6 is running_turn_restricts (an unrelated concurrent restricted turn refusing the owner's routes), and Abilityai/trinity-enterprise#1063 is the opposite direction (an agent key addressing a schedule to a third party). Neither covers a schedule's own creator rating, the message text, or the observability gap. Agent cannot read a child execution it started during a share holder's turn (404 Execution not found) #4173 is the sibling consequence bug on the read path.
  • _schedule_of fails closed to SHARE/VISITOR for a schedule that cannot be read or belongs to another agent — that path keeps the shell when visitor_shell is on (the default), and emits the other message. The person-shaped message quoted above is only reachable through the creator-tier path, which is what identifies the cause from the symptom.
  • Asymmetry worth a look while in here: a schedule with no recorded creator rates OWNER, while one with a dangling creator id (deleted user) rates SHARE via _user_tier's if not user: return SHARE. Same "no identifiable creator" situation, opposite outcomes.

Activity

  1. added
    priority-p2
    type-bug
    theme-security
    complexity-medium
    status-ready
    on Nov 5, 2026
  2. vybe commented on Nov 6, 2026

    @vybe
    ContributorAuthor

    New evidence: the same class measured over ~25h on a second agent — and this time the refused work was not idempotent catch-up.

    Since a container recreate onto the current base image at 2026-11-05T16:46:44Z, one agent's scheduled jobs have rated share/person on every tick. Measured from inside that container:

    • GET /api/agents/{a}/executions/{run}/turn-tier → {"tier":"share","kind":"person","shell":false} for two separate schedule-triggered runs. An agent-triggered run on the same agent → {"tier":"owner","kind":null,"shell":true}; a synthetic execution id → 404. So the route works and discriminates — the rating is specific to the schedule-backed turns.
    • /logs/guardrails.jsonl: 78 denials in 24h 35m (2026-11-05T17:00:20Z → 2026-11-06T17:35:08Z) — Bash 66, Grep 5, Glob 4, Write 3.
    • Every affected execution is recorded success. Seven scheduled jobs — data ingestion, record linking, two third-party syncs, a periodic sweep, a stamping pass and a watchdog — did nothing for ~25h. One job's incremental cursor has not advanced since 16:27:51Z the previous day, so the gap is now a backlog, not just a skipped tick.

    kind: "person" is the discriminator described above: for a schedule-backed run it is reachable only through _user_tier(schedule.owner_id) != OWNER. The fail-closed path (_schedule_of → unreadable schedule, or one belonging to another agent) returns share/visitor, which keeps the shell while visitor_shell is on and emits different text.

    Mechanism re-read at b076f4bd5: services/turn_tier_service.py, db/agent_settings/sharing.py, docker/base-image/hooks/turn-tier-guard.py, hooks/lib.py and config/vector.yaml are all byte-unchanged since 1a5d90ba1, where this was filed. Nothing has moved.

    Two corrections, because this keeps arriving mis-framed

    Both reports of this arrived as "the classifier misclassifies schedule-triggered turns", with the agent's person-share record as the suspected cause. Neither holds, and chasing either produces no fix:

    1. The classifier is behaving as designed (the 2026-10-19 ruling). Rating schedule runs owner by trigger label would reopen exactly the hole ent#926 closed — a share holder creating a schedule to run their own prompt at owner tier. The fix target is not the classification.
    2. The determinant is the schedule row's owner_id, not the agent's share record. An agent with share holders whose schedules were all created by an admin is unaffected. An agent with no share record at all is affected if its schedules' creator is a non-admin who is not that agent's recorded owner — including when the agent has no owner row, since get_agent_owner() is None makes can_user_share_agent falsy. A dangling creator id is affected too (_user_tier: if not user: return SHARE). So the blast radius is per-schedule, not per-agent and not per-share-record.

    Two gaps found while trying to work around it from outside

    • No remediation path exists. owner_id is written only at creation (db/schedules/crud.py) and is not in update_schedule's allowed_fields. A schedule in this state cannot be re-homed at all — delete and re-create it as an owner-tier person is the only route, and nothing anywhere says so.
    • No read enumerates the affected schedules. owner_id is on the Schedule model, so an admin REST read carries it — but MCP list_agent_schedules does not return it (verified live against a 22-schedule agent). So neither an agent nor a non-admin can discover which of its own schedules are permanently broken; it takes an admin REST or DB read plus a per-creator role/owner-row lookup.

    Proposed additions to the acceptance criteria

    • An owner-tier person can take over an existing schedule (re-home its creator), or the platform offers a named equivalent. Today the state is unrecoverable in place.
    • A schedule's effective tier — or at minimum its creator — is readable over MCP, not only admin REST, so an agent can see its own broken schedules.

    Escalation from priority-p2 is proposed to the maintainers on the strength of the above (25h, seven jobs, a stalled cursor, zero platform signal); not changed here — priority is the operator's call.

  3. added
    priority-p1
    and removed
    priority-p2
    on Nov 8, 2026
  4. vybe commented on Nov 9, 2026

    @vybe
    ContributorAuthor

    Correction to my 2026-11-06 comment, plus a verified self-service remedy. I wrote that "unblocking an affected agent is an operator action, not a code fix." That is wrong, and I should not have said it without testing the one path I had not considered.

    That claim rested on owner_id being immutable: it is written only at creation (db/schedules/crud.py:171,196) and is absent from update_schedule's allowed_fields. Both still hold — no route re-homes an existing schedule. What I missed is that the row can be re-created from inside the container, by the agent itself.

    The remedy, verified

    An agent-scoped MCP key resolves to the key owner's platform user on REST — stated outright in dependencies.py at the ephemeral-key fence: "An agent-scoped key resolves to the OWNER user on REST." create_schedule then stamps owner_id=user["id"] from current_user.username, and the create route carries capability_fence("schedules.manage", own_agent_exempt=True), so an agent needs no grant to create a schedule on itself.

    So when an agent re-creates its own schedule under its own key, the new row's creator is the key's owner. Where that owner is an admin or the agent's recorded owner row, _user_tier returns OWNER and the schedule is permanently fixed.

    Tested end to end on one agent this run (dev 091b0b2cc):

    1. create_agent_schedule on self, disabled, via the agent's own key.
    2. trigger_agent_schedule → execution id.
    3. GET /api/agents/{a}/executions/{run}/turn-tier → {"tier":"owner","kind":null,"shell":true}
    4. Schedule deleted.

    A manual trigger is a valid probe here: _schedule_of returns on has_schedule before triggered_by is read, so the creator rating is reached either way.

    This is not a new way around ent#926

    Worth stating explicitly, because "an agent can mint an owner-tier schedule" sounds like the hole this fence closed. It is not reachable from a restricted turn: the census row for POST /api/agents/{name}/schedules carries "standing_work": true, and route_tier_service.refused_in_restricted_turn refuses every standing_work row to an agent key acting in a restricted turn. A shared person therefore cannot ask the agent to mint a schedule carrying their prompt. The sibling row for disable_schedule spells out the same reasoning in its restricted_turn note.

    Safe pre-flight, so nobody trades a broken schedule for a broken schedule

    The remedy fails silently where the agent's key owner is the same non-admin non-owner person who created the broken rows. Steps 1–4 above are that check, and they are non-destructive: a throwaway disabled schedule, triggered once, probed, deleted. {"tier":"owner"} means re-creation will work; anything else means it will not, and the row needs a person.

    Two caveats for the ACs

    • Re-creation is not free. owner_id is the only field that cannot be carried over, but the webhook token is re-minted, and every other field must be re-declared (model, timeout_seconds, allowed_tools, the validation trio, deliver_to_workspace_email). Execution history attached to the old schedule id goes with it.
    • deliver_to_workspace_email can block the remedy outright. Under ent#1063 an agent key may point a schedule only at its owner's address. A schedule that delivers to anyone else cannot be re-created by the agent at all — that one needs a person.

    One more reason this is invisible from outside

    The diagnostic route is self-only. GET /api/agents/{a}/executions/{run}/turn-tier answers "Turn tier requires the agent's own MCP key" for any other agent, even one the caller holds a permission edge to (tried this run). Combined with owner_id being absent from MCP list_agent_schedules, that means only each agent can diagnose itself — no orchestrator, and no non-admin, can enumerate which agents or schedules are affected. The enumeration still wants the admin-side query named in the 2026-11-06 comment.

    Suggested AC, beyond the surface question already open: document the re-create remedy and its two caveats wherever the refusal is explained, since the refusal text currently sends the reader hunting for a sharing problem in a chat that does not exist.

  5. added 3 commits that reference this issue on Nov 10, 2026
  6. added
    status-in-progress
    and removed
    status-ready
    on Nov 11, 2026
  7. pavshulin commented on Nov 11, 2026

    @pavshulin
    Contributor

    Release-test note (row B9, v1.0.5-rc2 af465288a): this still reproduces on the rc2 tag; there is no fix commit in the tag.

    Checked on a source-built rc2 stack, same agent, two schedules with the same cron:

    Schedule created by Cron run's GET /api/agents/{name}/executions/{id}/turn-tier (agent's own key)
    the agent's owner {"tier": "owner", "kind": null, "shell": true}
    an operator the agent is shared with {"tier": "share", "kind": "person", "shell": false}

    Both rows have no source_user_id (cron fires), so the tier comes from the schedule's creator. The operator could create the schedule (201); a manual trigger by that operator is refused (owner only), so only the cron path was compared. The turns themselves were not run with a working model credential, so "the run still reports success" was not re-checked — only the tier rating.

  8. trinity-ability commented on Nov 15, 2026

    @trinity-ability
    Contributor

    v1.0.5 fix-or-note: proposed as a release note, not a fix in this release. The ruling is the operator's.

    The fix is #4427. It is a draft of about 7,800 lines across 88 files, stacked on the draft #4425, waiting on a UI sign-off and currently in conflict with dev. That is not release-candidate material at rc3. A workaround exists and is verified in the 11-09 comment above.

    Proposed release-note text:

    A schedule created by someone who is neither an admin nor the agent's owner runs without the shell and without owner-added MCP servers, and its runs still show as successful. Until the fix ships, have the agent's owner or an admin delete and re-create such a schedule. Re-creating it issues a new webhook token and drops the old schedule's run history.

    One interaction worth stating next to it: the restriction is enforced by the new agent image, so it starts on an agent the first time that agent restarts after the upgrade. #4602 (#4483) adds an alert asking operators to restart agents still on the old image, so a fleet restart after upgrading is the moment affected schedules stop doing their work. The note should sit beside the upgrade's "restart the fleet" step.

  9. vybe commented on Nov 16, 2026

    @vybe
    ContributorAuthor

    Ruling for v1.0.5 (operator, 2026-11-16): ship with a release note, fix in the next release.

    The fix (#4427) is a large draft stacked on another draft (#4425), with a UI sign-off still owed. That is not release-candidate material. A verified workaround exists (the 11-09 comment): the agent's owner or an admin deletes and re-creates the schedule.

    The release note uses the text proposed in the 11-15 comment above and sits beside the upgrade's "restart the fleet" step, since the restriction starts on an agent the first time it restarts on the new image.

    Stays P1 for the next release. Row B9 of abilityai/trinity-enterprise#1189 can close on this ruling.

  10. AndriiPasternak31 commented on Nov 18, 2026

    @AndriiPasternak31
    Contributor

    This issue closes with the schedule run-tier fix in #4648, which is planned for the next release (it stays P1 until then, per the 2026-11-16 ruling). A schedule whose runs do not get owner tier now says so: on every schedule read, in the hook's refusal text, on each restricted run, and as one owner alert per creator. An owner or admin can take the schedule over in place, and Gemini/Codex schedules that could not run are refused at create and enable. Continuation turns of a restricted run carry the same text and stamp.

    One part does not ship here: the count of tool calls the hook refused during a run. That count needs the guardrail event store from #4425, so it moves to #4647 and lands after #4425. Until then, the restricted-run marker says the run lacked shell access, but not whether any tool call was actually refused.

    #4427 is replaced by #4648.

  11. added
    status-in-dev
    and removed
    status-in-progress
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

complexity-mediumpriority-p1status-in-devtheme-securitytype-bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions