Skip to content

DO NOT MERGE — merge train: 4467,4468,4466 - #4480

Closed
trinity-ability wants to merge 29 commits into
devfrom
train/20261111-1719
Closed

trinity-ability wants to merge 29 commits into
devfrom
train/20261111-1719

Conversation

@trinity-ability

Copy link
Copy Markdown
Contributor

Integration surface for #4467, #4468, #4466. Never merged; members merge individually once green.

🤖 Generated with Claude Code

Trinity Agent (trinity) and others added 29 commits November 11, 2026 00:53
…eing swallowed (abilityai/trinity-enterprise#1220)

`_maybe_invalidate_rosters` skipped a slot whose roster refresh was already
in flight. When that read ran before a share committed, the share's
`agent_shared` was lost and the slot kept the smaller roster until an
unrelated access change happened to refresh it, so every allowed event about
the newly shared agent was withheld. The slot now carries `refresh_again`,
set on a skipped invalidation; `_refresh_slots` repeats its read until no
mark is left.

Tests: tests/unit/test_1220_ws_roster_share_refresh.py — the in-flight case
went red on today's code (roster stayed empty), green with the fix; the
share-event contract for a Workspace-only slot is pinned alongside it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y refusal names why (abilityai/trinity-enterprise#1221)

send_message(channel="web") was a stub that always refused, and auto
dropped every channel's reason, so a person who works only in the
Workspace was unreachable and the agent was told only "not found".

- web writes one assistant row (source="proactive") into the person's
  Main conversation with the agent, through the reachability gate the
  scheduled Workspace delivery already used (now extracted as
  check_workspace_reachable / resolve_main_destination, behaviour
  unchanged). Only the agent's own key may write there, never from inside
  the recipient's own Main turn. The row id derives from the effect
  identity, so a retry after a post-commit failure writes nothing new.
- the result says delivery="workspace_inbox": delivered, nothing
  notifies them.
- every channel's refusal carries a stable code; the 404 detail carries a
  {channel: code} map for role- and email-addressed sends alike (codes
  only, never an address).
- the agent's next turn is told the row as a between-turns message.
- reachable_channels(): the local, read-only answer the Execution Context
  will use, built from the same predicates as the send.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ry "permitted" (abilityai/trinity-enterprise#1221)

Consent is not reachability. The assignment seam accepts a fifth,
bool-only key, proactive_reachable; with consent but an explicit False the
Primary human line says no channel reaches them, instead of "proactive
contact permitted". None (unknown, or a provider that predates the key)
renders exactly as before, and a non-bool is dropped like consent's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…space delivery honestly (abilityai/trinity-enterprise#1221)

The tool matched "404" and answered a hardcoded "They may not have
Telegram or Slack configured", discarding the backend's reason. It now
reads ApiError.body first, before any substring check, and returns the
detail's code, message and per-channel reasons (with not_authorized /
recipient_not_found / seat_unfilled). The plain-string agent-access 404
stays not_authorized. A web success carries delivery=workspace_inbox and
a note that nothing notifies the person; the descriptions say web is the
person's Workspace conversation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng one event (abilityai/trinity-enterprise#1220)

A send held while the member's assistant is starting went out only on the
`member_progress_update` event; one lost event stranded the words for the
full three minutes and then handed them back although the assistant was
ready.

- While a send is held the card is re-read every 30 s, and once more at the
  ceiling before the words are handed back. Only a read that says ready
  sends; starting, failed, a failed read or a missing step hand back. A flip a
  re-read caught logs a console warning: the event did not arrive.
- One consumer (`takeHeldSend`): the watch and the hand-back continuation can
  both see the flip, and exactly one sends.
- Leaving the chat mid re-read sends nothing; the words stay the draft.
- `portalProgress.fetchProgress` returns the read already in flight instead
  of an early `undefined`, so an awaited re-read is a real read.

Tests: portalMemberHeldSend.mount.spec.js 13 (4 new cases red before the
fix). Mutations, each restored byte-identical: dropping the in-flight return,
the unmount flag, the single-consumer check, or the poll each turns its named
case red. Raw colors on PortalConversation.vue unchanged (0 non-gray, 85
gray, 0 hex).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ations re-read (abilityai/trinity-enterprise#1220)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… boot (#4442)

Adds services/agent_model_seed: declared_model (runtime.model, else a
top-level model:), the fill-blank seed, and a one-shot boot pass that
writes a NULL default_model from the container's AGENT_RUNTIME_MODEL,
else from the running agent's template.yaml. Writes go through
set_default_model_if(name, None, ...), so a value another writer set
is never overwritten and concurrent workers make one write; only a
value unrunnable_reason passes is written. docker_service gains
read_runtime_model, which returns that one env key and logs failures
by type only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…4442)

_register_agent writes default_model from the request's runtime_model or
the model the template declares (runtime.model, else a top-level model:).
Both template paths feed it: the github: path never set runtime_model, so
its agents' AGENT_RUNTIME_MODEL stayed empty and their wakes ran on the
platform default. Fill-blank and catalog-gated; never fails a creation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
)

PUT /api/agents/{name}/model kept the value in the container's memory
only, so the turns the platform starts never saw it and a restart lost
it. On a Claude Code agent the accepted value is now stored as
default_model and audited (update_agent_model). The agent stays the
judge of the value (#3677); a failed store after the agent accepted
answers 500 model_not_saved instead of a silent split. Route tier
unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A sync /chat that names no model left the choice to the container's
in-memory value, which falls back to its env after a restart, and left
model_used empty. build_chat_payload now resolves it through
resolve_default_model (fail-open: on an error the agent decides, as
before) and stamps it on the row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…4442)

53 unit tests: the declared-model parse; the create seed for a template
declaring a top-level model:; the boot fill (env, then the live
template.yaml; one write across racing workers; the env never logged);
the PUT store, refusal, failed-save and non-Claude cases; push /chat
resolution and stamping; per-kind execute_task resolution; pinned
models win; an AST guard that the wake producers pass no model.

Mutations shown red: dropping the PUT store, the boot fill's template
fallback, the create seed's declared model, the push /chat resolve, or
making execute_task resolve unconditionally.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a turn's answer (abilityai/trinity-enterprise#1221)

latestTypedReply / typedReplyCount excluded only source === 'voice', so a
proactive row (or a completion report) landing in Main while the person
waited on a turn was shown as that turn's reply. Typed is now !source,
matching the backend's _TYPED = "source IS NULL".

Red: portalProactiveRowNotAReply.spec.js, 3 of 4 cases fail with the
predicate reverted; all four pass with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lds the new reason code to its rule (abilityai/trinity-enterprise#1221)

- proactive-messaging flow: web is the person's Workspace conversation (no
  longer "v2 deferred"), the named per-channel refusals and the 404
  channels map, delivery=workspace_inbox, reachable_channels. Requirements:
  a public-access entry, and the fifth seam key proactive_reachable in
  infrastructure 12.6.2.
- test_ent1117_s13: ChannelDeliveryError now carries reason= (a code that
  can reach the 404 body through the channels map). The guard refused any
  keyword and went red on dev's branch; it now admits only `reason`, held
  to the same constant-or-listed-platform-param rule as the sentence, and
  the stale-exemption check reads keyword values too. A reason built from
  client_id fails it (2 red), restored.
- pin: an intent-key repeat of a web send writes no second row and no
  public_chat note.
- registry entry for test_ent1221_web_delivery.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… once it settles (abilityai/trinity-enterprise#1220)

A forced read (the member-ready event's, the held send's hand-back) used
to join a poll read already in flight, which may have been issued before
assistant_ready went done. It now chains one re-read after that read
settles, shared by every forced caller. Unforced callers still join.

Red without the fix: 'a forced read during an in-flight read re-reads
after it settles' (1 GET, expected 2).

Also corrects the _maybe_invalidate_rosters docstring: a missed unshare
or delete leaves the roster larger, not smaller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed Settings save puts the old model back (#4442)

Review fixes I1 and I2 (chain-hub-p1-4442-fix).

I1: a Settings pick made before #4442 lived only in agent memory, and
push /chat now always sends the resolved model, so a fill from the env
or template would have overridden that pick. fill_blank_default_models
now asks a running agent's GET /api/model first, then the container env,
then template.yaml. The allowlist (unrunnable_reason) and fill-only-NULL
(set_default_model_if) guards are unchanged.

I2: model_not_saved said the agent "now runs" the new model, but backend
turns send the stored value. set_agent_model reads the agent's model
before the PUT, and if the store fails it puts that model back, so the
agent and the column agree. The message names the model the agent keeps
running; `restored` says whether the put-back held, and the message
changes when it did not.

Mutation: with both fixes reverted, five new tests went red:
test_boot_fill_takes_the_running_agents_live_model_over_its_env,
..._falls_back_to_env_then_template_..., ..._keeps_the_allowlist_...,
test_a_failed_save_puts_the_agents_previous_model_back,
test_a_failed_save_that_cannot_be_put_back_says_so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ows (abilityai/trinity-enterprise#1221)

The web row id was derived from the effect identity minus the requested
channel, while the effect guard keys on it. auto then web in one execution
were two effects sharing one row id, so the second reported success and
add_portal_message_once wrote nothing. The requested channel is now in the
id material.

Red before the fix: test_auto_then_web_in_one_turn_are_two_rows (identical
message_id for both sends).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… (abilityai/trinity-enterprise#1221)

reachable_channels probed WhatsApp, but send_message accepts no whatsapp
channel and auto never tries it. A WhatsApp-only person was reported
reachable, so the Execution Context told the agent proactive contact was
possible when every send would be refused. The probe is dropped and the
feature flow sentence corrected.

Red before the fix: the WhatsApp-only row of
TestReachability::test_reachable_channels_agrees_with_the_send
({'whatsapp'} not a subset of {'telegram','slack','web'}).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#4442)

When the request names no model, push /chat now sends the resolved model
only when it is the agent's own stored value the catalog accepts. With
nothing stored, or a stored value outside the catalog (Settings accepts
any claude-* id the agent takes, e.g. claude-sonnet-4-6[1m]), it sends
none and the agent stays on its own model, as before #4442, instead of
being moved to the platform default. What Settings accepts is unchanged.

Red before the fix: test_push_chat_leaves_a_stored_model_outside_the_catalog_to_the_agent
and test_push_chat_with_no_stored_model_leaves_the_model_to_the_agent
(payload carried the platform default claude-sonnet-4-6).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r declares its MCP surface (abilityai/trinity-enterprise#1221)

A person's key sending channel=web is refused with web_agent_only and writes
no row; the agent's own key delivers. Mutation: forcing the route's
as_agent_key=True turns test_a_persons_key_is_refused_and_the_agents_own_key_delivers
red (200 == 404).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…orkspace-member

# Conflicts:
#	tests/registry.json
#4426 landed the same in-flight roster re-read on dev, so dev's
src/backend/services/event_bus.py is taken whole. In integrations.md
dev's text already describes the queued re-read; only the
share-writer broadcast rule is re-applied on top of it.
test_1220_ws_roster_share_refresh.py passes against dev's event bus.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… no principal (#4442)

The startup model seed reads the live roster on nobody's behalf and only
fills blank model values, so it selects no fleet for a caller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…4442) — mechanical

build_chat_payload imports services.ask_service and
services.operator_queue_service.deps lazily; each binds `from database import db`
at import time, so first-importing them under patch("database.db", mock) left the
mock bound for the session and broke test_ent872_fleet_reach's operator-queue
reach test whenever 4442 ran first (seed-dependent red).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… — Gate 1 decision

The running agent's GET /api/model is whatever the last /api/chat turn sent,
which before #4442 could be the platform default; trusting it first would store
the cheaper model as the agent's own permanently. Order is now env, then
template.yaml, then the live model only when neither declares one. Tests pin the
order (both go red on the previous order).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	tests/registry.json
@vybe vybe added the ui PR touches the frontend UI — triggers Playwright e2e tests label Nov 11, 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.

2 participants