Repository navigation
DO NOT MERGE — merge train: 4676,4679,4677,4699,4669,4527 - #4705
Closed
trinity-ability wants to merge 25 commits into
Closed
trinity-ability wants to merge 25 commits into
trinity-ability wants to merge 25 commits into
Conversation
iOS Safari zooms the page in when a focused field's text is under 16px and leaves it zoomed after blur. Trinity's filters, search boxes and composers use text-xs / text-sm, so on a phone most text fields zoomed the layout sideways (4-5 such fields on Operations > Executions, Events and the Tasks tab). Below sm on a touch screen, text inputs, selects and textareas render at 16px. The desktop keeps its dense sizes. Tests: e2e on a 390px touch screen finds no text control under 16px on Operations, Events and Tasks; on the desktop the dense controls stay.
…om spec in CI (#4526) - Key the 16px form-control rule on (pointer: coarse) alone so an iPhone in landscape (667-932px wide) doesn't zoom on focus either. - Give the chat composer's ghost-text overlay the same 16px under the same media query, so the completion stays on the typed text. - Give a text-xs textarea text-sm's 20px line-height at 16px text. - Tag the agent-free cases of e2e/phone-input-zoom.spec.js @smoke so CI runs them, and add landscape.
One GET /api/enterprise/client-portal/asks took 0.45 s for 63 rows on a hosted instance. Reproduced on a seeded SQLite (65 rows over 13 agents): 276 queries, 319 ms. The per-row and per-agent sources: - the roster re-check ran both roster queries once per agent (_on_roster -> agent_on_roster -> roster_agent_names); - _platform_username read the viewer's own users row once per row; - is_aged read the aging-hours setting once per row (not named in the issue: 65 of the 276 queries); - a gate approval read its record, the viewer's user row and their access to two agents per row (card_view, _openable_run); - a replaced / replacing ask read the row it links to, per row; - a shared ask someone else answered read that person's users row. After: 12 queries, 19 ms, and the count is the same at any size. The fix is the shared one #4672 asks for, used here first: - utils/request_memo.py: inside a scope() a @memoized leaf read runs once per distinct arguments; outside one it is the plain function. Failures are never remembered, the key carries every argument, and the memo is dropped when the scope exits. - db batch readers (get_users_by_emails, get_agent_owners, agents_shared_with_user, get_gate_requests, get_operator_queue_items_by_ids) answer the per-item read for the rest of the scope, so can_user_access_agent, card_view and _project are unchanged and still decide everything. - list_asks_page runs in one scope and prefetches once per kind. Visibility is unchanged and pinned: _on_roster is still asked per agent and fails closed per agent, a revoked share hides only that agent's asks, and an unreadable roster or queue is still AsksUnavailable (503), never an empty list. tests/query_counter.py is the reusable helper (#4672's guard AC): it counts the statements a block runs on the active engine. Related to #4671 Related to #4672 Co-Authored-By: Claude Fable 5.2 <[email protected]>
#4671 measured /health over 150 ms in 24 of 1,500 samples on a hosted instance, worst 1.5 s, clustered near the minute mark, with nothing in the logs to say why. /health does no I/O on PostgreSQL, so that latency is the event loop's lag: sync work ran on the loop. An audit lists hundreds of candidates; it cannot say which one ran at :58. services/loop_health.py says which, from inside the process: - The probe: a coroutine sleeps 50 ms and measures how late it woke. A daemon thread watches its last wake-up and, once the loop has been silent past EVENT_LOOP_STALL_THRESHOLD_MS (250), snapshots the loop thread's stack. When the loop returns, one event_loop_blocked warning carries the blocked ms, the worker pid and that stack. A stall still going after 5 s is reported before it ends. Code locations only: never a local or an argument. - tick(name) times one cycle of a background loop and logs loop_tick_slow past LOOP_TICK_WARN_MS (250). Wrapped: capacity maintenance, heartbeat watch, operator-queue sync, monitoring, sync health, and the 5 s loop due-run sweep. - Numbers (lag, 60 s max, 10 min stall count, per-loop tick times) are on GET /api/telemetry/host -> backend, for the worker that answered. Runs in every worker with no lease, by design: a worker can only measure its own loop. Also: the uvicorn worker count is BACKEND_WORKERS in the prod and hosted compose files, default 2 (unchanged), with a note on what scales per worker (the background loops, the PostgreSQL pool). This does not fix the stall. It is the "measure first" step: one stall on an instance running this build is the attribution #4671 asks for. Related to #4674 Related to #4671 Co-Authored-By: Claude Fable 5.2 <[email protected]>
CI's regression diff named two guards the first commit tripped: - test_3785: a submodule of operator_queue_service may import nothing the package __init__ has not imported first, and __init__ is at its 800-line cap. So the aging-hours memo moves one layer down, onto db.get_setting_value — the read `aging_hours` makes — and rows.py is back to its original imports. Same single query per request. - test_ent715: every DatabaseManager accessor over operator-queue rows must be classified. get_operator_queue_items_by_ids is a row accessor (the batch form of get_operator_queue_item) and its one reader, asks `_prefetch`, is `internal`: the rows are returned to nobody there; what leaves is still only what `_linked_request_id` decides. Related to #4671 Co-Authored-By: Claude Fable 5.2 <[email protected]>
A submodule of operator_queue_service may import nothing the package __init__ has not imported first (test_3785), and __init__ is at its 800-line cap, so the tick timer is imported in _poll_loop rather than at module level. Related to #4674 Co-Authored-By: Claude Fable 5.2 <[email protected]>
The class #4671 found in `asks`, in the other hot lists. Each is fixed the same way: the predicate is unchanged and still decides; it is asked inside one request_memo.scope() after one batch read per kind. - Rank 1, Workspace roster: `may_manage_canvases` per agent re-read the caller's user row and one owner row each (`canvas_managers`). - Rank 2, operator queue: a gate approval card read its record, each approver's name and the viewer's access to two agents, per row. `skill_gate_service.prefetch_cards` is shared with the asks list. - Rank 3, /api/ops/fleet/status: agents are read concurrently, each under a 3 s bound, 10 at a time; owners are one read. - Rank 4, loops list: one runs query for the page, not one per loop. - Rank 5, autonomy-status: owners and the caller's shares read once. - Rank 6, context-stats: the cache TTL (20 s) outlives the 15 s poll, and a non-admin keeps their own entry instead of fanning out on every poll. Cached rows are still filtered to current access. - Rank 7, Work feed: one timeout read for the agents, one execution read for the live turns on shared agents. - Rank 8, schedules list and rank 9, evaluations: one memo scope. New db batch readers: get_execution_timeouts, get_executions_by_ids, list_loop_runs_for_loops. Each returns what its per-item twin returns. Stacked on #4676 (the memo and the query counter). Related to #4672 Co-Authored-By: Claude Fable 5.2 <[email protected]>
…global (#4674) Four capture tests replaced services.loop_health.format_stack with monkeypatch and passed locally, but failed in CI's seeded run: by then the module object the test held was not the one the probe's methods resolve their globals in, so the patch never reached check(). The probe now takes read_stack as a constructor argument (default: the loop thread's stack), and the tests hand in their own. No behaviour change. Related to #4674 Co-Authored-By: Claude Fable 5.2 <[email protected]>
Review finding. #4671 and #4674 both measure /health against 150 ms, but the probe only logged a block past 250 ms, so a sample that failed the acceptance check could leave no line saying why. Default is now 150 ms; EVENT_LOOP_STALL_THRESHOLD_MS still overrides it. Related to #4674 Co-Authored-By: Claude Fable 5.2 <[email protected]>
…it (#4674) Found by running it on a live instance: a 159 ms block against the 150 ms threshold was reported as 'stack not captured'. The watch thread looked every 50 ms and only snapshotted once the loop had been silent for the whole threshold, so a block that ended just past it was over before the next look. The stack is now taken at half the threshold and the watch thread looks at least six times per threshold. Whether a block is reported still depends only on how long it turned out to be; an early capture of a block that ends under the threshold is discarded. Related to #4674 Co-Authored-By: Claude Fable 5.2 <[email protected]>
Found on a live instance: a sync HTTP call on the loop was reported as twelve frames of urllib3, http.client and email.parser, with the Trinity caller cut off. The stack is now 40 frames deep. Related to #4674 Co-Authored-By: Claude Fable 5.2 <[email protected]>
…f null
The agent health detail handler used a truthiness test for the 24h
figures, so a measured 0.0 came back as null ("never measured"). Use
'is not None' so only a missing measurement is null.
Fixes #4685
Signed-off-by: Alex Castillo <[email protected]>
…cal, per the merge-train note on the PR Co-Authored-By: Claude Opus 5.5 <[email protected]>
….json) into #4679 — mechanical Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cal, per the merge-train note on the PR Co-Authored-By: Claude Opus 5.5 <[email protected]>
…'s dev Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 21, 2026
This was referenced Nov 21, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Integration surface for #4676, #4679, #4677, #4699, #4669, #4527. Never merged; members merge individually once green. #4680 merges after them, alone, with its baseline regenerated.