Skip to content

fix(platform): apply the organization's custom instructions to agent runs - #3774

Merged
yannickmonney merged 11 commits into
mainfrom
fix/org-instructions-in-agent-runs
Sep 29, 2026
Merged

yannickmonney merged 11 commits into
mainfrom
fix/org-instructions-in-agent-runs

Conversation

@yannickmonney

@yannickmonney yannickmonney commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The organization's Custom instructions (the system_prompt governance 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:

  • Merged current main again. The only conflict was the manual readme's box total. I recounted every suite from its actual `- [ ] `` lines: the total is now 925, and the DATA/GOV/KNOW rows match the suites.
  • A corrupt policy file is now logged under the lane that read it. Chat keeps [chat], task runs use [task-agent] and automation agent nodes use [agent-host]. Before, every read was logged as [chat].
  • GOV-F2 and the governance route table put the Custom instructions editor on content-models, but it is only mounted on guardrails. Both boxes and the table now name the correct page. GOV-F35 names the page itself instead of relying on GOV-F2.
  • The docs now say "agent nodes" (DE "Agent-Knoten", FR "nœuds agent"), the term used everywhere else, instead of "agent steps".

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 automation llm nodes (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 check passes — 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.
  • Translations — N/A: no message keys changed (see the follow-up above).
  • Docs updated in 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.
  • A new guardrails test checks that a corrupt system_prompt read 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, and oxlint --type-aware on 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:manual and tests/manual/scripts/check-guide.ts on suites/governance.md: OK.
  • For a manual check, run GOV-F35 in Mode B with a real model.

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.

…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.
@yannickmonney
yannickmonney merged commit 674e4c4 into main Sep 29, 2026
50 checks passed
@yannickmonney
yannickmonney deleted the fix/org-instructions-in-agent-runs branch September 29, 2026 03:25
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.

1 participant