Skip to content

DO NOT MERGE — merge train: 4720,4718,4721,4648,4680 - #4722

Closed
vybe wants to merge 28 commits into
devfrom
train/20261122-1848
Closed

vybe wants to merge 28 commits into
devfrom
train/20261122-1848

Conversation

@vybe

@vybe vybe commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Integration surface for #4720, #4718, #4721, #4648, #4680. Never merged; members merge individually once green.

🤖 Generated with Claude Code

AndriiPasternak31 and others added 28 commits November 18, 2026 00:35
… 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.
A sync db, Docker, HTTP or sleep call written directly inside an
`async def` runs on the event loop and blocks the whole worker.
scripts/ci/check_sync_on_loop.py counts them per file by parsing (never
importing) and compares with scripts/ci/sync_on_loop_baseline.json:

- a file's count may not exceed its entry;
- a file with no entry starts at zero;
- an entry above reality fails too, so a paydown lowers the baseline.

Today: 1,911 call sites in 831 async functions across 194 files
(db 1,363; through a module's own sync function 386; Docker 161).

Counted: db / core_db / _db / *.db method calls, get_agent_container,
list_all_agents_fast, agent_container_states, time.sleep,
subprocess.run, requests.*, and calls to the same module's plain defs
that make one. Not counted: plain def handlers, nested defs, and the
arguments of to_thread / run_in_executor / run_in_threadpool.

The ratchet runs in the unit suite (test_4674_sync_on_loop_ratchet.py).
The helper list is one constant, for trinity-dev#82 to share.

Related to #4674

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…move (#4674)

Review finding. One test asserted that heartbeat_service's watch loop
and dependencies.py are in the scan. Those are exactly what #4674 goes
on to fix, so the test would have failed on the fix. It now asserts
only that the live scan sees both families. The backend is parsed once
per module instead of once per test.

Related to #4674

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…4674)

dev moved under the branch and changed two files' counts, which is the
ratchet doing its job on its own PR.

Related to #4674

Co-Authored-By: Claude Fable 5.2 <[email protected]>
…4679/#4677 (#4680)

Accepted growth, ruled at merge-train Gate 2 (2026-11-21):
- routers/setup.py 6 -> 9 (ent#1329 setup terms, #4683/#4694/#4698)
- client_portal/work/service.py 8 -> 10, agent_service/autonomy.py 12 -> 14
  (#4679's batch prefetch reads: fewer queries, more call sites)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the retired default

The image model was hard-coded to gemini-3.1-flash-image-preview, which Google
shut down. Move it to config.py as GEMINI_IMAGE_MODEL (env-overridable, same
pattern as GEMINI_TEXT_MODEL) and default to gemini-nano-banana-2.1. Wired into
all compose files and .env.example.

Signed-off-by: Alex <[email protected]>
…orm_health_check

perform_health_check built its 24h figures with a truthiness test, so a
measured 0.0 came back as None ("never measured") on POST
/api/monitoring/agents/{name}/check and the first-check path of the GET.
Use 'is not None', as #4699 did for the router's own builder.

Fixes #4702

Signed-off-by: Alex <[email protected]>
… (abilityai/trinity-enterprise#1343)

Operator ruling 2026-11-22: a build the assistant proposes always waits
for the owner's click on Build. The job card's "Create them here as soon
as they're ready" box is no longer ticked by default; ticking it still
creates the agents without a second click.

The line sent back to the assistant when a design is ready now says the
Build button waits for the person's click, rather than "the person chose
to look first".

Tests (assistantWidget.mount.spec.js, mounted): the box is unticked by
default, nothing is posted to /designs/{id}/build until Build is clicked,
and ticking the box still auto-creates. Red before the change (box was
checked), green after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	src/backend/database.py
#	src/backend/db/agents.py
#	src/backend/db/users.py
#	src/backend/routers/schedules.py
…anical, per the merge-train note on the PR

- tests/unit/test_4702_perform_health_check_zero.py: register the module under test with
  monkeypatch.setitem instead of a bare sys.modules write (lint_sys_modules.py: 0 -> 1 violation)
- docs/memory/learnings/: fragment for the truthiness-zero class (#4685, #4699, #4702)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Eugene Vyborov <[email protected]>
…chanical, per the merge-train note on the PR

- feature-flows/image-generation.md, agent-avatars.md: name the configurable image model
  instead of the retired Gemini 3.1 Flash Image Preview; list GEMINI_IMAGE_MODEL in Configuration
- .env.example: the override comment covers the third var and its different default
- test_image_generation_service.py: the comment cites #4717 (was the nonexistent #4949)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Eugene Vyborov <[email protected]>
…4281) — mechanical, per the merge-train note on the PR

The two db.get_schedule calls in the new async take_over_schedule route move to
asyncio.to_thread, so #4674's sync-on-loop ratchet (#4680) holds on schedules.py
(40 -> 38, the baseline) once both PRs are on dev.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vybe vybe added the ui PR touches the frontend UI — triggers Playwright e2e tests label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ui PR touches the frontend UI — triggers Playwright e2e tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants