Skip to content

fix(prompt): keep coding-agent delegation inside Trinity's execution ledger (abilityai/trinity-enterprise#643) - #3937

Merged
vybe merged 6 commits into
devfrom
AndriiPasternak31/ent643
Oct 27, 2026
Merged

vybe merged 6 commits into
devfrom
AndriiPasternak31/ent643

Conversation

@AndriiPasternak31

@AndriiPasternak31 AndriiPasternak31 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Every platform-prompt tier and runtime receives a standing instruction against launching coding-agent CLIs as subprocesses. It explains turn scope as authorization for Trinity-run coding-agent execution and states why nested CLIs escape cost attribution, autonomy gates, permission enforcement and audit.

The instruction directs agents to available Claude subagents or Trinity delegation, explicitly using parallel mode for in-turn self-targeting and model overrides. It makes no claim that credentials are inaccessible or that nested authentication always fails.

The change is advisory. Deterministic CLI enforcement and direct provider API calls are outside this PR. Registry management, composed preview and disabled-entry visibility remain with ent#140.

Existing pull composition failures can still omit all platform guidance; that pre-existing behavior is documented in a separate local bug draft and unchanged here.

Validation:

Check Result
New suite on unchanged production code 198 failed / 198, each expected exactly one '### Stay inside Trinity's execution ledger' section, found 0
New suite + the 39 prompt-touching unit files, seeds 643, 7331, 90210 and ordinary order 1743 passed, 1 skipped, 7 xfailed each run
The same 39 files on unmodified dev (seeds 643 and 7331) 1545 passed, 1 skipped, 7 xfailed (1743 = 1545 + 198, 0 regressions)
Backend unit tier, CI's command on Python 3.13.7 (clean snapshot: no .env, no submodules), seed 12345 28063 passed, 0 failed, 0 errors (test_ent643_platform_cli_boundary 198)
16 unit files that read the touched docs 991 passed, the same as on unmodified dev
Rendered section size (cap 1,000 chars) Claude Code 957, Codex 906, Gemini and unknown runtimes 934; the ent#945 environment block unchanged on every runtime
lint_sys_modules (130 ≤ 131), lint_root_test_placement, enterprise-docs guard (0 hits), git diff --check clean

The local runs other than the 3.13 row used Python 3.14.4. Across the cross-branch Python 3.13 run the only red is a pre-existing timing flake on unmodified dev (test_ent879_aauth_resource_route, seed 67890; 8 of 2000 isolated repeats fail), on no branch.

Mutation (each on a scratch copy, new suite of 198): runtime swap removed → 13 failed; heading not registered → 1; heading added to the MINIMAL drop set → 31; parallel=true removed → 10; _CLAUDE_SUBAGENT_RUNTIMES drops claude → 2; a storage/failure claim inserted → 20; marker fill removed → 36; launcher made unconditional → 5; reason clause removed → 10; "directly or through scripts or wrappers" removed → 10; section padded past 1,000 chars → 16; each of three owner-drift mutations (chat.ts, denied tools, Claude runtime names) → 1. The validate gate reproduced 8 of these with identical counts.

Review: an independent code review approved, with one wording nit on the user doc, applied; it included reading the finished rendered sections from the agent's perspective and found no additional in-scope loophole, false claim or missing alternative. An independent security review approved. The feature flow was updated by hand with the disclosure guard run; tests/registry.json and the test-runner catalog are deliberately unchanged. Docker and the production-image check: not run.

Journey Impact: none: advisory platform instructions and runtime-specific alternatives; rendering and delivery are covered by unit regressions.

Fixes abilityai/trinity-enterprise#643.

…ledger (Abilityai/trinity-enterprise#643)

Every platform-prompt tier and runtime carries a standing instruction against launching coding-agent CLIs as subprocesses, pointing agents at Claude subagents or Trinity delegation instead, so delegated work stays visible, attributable and within the turn's authorization.
@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

✅ Nightly unit-suite clean when this PR is merged into dev, all 3 seeds (head_sha: afc021f26c639ac7af76eab558d11b96c78f98d0).

@dolho dolho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. The section reads well, the runtime-conditional alternative is honest, and the new suite tests the rendered prompt directly rather than the source.

Two required checks are red on the current head, and both need a change before merge:

  • regression diff: test_ent419_memory_poisoning_gates::test_every_structural_heading_of_the_composed_prompt_is_guarded fails. The anti-poisoning guard from #3912 (merged into this branch from dev) pins every platform heading against STRUCTURAL_HEADINGS in src/backend/services/user_memory_guard.py. Adding "stay inside trinity's execution ledger" to that set fixes it. Locally, test_ent419 + test_ent643 then pass (395/395).
  • journey-impact: the parser reads **Journey Impact:** none — ... as ** none — .... Please use the none: <reason> form, e.g. Journey Impact: none: advisory platform instructions; rendering covered by unit regressions.

Minor: Refs abilityai/trinity-enterprise#643 is not a closing keyword. Since it is cross-tracker it would not auto-promote anyway, so ent#643 will need a manual status-in-dev after merge.

Please push the fix and re-request review.

…bilityai/trinity-enterprise#643)

#3912 pins every level 1-3 heading of the composed system prompt against
STRUCTURAL_HEADINGS, so a remembered note cannot repeat a platform section
heading. This branch adds "### Stay inside Trinity's execution ledger" to the
platform instructions, which left
test_every_structural_heading_of_the_composed_prompt_is_guarded red once dev
was merged in. Registering the folded title closes it.
@AndriiPasternak31

Copy link
Copy Markdown
Contributor Author

Thanks — all three addressed, point by point:

  1. regression diff — fixed in 4d9cf56: "stay inside trinity's execution ledger" added to STRUCTURAL_HEADINGS in src/backend/services/user_memory_guard.py. Verified rather than copied: the rendered ### Stay inside Trinity's execution ledger folds through _heading_title to exactly that string and is in the set. Locally test_ent419_memory_poisoning_gates.py + test_ent643_platform_cli_boundary.py: 395 passed (Python 3.14.4, -p no:randomly), matching your 395/395. regression diff is green on the current head (afc021f).

  2. journey-impact — PR body edited to the none: <reason> form: Journey Impact: none: advisory platform instructions and runtime-specific alternatives; rendering and delivery are covered by unit regressions. No commit involved; the check is green on the current head.

  3. Closing keyword (minor) — PR body now ends with Fixes abilityai/trinity-enterprise#643. Cross-tracker, so it will not auto-close; ent#643 gets its manual status-in-dev after merge, as you noted.

Re-requesting review.

@dolho dolho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at afc021f26 — both requested changes are in

  • regression diff: "stay inside trinity's execution ledger" is now in STRUCTURAL_HEADINGS (user_memory_guard.py:422, commit 4d9cf56d). test_ent643_platform_cli_boundary.py + test_ent419_memory_poisoning_gates.py on the head: 395 passed.
  • journey-impact: the body now reads Journey Impact: none: advisory platform instructions…, the form the parser accepts.
Check Result
Change one always-tier section in PLATFORM_INSTRUCTIONS, with a runtime-conditional in-turn alternative (Agent/Task only for Claude Code runtimes, own tools otherwise), plus the heading registered in _KNOWN_SECTION_HEADINGS and the memory guard ✅
Honesty states "turn-scoped" as authorization, never as storage, so an agent cannot disprove it with one command ✅
Docs requirements, flow + index, agent-runtime.md, two user docs ✅
Secrets / host paths none ✅
CI 20 pass / 6 skipped, regression diff green ✅

Execution coverage (§5.4)

The new suite asserts the rendered prompt per tier and runtime, and it fails 198/198 on the unchanged service, so it executes platform_prompt_service compose, not its source.

Reminder: Refs abilityai/trinity-enterprise#643 is cross-tracker, so ent#643 needs a manual status-in-dev after merge.

APPROVE.

🤖 Reviewed with Claude Code

@vybe
vybe merged commit 6eb1158 into dev Oct 27, 2026
27 checks passed
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.

3 participants