Skip to content

fix(schedules): a schedule says what tier its runs get, the owner can take it over, and a restricted run is named, marked and alerted (#4281) - #4648

Draft
AndriiPasternak31 wants to merge 9 commits into
devfrom
AndriiPasternak31/issue-4281-run-tier-dev
Draft

AndriiPasternak31 wants to merge 9 commits into
devfrom
AndriiPasternak31/issue-4281-run-tier-dev

Conversation

@AndriiPasternak31

@AndriiPasternak31 AndriiPasternak31 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Closes #4281.

Draft until the manual UI sign-off is given. The Schedules tab's run-tier badge, the take-over review, the Run-now confirm, the share holder's create notice and the restricted-run marker have not been visually accepted in a browser on this branch, in either theme or at phone width. This PR stays a draft until that sign-off.

This replaces #4427, which was stacked on #4425. It carries the same schedule change, on dev alone, without the per-run refusal count: that count reads #4425's guardrail event store, so it lands as its own PR after #4425 merges (#4647). Nothing here imports, migrates or documents #4425's code.

  • No migration and no schema change. Alembic stays at one head, 0124_execution_continues_execution_id.
  • Merge with squash. One intermediate commit adds the continuation tests before the fix, so it is red on its own. The branch merges dev at 0134633ce; the one conflict was a line in architecture/backend.md where both sides added a clause, and both are kept.

Why

A schedule is rated by its creator. When the creator is neither an admin nor the agent's owner, every run is a shared person's turn (no shell, no owner-added MCP servers), and nothing said so: not the schedule, not the run, not the hook's message, which told the model the turn was "for a person the agent is shared with". The run still ended success; the issue's case was 78 hook denials over about 25 hours with every execution reading success. A share holder's schedule could not be fixed in place either: its runs kept the creator's access until someone re-created it.

This PR gives one answer to "what tier will this schedule's runs get, and why", shows it on every schedule read and in every refusal, records it on the run, tells the owner once per creator, and lets the owner (or an admin) take the schedule over after reading exactly what it does.

What changes

One run-tier rule, visible on every schedule read

  • A schedule-backed turn whose schedule cannot be read is never owner-capable. When the schedule is gone, belongs to another agent, or the read raises, services/turn_tier_service.turn_actor rates the turn as a shared person's turn with no person attached, (share, person, None). Through the existing functions: shell_allowed is False; restricts_standing_work is True, so the agent key's owner-tier, resource and standing-work routes are fenced for the rest of that run; the key's reads narrow to the no-rows id. (share, person, None) is already a value on the wire, so the turn-tier reply contract is unchanged. Live, readable schedules, the no-recorded-creator rule (the owner's) and channel and public-link visitors are unchanged. The stated cost: an owner whose own schedule disappears mid-run loses the shell for the rest of that run.
  • One run-tier function, schedule_run_tier(db, agent_name, schedule) -> RunTier(tier, kind, cause, creator_id). turn_actor's schedule branch calls the same tier half and projects it, so the rule does not move; a frozen matrix pins turn_actor's output, including dev's project_steward trigger. A recorded creator is rated through _person_tier, so a registered member creator rates (owner, member, creator) exactly as the member's own turn does.
    • Causes: creator_owner_tier, no_recorded_creator, creator_not_owner_tier, agent_has_no_owner, creator_missing, schedule_unreadable, unknown. The cause is total and never raises, is never on the fence path, and answers unknown rather than contradict the tier when two reads of the schedule disagree.
    • Remedies: creator_not_owner_tier and creator_missing → take_over; agent_has_no_owner → repair_agent_owner; otherwise none.
  • The turn-tier answer (turn_tier_answer, moved into the service so the router does no execution read) adds cause, schedule, creator and remedy for a schedule-backed shared turn, all null on any other turn. Labels have control and format characters stripped; the schedule name is cut to 80 characters and the creator label to 64 (display name, else username, anything after @ dropped). Worst case ≤2048 bytes.
  • Continuations follow the run they continue. dev rates a continuation turn (caller_wake, operator_response, operator_ending, skill_gate; trinity-enterprise#1225) as the turn it continues. The schedule fields and the run stamp now read the same row, through turn_tier_service.rated_turn, so a continuation of a share holder's schedule run gets the schedule text and is stamped with that run's schedule. A link that cannot be followed names no schedule.
  • Every schedule read — ScheduleResponse (list, get, create, PUT), the enable and disable bodies, and GET /api/ops/schedules — carries runs_as (owner | shared_person | null when it could not be computed), runs_as_reason {code, message}, created_by_you, created_by and can_take_over (a person at owner tier, not the creator, runs_as == shared_person, cause creator_not_owner_tier or creator_missing). created_by is shown only to the owner tier and to the agent's own key (not while that key acts for a shared person); the creator's id is not exposed. No N+1: a per-request RunTierLookups memo; the fleet read preloads it with two bulk reads (db.get_agent_owners, db.get_users_by_ids) and falls back to per-row reads if they fail.
  • Runtimes other than Claude Code. Switching on a schedule that rates as a shared person (create with enabled, POST …/enable, a PUT that enables) on an agent whose runtime is not Claude Code is refused with 409 schedule_cannot_run_for_creator_on_runtime ({code, message, runtime, cause}), because such a run can never start there. Every Claude Code runtime spelling (claude-code, claude) is Claude Code; a Docker fault falls back to Claude Code, so it warns rather than refuses. On Claude Code the schedule is created and flagged.
  • MCP: the Schedule type and the list_agent_schedules / get_agent_schedule descriptions cover the new fields (pass-through).

A refusal caused by a schedule's creator names the schedule

  • The hook (hooks/turn-tier-guard.py). ask_turn returns (tier, shell, kind, schedule); schedule is the reply's detail for a share answer whose cause matches the event-code shape, with remedy kept only if it is a known key. Labels are bounded again on the agent side (80 / 64 characters, non-printable characters replaced, an email's domain dropped).
    • Shell, MCP, path and search refusals use the schedule text when there is a detail, after the unreachable branch and before today's branches, which are unchanged. The text keys on cause, never on kind.
    • Creator causes: "This run is the scheduled task '', not a chat." Then, by cause, who the creator is (creator_not_owner_tier), "an account that no longer exists" (creator_missing), "This agent has no owner on record…" (agent_has_no_owner), or a generic line for unknown and any newer cause; what is not available; and "say in your answer that this schedule needs ". schedule_unreadable has its own text.
    • A cause never refuses a turn the platform lets use the shell: shell: true still allows first.
    • Deny records in the container's /logs/guardrails.jsonl carry code="schedule_creator_tier" or code="schedule_unreadable", plus cause= and turn_kind=, through dev's lib.deny(message, **log_fields).
  • The agent server (agent_server/services/turn_scope.py), the refusal path for runtimes other than Claude Code: fetch_turn returns the same 4-tuple and require_owner_tier uses the schedule texts when there is a detail; neither mentions switching runtime. Status 403 and error_code: turn_refused are unchanged.
  • One remedy table in both copies (a parity test pins them): take_over, recreate, repair_agent_owner, and a fallback.
  • Skew: an answer with no cause gets today's four hook texts and today's refusals byte for byte (pinned literally). Six runtime test files that stub turn_scope.fetch_turn gain the fourth element.
  • The skill gate's log docstring no longer says /logs/guardrails.jsonl reaches Vector: the file stays in the container, and Vector reads container stdout and stderr only.

A restricted run is recorded on the run and raised to the owner once per creator

  • The stamp. apply_result rates the run once, before either branch, through schedule_tier_alerts.run_restriction_by_id (which uses turn_tier_service.schedule_backed_run_tier: the same "schedule-backed" test turn_actor applies, then schedule_run_tier). A run whose tier is not owner writes turn_integrity.restricted_turn = {tier, kind, cause, schedule_id, creator_id, shell: false} into the existing Background task killed at CLI exit leaves no trace — execution records clean success while the work is lost #2467 column, merged beside the Background task killed at CLI exit leaves no trace — execution records clean success while the work is lost #2467 keys. The rating is total: a lookup that raises records nothing and never changes the outcome. Success and failure branches are both stamped (a refused run on another runtime is a failure), and so are the pull sink's two writes. Owner-tier and non-schedule runs write exactly what they wrote before; a manual "Run now" carries its clicker and is not stamped. No status change.
  • The alert. A new platform-alert kind schedule_runs_restricted (priority medium) on the existing seam: one operator-queue row per agent × creator, subject schedule_runs_restricted:<creator id>. Its text names the creator (display name, else username; "an account that no longer exists" for a missing one), the cause, the remedy and up to 5 schedule names; its context carries ids and codes only (≤20 schedule ids plus a count). cause is the only material key, and a person's ending is final. The id prefix is reserved (an agent cannot pre-create the row), and the row is owner-only and about a person: the owner and admins see it; other share holders, the creator and every machine key do not. operator_queue_service/__init__.py stays at its 800-line threshold.
  • One decision point, schedule_tier_alerts.sync(agent, creator_id): it reads that creator's live, enabled schedules on the agent and rates them in one memo; any shared-person schedule observes the row, none clears it. A rating that raises, or a set whose every cause is unknown, decides nothing, so a transient lookup failure never re-files a row a person ended. It never raises.
  • Callers, each after its own write committed: the create, PUT, delete, enable, disable and take-over routes (take-over decides it for the former creator and the taker); the ops pause and resume and the emergency stop (one read per distinct agent × creator); /api/internal/execute-task after the idempotency gate (so a replay does not sync); and apply_result on the status-CAS-winning branch only. Re-reading the live schedules is what makes a run that ends after a disable file nothing. Rows go with the agent (operator_queue CASCADE) and follow a rename. No background loop, so one reading has one writer; racing readings meet the seam's per-agent lock and partial unique index. An existing restricted schedule is flagged at its next write or dispatch; there is no sweep at boot.

The owner takes a share holder's schedule over in place

  • POST /api/agents/{name}/schedules/{schedule_id}/take-over (take_over_schedule). require_person (agent, system and connector keys and the loopback get 403 person_required) plus OwnedAgent (owner or admin, uniform 404); a Workspace-only person is refused at the operator floor.
  • The owner adopts exactly what they reviewed. Body {expected_updated_at, reviewed: {message, allowed_tools, model, validation_enabled, validation_prompt}, delivery?: "clear"|"keep", keep_delivery_to?}; every reviewed field is required and echoed from the read. db.reassign_schedule_creator compares owner_id, updated_at (as an instant), every reviewed field and the delivery, then makes one UPDATE whose WHERE pins every one of those columns (IS NOT DISTINCT FROM), deleted_at IS NULL and the absence of a queued/running/pending_retry run of the schedule. Zero rows → 409 schedule_run_in_progress, schedule_changed_since_review or 404 schedule_not_found. The same UPDATE sets the new creator, revokes the schedule's webhook and clears the delivery when asked. Already the creator → 200, no write. Rated owner tier → 409 schedule_not_restricted. A rating that raises propagates (500), so a schedule that cannot be rated is never changed.
  • Workspace delivery. A delivery to anyone but the taker needs clear, or keep with keep_delivery_to repeating the address (trimmed, case-insensitive); otherwise 409 schedule_delivers_to_another_person naming it.
  • Creator-bound writes. update_schedule and delete_schedule add owner_id = <caller> for a non-admin, and a share-tier webhook mint is bound to the creator (a 0-row mint is 403 webhook_owner_or_creator), so a former creator's in-flight write cannot land after a take-over.
  • Run now on a shared person's schedule. A person's Run now is unchanged (the UI asks first, below). Any non-person principal — agent, system and connector keys — gets 409 schedule_runs_as_shared_person before the scheduler is called.
  • MCP trigger_agent_schedule reports already_running only for the real running-lock 409 ({"detail": "Schedule is already executing"}); any other 409 reaches the calling agent as {status: "refused", code, message, retryable: false} with the backend's code and message. The backend's scheduler relay likewise passes the lock text only for the scheduler's already_running and otherwise relays {code, message} (scheduler_conflict when the scheduler sent no code).
  • Audit: schedule_taken_over with the schedule, both creator ids, webhook revoked and delivery cleared.
  • Census and headers: agent_route_tiers.json lists the route as owner tier with standing work; routers/schedules.py gains its first-line # mcp: header (take-over is a human-only grant, refused to agent keys); test_ent164_self_change_grants.py classifies the route as person-only.

The Schedules tab shows the run tier, offers take-over and marks a restricted run

  • Row badge. "Runs without shell" next to the status, only when runs_as === 'shared_person' (owner and null show nothing; null means "not computed" and never reads as owner), with the server's reason and a creator line (created_by, else "You created this schedule"). The title row wraps, so the badge does not push the action icons off a 390 px screen.
  • Take over (only when can_take_over === true) opens ScheduleTakeOverDialog.vue on a deep copy of the read, so a list refetch while it is open cannot change what is sent. It shows the full prompt, allowed tools, model, validation and its prompt, the Workspace delivery, the webhook state (live, none, or "couldn't read; taking over revokes any webhook URL either way") and what the creator loses.
    • Another person's delivery gets radios with "Stop delivering" preselected, reset for every version shown; the taker's own delivery reads "stays as it is". An unknown viewer email is never treated as the taker's own.
    • The request (stores/schedules.js → utils/scheduleRunTier.js::takeOverBody) echoes the reviewed copy verbatim, with clear or keep + the address for another person's delivery; with no decision it throws rather than send an undecided request.
    • "Take over" is marked destructive (focus starts on a safe control) and is enabled only while the shown version has can_take_over. Backdrop and Esc are blocked while the request is in flight.
    • 200 closes and reloads. A refusal that means the review is out of date — schedule_changed_since_review, schedule_not_restricted, schedule_delivers_to_another_person, or the schedule deleted — reloads the list and shows the current version (or disables Confirm when nothing is left to adopt); if that reload fails, the dialog says so instead of presenting the old version as current. Each code has words; a raw code is never shown. For a creator account that no longer exists, the review says so.
  • Run now (owner tier, on a shared person's schedule) goes through a confirm ("Run once with my access"): this one run has the clicker's access, and the scheduled runs keep the restricted access. A share holder cannot trigger at all, so they see no such prompt.
  • Create dialog: a share holder sees a notice that their schedule's runs will have their access, not the owner's. The save error renders a named 409's message (apiErrorMessage) instead of the raw object.
  • Restricted-run marker (RestrictedRunMarker.vue, badge or line, each surface with its own required testid) on the Schedules history and execution modal, the Tasks list and the execution page, read from turn_integrity.restricted_turn with a sentence by cause. A malformed record or an inherited key (toString, constructor) renders nothing rather than throwing in a list.
  • A refused toggle, delete or run names its reason. When the server answers a row action with a named refusal ({code, message}, such as the 409 above on enable), the row's error bar leads with that message instead of "Nothing was changed — try again", since retrying cannot succeed. Failures with no named refusal (network, 5xx) keep the old headline and their technical detail.
  • ownerTier prop on SchedulesPanel from agent.can_share (the flag the owner-only tabs use), defaulting to true so no false warning appears. Design-system tokens only; the ratchets are unchanged.

Docs

requirements/auth.md §2.12 and §2.12.1 (the run tier, the refusal texts, continuations, the stamp and alert, take-over, the UI) and requirements/scheduling.md; architecture/security.md §5g, api-endpoints.md, backend.md, execution.md, frontend.md and mcp-server.md; the operating-room, scheduling, task-execution, Tasks-tab and execution-detail feature flows and a row in the feature-flows index; the user doc automation/scheduling.md.

Tests

  • Run tier: test_ent926_turn_tier.py replaces the two tests that covered the unreadable-schedule rows with test_a_schedule_backed_turn_whose_schedule_cannot_be_read_is_never_owner_capable (15 cases) and test_the_route_answers_no_shell_for_a_turn_whose_schedule_cannot_be_read (3, with a channel-visitor control); test_ent926_agent_key_turn_scope.py adds test_a_schedule_backed_turn_whose_schedule_cannot_be_read_is_fenced_through_auth (2). New test_4281_turn_actor_frozen_matrix.py (rows × visitor_shell on/off over a spec'd fake that mirrors the real joins), test_4281_schedule_run_tier.py and test_4281_schedule_read_fields.py (real routers, get_current_user, JWTs and an agent key on the unit SQLite: the cause per row, the disclosure rules, the runtime refusal, query counts — a 20-row list costs what a 2-row list does, the fleet read the same on 3 and 30 agents — and a member creator).
  • Refusal texts: test_ent926_turn_tier_hook.py and test_ent926_runtime_turn_scope.py gain each cause (including schedule_unreadable fed with both kind: person and kind: visitor, proving the text keys on cause), the deny record's code and turn_kind, the shell-allowed guard, the label bounds and the hook/agent-server table parity.
  • Stamp and alert: new test_4281_restricted_run_stamp.py (the real apply_result and the pull sink on the unit SQLite) and test_4281_restricted_schedule_condition.py (the real schedules, ops and operator-queue routers, the internal handler, real JWTs and agent key, the real seam; four threads behind a barrier calling sync → exactly one row; a failing alert never failing a committed write; the take-over cases). Edited guards: test_2372_platform_alert_ack.py (the prefix is reserved) and test_3254_unended_kinds.py (the final kinds).
  • Continuations: test_4281_restricted_run_stamp.py adds test_a_continuation_of_a_restricted_run_gets_the_schedule_text (×4, one per continuation trigger: the answer equals the continued run's), test_a_continuation_of_a_restricted_run_is_stamped (through the real apply_result, naming the continued run's schedule), and three controls: a continuation of an owner-tier run, of a person's chat, and of a turn that cannot be read. Red before the fix: 5 failed, 24 passed (the three controls among the passes).
  • Take-over: new test_4281_schedule_take_over.py (61; only the scheduler hop and the audit sink replaced): the edited prompt after the review, a prompt changed without touching updated_at, each echoed field differing, and a write landing between the snapshot and the UPDATE (each 409, the new prompt not adopted); the delivery rules; the bound creator writes, each race test asserting that its hook fired inside the targeted DB method — the race tests patch the module dict the live db method resolves its globals in, so they hold after a test that evicts sys.modules entries (test_1595 first: 2 failed before, 72 passed after); Run now for agent and system keys; the relay's three conflict shapes; the lock detail pinned to the MCP server's constant. New src/mcp-server/src/tools/schedules.trigger-conflict.test.ts (7).
  • UI: new scheduleRunTier4281.spec.js, schedulesPanelRunTier4281.mount.spec.js (mounts the real SchedulesPanel), restrictedRunMarker4281.mount.spec.js (the marker plus the real TasksPanel and ExecutionDetail).

Validation on this branch, after merging dev at 0134633ce (macOS, Python 3.12, backend tests in fixed order unless a seed is named):

Mutation: the continuation fix was written test-first: test_a_continuation_of_a_restricted_run_gets_the_schedule_text ×4 and test_a_continuation_of_a_restricted_run_is_stamped are red without it (the answer's cause is null; the run carries no stamp) and green with it. A first version of the fix that read the continued run for the rating but not for the record's schedule_id stamped __manual__, and test_a_continuation_of_a_restricted_run_is_stamped caught it. The rest of the change's tests were mutation-checked when it was first built: with turn_tier_service.py restored to the base, the 20 new run-tier cases go red; with the hook and turn_scope.py restored and the new tests kept, 44 fail on the behaviour (the 22 that pass are the skew guards); the stamp, alert, take-over and UI tests were red on the base. Those mutation runs were not repeated on this branch.

Unverified: the manual UI sign-off (pending, below); the full unit suite and the CI matrix (CI); CodeQL over the whole tree and over JavaScript/TypeScript (CI's CodeQL is the check; the local run covered the changed Python files only); PostgreSQL-parametrized unit tests for get_agent_owners, get_users_by_ids, reassign_schedule_creator and the bound creator writes; a live stack on this branch (see below); an agent image from this PR against a backend without the run-tier answer fields (the byte-for-byte skew is pinned by unit tests); a continuation of a restricted run end to end on a live stack (unit-tested through the real apply_result only).

Earlier live run

The change was run on a production-image stack (PostgreSQL 16, Redis with ACL users, two backend workers, real agent containers on Claude Code CLI 2.1.281) when it was first built, on a tree that also held #4425's change. It has not been re-run on this branch. What that run showed, for the parts this PR keeps:

  • Run tier: a share holder's create answered runs_as: shared_person and created_by: null in their own view; the owner's view showed created_by; /api/ops/schedules and MCP list_agent_schedules (user key) carried the fields. During a share holder's cron run the turn-tier answer carried cause: creator_not_owner_tier, the schedule name, the creator label and the remedy, in 142 bytes. For a schedule-backed run whose schedule could no longer be read, the turn-tier route answered {"tier":"share","kind":"person","shell":false,"cause":"schedule_unreadable",…} and the agent key got 403 on an owner-tier route during that run. On a Gemini agent an enabled create and a switch-on were refused 409 schedule_cannot_run_for_creator_on_runtime; the same create on a Claude Code agent was 201.
  • Refusal texts: on a share holder's cron run, Bash, an owner MCP tool and Write ~/CLAUDE.md were refused with "This run is the scheduled task 'p-sched-1', not a chat …", naming the creator; none said "shared with". A Gemini agent's share-rated cron run failed with the schedule, creator and take-over text. An owner chat or task kept the shell; a shared person's chat still got the "shared with" text.
  • Stamp and alert: a share holder's create filed one owner-only row naming them; they and another share holder saw none; a second enabled schedule kept one row, now naming both. The share holder's cron run ended success with turn_integrity.restricted_turn.cause = creator_not_owner_tier; the owner's own schedule run kept turn_integrity null. Disabling both schedules ended the row; re-enabling filed a new one; an admin's pause and resume did the same.
  • Take-over: can_take_over: true for the owner; take-over → 200, runs_as: owner, webhook revoked; an agent key → 403 person_required. REST Run now with the agent key and the system key → 409 schedule_runs_as_shared_person; MCP trigger_agent_schedule with the agent key → {"status":"refused","code":"schedule_runs_as_shared_person",…,"retryable":false}. reassign_schedule_creator's outcomes and the share holder's update, delete and webhook mint ran on PostgreSQL. Take-over ended the alert row; taking one of two schedules kept the row for the other. An edit between open and confirm → 409 schedule_changed_since_review; an in-flight run → 409 schedule_run_in_progress; a deleted schedule → 404; a delivery to the share holder's Workspace → 409 schedule_delivers_to_another_person, then clear → 200.

Pending

  • Manual UI sign-off on this branch: the row badge and reason, the take-over review (including the 409 paths above, the delivery radios and the webhook line), the Run-now confirm, the share holder's create notice, and the "ran without shell" marker on the Schedules history, the Tasks row and the execution page — both themes and phone width. The PR stays a draft until it is given.

Unfiled follow-ups

  • The ops emergency-stop resume re-enables schedules without the runtime check. A shared-person schedule on a Gemini or Codex agent can be switched back on that way although create and enable refuse it.
  • A schedule whose creator is a registered member reads runs_as: owner with cause creator_owner_tier, whose message says "created by the agent's owner or an admin" — the tier is right, the text is not.
  • turn_tier_answer reads the schedule twice per hook call — one read would save a query on every guarded tool call of a shared-person schedule run.
  • The recreate remedy entries in the hook, the agent server and the alert texts are never sent by the backend now that the remedy is take_over.
  • Webhook context is built and then dropped before the scheduler call (routers/webhooks.py).
  • OWNER_ONLY / SEARCH_OWNER_ONLY say "a person the agent is shared with" to a channel visitor whose path is denied — predates this PR.
  • Admin schedule recovery (routers/admin_recovery.py recover_schedule) does not decide the alert — it heals at the next dispatch.
  • A sync that read before a disable can file after the disable's clear — the row then stays until the next write for that creator.
  • person_ending_is_final consults only the newest person ending per subject, and retention prunes final endings — shared by every final kind on the seam.
  • One extra get_execution per terminal on every run, schedule or not (cost nit).
  • The scheduler releases a schedule's run lock once a manual trigger is dispatched, so already_running only fires inside the short dispatch window (src/scheduler is unchanged here).
  • The webhook route maps every scheduler 409 to already_running (routers/webhooks.py).
  • Bind the webhook secret and revoke writers and the webhook read to the creator, as update, delete and mint are here.
  • An MCP take-over tool for user keys.
  • _is_person in the schedules router duplicates the person half of dependencies.person_or_capability_admits.
  • SchedulesPanel.vue still makes its other calls through raw axios (predates this PR).
  • The schedule row's text column is narrow at phone width, because the action icons take a fixed share.
  • test_ent926_agent_key_turn_scope.py defines test_an_unreadable_ledger_fails_closed twice, so the first definition never runs — predates this PR.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • My code follows the project's style guidelines
  • I have updated the documentation (if applicable)
  • I have not committed any sensitive data (API keys, credentials, etc.)
  • My commits are signed off (git commit -s) — required for contributors outside the core team
  • If this PR was written with an AI assistant, I say so above, and I have read and can explain every line
  • I have added appropriate logging for new functionality

Journey Impact

Journey Impact: extends: J05

… take it over, and a restricted run is named, marked and alerted (#4281)

A schedule created by someone who is neither an admin nor the agent's
owner runs every time as a shared person: no shell, no owner-added MCP
servers. Nothing said so, and the run still ended `success`.

- Every schedule read (list, get, create, PUT, enable, disable and
  GET /api/ops/schedules) carries runs_as, runs_as_reason,
  created_by_you, created_by and can_take_over, from one rule,
  turn_tier_service.schedule_run_tier, which turn_actor also reads.
- The turn-tier answer names the cause, schedule, creator and remedy,
  and the hook and the Gemini/Codex refusals say the run is a scheduled
  task, not a chat.
- Each restricted schedule run records turn_integrity.restricted_turn;
  one schedule_runs_restricted operator-queue row per agent and creator.
- POST /api/agents/{name}/schedules/{id}/take-over lets the owner or an
  admin adopt the schedule in place, human-only.
- A shared-person schedule is refused at create and enable on Gemini and
  Codex agents (409 schedule_cannot_run_for_creator_on_runtime).
- The Schedules tab shows the run tier and the take-over review; the
  Tasks list and execution page mark a restricted run.

No schema change.
- The frozen turn_actor matrix pins the project_steward trigger, which
  dev added to OWNER_CONFIGURED_TRIGGERS (trinity-enterprise#1236).
- The operator-queue package's __init__.py stays at 800 lines with the
  schedule-restricted- prefix in its three tuples.
- The take-over race tests patch the module the live db method resolves
  its globals in, so they still fire after a test that evicts
  sys.modules entries (test_1595 ran first: 2 failed, now 72 passed).
…e schedule and is stamped (#4281)

A continuation turn (caller_wake, operator_response, operator_ending,
skill_gate) is rated as the turn it continues (trinity-enterprise#1225).
When that turn is a share holder's schedule run, the turn-tier answer
must carry the same cause, schedule, creator and remedy, and the
continuation's run must record restricted_turn. Red: the answer's cause
is null and the run carries no stamp.
…he run it continues (#4281)

trinity-enterprise#1225 rates a continuation turn (caller_wake,
operator_response, operator_ending, skill_gate) as the turn it
continues, but the turn-tier answer's schedule fields and the run's
restricted_turn stamp read the continuation row itself. Such a turn got
the old "shared with" refusal text and no stamp.

turn_tier_service.rated_turn returns the row the chain leads to, the
same chain _rate follows; run_schedule and turn_schedule_detail read
it, and run_restriction names that row's schedule. A link that cannot be
followed names no schedule, as before.
…by Vector (#4281)

The _log docstring said /logs/guardrails.jsonl reaches Vector. Vector's
only source is docker_logs (container stdout and stderr), and /logs is not
mounted out of the agent container, so nothing collects the file.
… docs and comments describe behaviour only (#4281)

- feature-flows.md gets a row for the schedule run tier, take-over and
  the restricted-run marker and alert.
- Requirement status for §2.12.1 moves to implemented.
- Docs, comments, test docstrings and registry descriptions drop
  cross-references that only made sense while the change was in
  progress, and the scheduling flow drops a "not yet wired" note the
  take-over write already covers. No behaviour change.
…n both don't fit (#4281)

The row's text column can't be narrower than its widest unbreakable piece,
and the "Runs without shell" badge never wraps. In DejaVu Sans, the CI
runner's sans-serif, the badge is 131px. At 390px in light mode, Linux
Chromium's 15px scrollbar leaves 109px beside the action icons, so the
column held its 131px and pushed Delete 5px past the card. Dark mode's
8px scrollbar left just enough room, and macOS (SF, overlay scrollbars)
passed, which is why only the light run failed.

The row now wraps: the icons stay beside the text while both fit and
move onto their own line, right-aligned, when they don't. The decision
follows the content's width, not a breakpoint, so it holds at any
width and for any font. A name with no break opportunity breaks
anywhere instead of holding the column open.

The narrow-row spec now also covers 320px and a long unbroken name, and
checks that each row's name stays inside the row. Before this change it
fails on macOS as well as Linux.
…son, not 'try again' (#4281)

A named refusal ({code, message}) is the server declining on purpose, such
as the 409 for a schedule whose runs this agent's runtime cannot give, so
retrying cannot succeed. The row's error bar now leads with the refusal's
own message. Failures with no named refusal (network, 5xx) keep the
'Nothing was changed - try again' headline.
@github-actions

Copy link
Copy Markdown

⚠️ Live-instance suite skipped — merge conflict against dev.

Resolve by merging dev locally and pushing the result; the next nightly re-tests.

This branch has not been deployed

No deployments
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.

1 participant