Repository navigation
Conversation
…ai/trinity-enterprise#549) `agent_shared_files` was scoped by agent alone, so the Workspace Files tab listed every active share of an agent -- download link included -- to everyone on its roster: a file made in one person's chat appeared in another person's tab. Third occurrence of one class (asks, reports, now files): a table scoped by an owning entity gains a per-person dimension, and a reader written before the column cannot be neutral about it. A share now has an addressee. Three nullable columns on both migration tracks (`addressed_to_email`, `addressed_to_channel` -- display only --, `audience_source`); NULL email and NULL channel is the owner only, which is also what every existing row becomes, so there is no backfill. The platform decides the addressee; the agent does not choose. `services/turn_audience.py` keeps two questions apart. Given a turn, who is it for -- pure, table-driven over columns every entry path already stamps, with an allow-list of channels. And which turn did this call come from -- the hard one: an MCP call carries the agent's key and nothing about the turn, so the only link is an execution id the agent types, and a resumed session cites ids out of its own history (observed live: a turn 22 minutes old). The rule therefore needs positive evidence: only the agent's own key; the cited id must be this agent's; an agent-to-agent child is nobody; otherwise the id proves the CONVERSATION and never the person, and that conversation's running direct turns must agree on who it is. Every "could not tell" is the owner only, so the failure direction is under-share. The shortcut that must not come back is "the agent has exactly one running turn, so take it": a web-terminal session holds the agent's key, has no execution row, and would hand an operator's file to whichever client happened to be mid-conversation. On a channel turn the resolver reads `source_channel_client`, which the router now stamps only for a verified speaker in a one-to-one chat. In a group the verified email is the unlocker's, set once per group and not per speaker. - One override: `audience_email`, checked with the reader's own roster predicate; an off-roster address is refused by name and nothing is stored. - The addressee joins the effect key, so re-addressing a file within one turn is a second share rather than a silent replay; the key is hashed and the replay snapshot carries no address, so `idempotency_keys` never holds one. - The Workspace Files tab narrows in the query to the viewer, plus the owner-only rows for the agent's owner; an unidentifiable viewer matches nothing. The owner's Sharing panel lists everything, says who each file is for, and withholds the addressee from key-authenticated callers. - WhatsApp media and voice notes are addressed by the platform code that already holds the recipient. - `share_file` returns `visible_to_requester` / `visibility_note` (the names `set_canvas` uses) and never an address the platform resolved; the guidance lives in the tool description, since the prompt section is dropped at the minimal tier. Unchanged and stated: the `?sig=` link remains a bearer credential -- the audience governs the listing, not the download. Tests: 87 in tests/unit/test_ent549_file_audience.py, built on real-SQLite write-to-read round trips (every earlier share test mocked the persist step and every listing test seeded by INSERT, so nothing crossed write to read), plus mcp-server and frontend helper tests. 33 call-site mutations, all red, run in isolated scratch copies; the battery is what found a vacuous test (`column == None` compiles to `IS NULL`, and the table was empty). Fixes Abilityai/trinity-enterprise#549 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…d it as a secret CodeQL's sensitive-data heuristic classifies any identifier containing "trusted" as secret material. The unused slot for a platform-injected execution id was named `trusted_execution_id`, and that value reaches two existing log lines in `idempotency_service.resolve_and_validate_execution` that print an execution id -- so the first push raised two HIGH `py/clear-text-logging-sensitive-data` alerts on a file this change never touched. An execution id is not a secret; the alerts were true to the naming heuristic and false to the data. Renamed to `platform_execution_id` (and the local to `platform_turn`), which is also what the docs already call it. No behaviour change. A comment at the declaration says why, so the next reader does not name it back. Refs Abilityai/trinity-enterprise#549 Co-Authored-By: Claude Fable 5.1 <[email protected]>
A new data flow into an existing log line raises the alert on a file the PR never touched; the fix is a rename at the source, not a dismissal. Refs Abilityai/trinity-enterprise#549 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ives its lease (#2846) A pulled turn ran with the timeout copied onto its row at enqueue, while its lease was sized from the agent's timeout at claim. When the agent's timeout was lowered while the job waited, or the row carried no timeout (worker default 900s), a healthy turn could run past its lease and the reaper would hand the same execution to a second worker while the first still ran. claim_next_task now reads the agent timeout once and uses it for both the lease and the turn limit (absent -> the agent timeout). A clamped limit is logged, and a timeout failure on a clamped job names the shortened limit so the operator knows which setting to change. This replaces the lease-renewal heartbeat the design specified and never built: with the clamp a heartbeat has nothing to do for a healthy turn, and for a hung turn it would keep the lease alive forever. TARGET_ARCHITECTURE, MESSAGE_ENVELOPE_SCHEMA (section 3.5, OPEN-4), the reaper docstring and the timeout endpoint's docs are updated to match. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01UNS51H87HDMvtBVAZPiekJ
…on (#2846) The timeout note compared against the agent's current timeout, so a timeout lowered mid-run produced a false "shortened" claim; it now states the two numbers instead. The reaper docstring names the runtimes that enforce their own turn limit and the single-process assumption replicas would break. TARGET_ARCHITECTURE's open-question list no longer mentions lease renewal. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01UNS51H87HDMvtBVAZPiekJ
…it is verified through the agent server (#2938) `initialize_git_in_container` chose the repo root with a content probe: any non-empty `/home/developer/workspace` was treated as a legacy repo root, so an agent whose template ships files into `workspace/` got its brand-new repo created there. The agent server's git router reads exactly one root, `/home/developer`, so the next status poll answered `git_enabled: false` and Sync / Log / the git panel all reported "not enabled" — right after the init endpoint returned 200, because its verify ran in the directory the backend had chosen and could only agree with itself. - `_detect_git_dir`: a container with no repository answers `NEW_REPO_ROOT` (`/home/developer`) whatever `workspace/` holds; the pre-#2075 `_detect_git_dir_fallback` content heuristic is removed. An existing repo — a legacy workspace-rooted one included — is still wherever `git rev-parse --show-toplevel` finds it. - `initialize_git_in_container`: after the backend's own `git rev-parse --git-dir`, ask the agent server's `GET /api/git/status`. `git_enabled: false` fails the init with a named reason (the router answers 400 and rolls the config row back); an unanswerable probe (unreachable, non-200, not JSON) warns and keeps the backend verdict. - Tests: `test_2938_git_init_repo_root.py` drives the real init end-to-end with the exec and the agent-server call faked — placement with a populated workspace, no content probe, legacy re-init in place, and the three probe verdicts. Ten of eleven fail on the pre-fix code. `test_2075_detect_git_dir.py` updated for the retired fallback. Fixes #2938 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… of failing it after a backend restart (#2944) A synchronously dispatched turn — every trigger while DISPATCH_ASYNC is off, not only mcp/manual — returns its terminal on the held-open HTTP connection, and that coroutine is its only consumer. A backend recreate mid-turn destroys it: the agent finishes and bills, returns to a dead socket, and the watchdog skipped the row for one cycle (the #921 recently-completed marker, 300 s — exactly one cleanup interval) and FAILED it on the next with the #2433 orphan string, cost=NULL, response=NULL. Its only agent probe before the destructive write was /last-error; nothing asked for a result. Agent (docker/base-image/agent_server): - services/retained_results.py: every terminal exit of /api/task and /api/chat retains its envelope — the same typed shape the #1083 result callback POSTs (success / cancelled / HTTPException failure) — BEFORE the response is sent, under ~/.trinity/retained-results/<id>.json. Bounded: TTL 6 h, 50 newest files, transcript dropped past the callback's 16 MB cap. Same-id overwrite (the SUB-003 retry). Separate from pending-results on purpose: that directory's startup sweep re-POSTs to the callback, where a sync envelope is a permanent 409 and is deleted. - GET /api/executions/{id}/result serves it; the coded 404 {"detail":{"code":"no_retained_result"}} (for malformed ids too) is how the backend tells "asked, nothing there" from an older image's bare 404. Backend: - services/execution_envelope.py::terminal_from_callback_payload — the callback router's 3-way status map + auth-is-never-cancellation guard, extracted so the router and the watchdog share one classification. - services/cleanup_service.py: the periodic watchdog and the boot recovery ask for the retained result before writing failed — for a row the agent reports as recently completed with no live dispatcher (evaluated BEFORE the timeout/terminate branch, so a completed row past its timeout is claimed, not terminated), and for a row absent everywhere — and apply it through apply_result with the callback's exact inputs (activity_id incl. FAILED, breaker_enabled, release_slot=True). A recovered SUCCESS response carries a notice (the #1870/#2127 precedent). Claim gated on the record being >= 180 s old: track_inflight_dispatch covers only the outbound POST, so a live dispatcher reads as `absent` between its call returning and its CAS. Old image (bare 404 / non-record 200 / stub leak) keeps the pre-#2944 path unchanged; a probe that could not be asked withholds the row for a cycle (#2196). Only a won CAS counts and broadcasts (every worker runs the loop). CleanupReport gains results_recovered / result_claims_deferred / result_probe_deferred. - RECENTLY_COMPLETED_TTL_SECONDS stays 300: fetch-on-claim makes the raise the issue suggests redundant, and a raise would lengthen the #2433(C) leaked-entry shield. Tests: test_2944_retained_results.py (23) and test_2944_watchdog_claims_result.py (29); 27 of them fail on the pre-fix cleanup_service.py + chat.py (negative control). tests/unit/conftest.py points the retained store at a per-process tmp dir so handler tests never write to the developer's home. Not covered, named in the docs and DEBT_INBOX (2026-09-22): the chat transcript surface of a recovered /api/chat row, and the in-flight registration not spanning finalize/retries (the root of the 180 s grace). Fixes #2944 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Conflicts: src/backend/db/migrations.py (the SQLite runner's function block and the MIGRATIONS tail) and docs/memory/learnings.md — all tail appends on both sides, so dev's entries are kept first and this branch's follow. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…d after #2920/#2924/#2927 Content of both tracks is unchanged; only the Alembic parent moves so the version line resolves to one head again (Invariant #3, #2068). It was chained on 0064 while 0065–0067 were still open PRs; they have all landed on dev. Refs Abilityai/trinity-enterprise#549 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…onvention) dev now takes new ledger entries as one file per lesson under docs/memory/learnings/, folded into learnings.md at the release cut, so same-day PRs stop conflicting on the ledger's tail. The two entries this branch had appended to learnings.md move there unchanged; learnings.md is byte-identical to dev again. Refs Abilityai/trinity-enterprise#549 Co-Authored-By: Claude Fable 5.1 <[email protected]>
…ged" (#2943) — mechanical, per the merge-train note on the PR The agent server's status route is a bare Path("/home/developer/.git").exists(), so a repo git roots at workspace/ answers git_enabled: false deterministically and the new Step 6 verify turns that into a 400 with the config rolled back. The legacy test stubbed the agent server as git_enabled: true — a combination production cannot produce — and the feature flow / requirements said the case was "re-initialised in place, unchanged". Model the real answer in the test and state the actual outcome in both docs. No code change. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This was referenced Sep 22, 2026
Merged
9 of 12 tasks
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 #2943, #2941, #2947, #2936. Never merged; members merge individually once green. Member-vs-member collision resolved on the train only: tests/registry.json (rebuilt, 262 entries).