Repository navigation
fix(platform): apply the organization's custom instructions to agent runs - #3774
Merged
Merged
Conversation
…runs Settings > Governance > Guardrails > Custom instructions promises text "injected ahead of every agent's instructions", and the docs say the same, but only the chat turn read the system_prompt policy. Project agents working tasks and automation agent steps ran without it, so an organization's house rules, terminology and any pointer it set (for instance where its docs live) never reached the agents that produce its deliverables. Both hosts now read the policy through the same reader and rules as chat (missing, disabled, blank or unparseable means nothing is added) and place it first, ahead of the agent's own instructions, on every exec they compose: the task start and steer restart, the automation step start and its resume after an answer. The host tests assert the order and the organization the policy is read for, and that a switched-off section adds nothing; the other host tests answer the new read with no policy. GOV-F35 covers it by hand.
…ctions-3774 # Conflicts: # services/platform/tests/manual/readme.md
…in-agent-runs # Conflicts: # services/platform/tests/manual/readme.md
The organization's Custom instructions policy is now read by task agents and automation agent nodes too, yet the shared policy reader tagged an unparseable file with "[chat]" whatever lane asked for it, so an operator triaging a task or automation run looked in the wrong place. The reader now takes the caller's log tag: chat keeps "[chat]", task runs report under "[task-agent]" and automation agent nodes under "[agent-host]". Also calls these "agent nodes", as the docs do, and rewraps a test docblock.
The Custom instructions paragraph said "agent steps" while the rest of the docs call them agent nodes (EN), Agent-Knoten (DE) and nœuds agent (FR). Use the established term in all three locales.
GOV-F2 and the route table placed the Custom instructions editor on content-models, but it is mounted only on the Guardrails page, so a tester following GOV-F2 (and GOV-F35, which builds on it) looked on the wrong page. Move it in the table, name the page in both boxes, and list the content-models editors as they are.
3 of 5 tasks
…in-agent-runs # Conflicts: # services/platform/tests/manual/readme.md
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.
Summary
The organization's Custom instructions (the
system_promptgovernance policy) used to reach chat only. Task agents and automation agent nodes never saw them, even though the settings copy said they apply to agents. Every composed exec now reads the same tenant-scoped policy and puts its effective text ahead of the agent's own instructions. That covers task start, resumed start and fresh fallback, steer restart, automation agent node start and retry, and resume after a human answer. An existing exec that receives stdin steering keeps its current prompt. Missing, disabled, blank and invalid policies behave as they do in chat, and the shared organization configuration cache is unchanged. The EN/DE/FR guardrails docs now name each lane.Changes from review:
[chat], task runs use[task-agent]and automation agent nodes use[agent-host]. Before, every read was logged as[chat].content-models, but it is only mounted onguardrails. Both boxes and the table now name the correct page. GOV-F35 names the page itself instead of relying on GOV-F2.Follow-up, not done here because it is a product decision: the settings description still says the text goes "ahead of every agent's instructions". Two things that are arguably agents still do not receive the policy: the automations assistant (
automations_builder/chat_wire.ts) and automationllmnodes (llm_call.ts, which is a model call, not an agent). Either extend the policy to them or narrow the copy in en/de/fr.Checklist
bun run checkpasses — not run in full locally; CI runs it. The targeted checks below passed.bun run lint:sast— Opengrep ran on the staged TS files in the pre-commit hook; the full run is left to CI.docs/{en,de,fr}/— the guardrails page names the lanes in all three locales.README.md/README.de.md/README.fr.md— N/A: no README-level change.Test plan
bun run --filter @tale/platform test -- backend/core/chat/guardrails.test.ts backend/core/automations/agent_host backend/core/tasks/agent_run_host: 17 files and 101 tests pass. The host tests build real prompts and execs with only I/O controlled. In an earlier round, removing the four policy injections made both regression tests fail.system_promptread by an agent run warns under the caller's tag. It fails when the tag is forced back to[chat]and passes with the fix.bun run --filter @tale/platform typecheck, andoxlint --type-awareon the touched files: clean.bun run --filter @tale/docs test: 35 files and 171 tests pass. An earlier round rendered the EN/DE/FR docs on phone and desktop without page errors or horizontal overflow.bun run lint:manualandtests/manual/scripts/check-guide.tsonsuites/governance.md: OK.Not verified: whether a live model actually follows the prose instructions. Access rules and filters remain the controls for restrictions that must be enforced independently. No docs screenshot changes.