Skip to content

feat: subagent context inheritance in workflow steps#1460

Merged
houko merged 5 commits intomainfrom
feat/883-subagent-session-context
Mar 22, 2026
Merged

feat: subagent context inheritance in workflow steps#1460
houko merged 5 commits intomainfrom
feat/883-subagent-session-context

Conversation

@houko
Copy link
Copy Markdown
Contributor

@houko houko commented Mar 22, 2026

Summary

Workflow subagents now receive parent context — previous step outputs are injected into the prompt preamble.

  • SubagentContext struct with format_preamble() for context assembly
  • Per-agent inherit_parent_context: bool (default true)
  • Per-step inherit_context: Option<bool> override
  • Output truncation at 500 bytes per step to prevent prompt bloat
  • First step gets no context (no previous outputs)

Changes

  • crates/librefang-types/src/subagent.rs — new module
  • crates/librefang-types/src/agent.rsinherit_parent_context on AgentManifest
  • crates/librefang-kernel/src/workflow.rs — context injection in all 4 step modes
  • crates/librefang-kernel/src/kernel.rs — resolver returns inherit flag
  • Routes + dashboard TypeScript updated

Test plan

  • Context injected on second step
  • Agent-level disable (inherit_parent_context=false)
  • Step-level override (inherit_context=false)
  • Output truncation at 500 bytes
  • First step gets no context
  • Serde defaults backward compat

Closes #883

Add SubagentContext to inject parent workflow step outputs into subagent
prompts, enabling downstream agents to make context-aware decisions.

- Add SubagentContext struct in librefang-types with format_preamble()
  and truncate_output_preview() helpers
- Extend WorkflowStep with optional inherit_context field (per-step override)
- Extend AgentManifest with inherit_parent_context (default true)
- Update WorkflowEngine::execute_run() to build and inject context preamble
  into each step's prompt when enabled
- Update all call sites (kernel, channel_bridge, API routes, dashboard types)
- Add tests for context injection, agent-level disable, step-level override,
  output truncation, and serde round-trips
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions Bot added the area/kernel Core kernel (scheduling, RBAC, workflows) label Mar 22, 2026
@github-actions github-actions Bot added area/channels Messaging channel adapters area/runtime Agent loop, LLM drivers, WASM sandbox labels Mar 22, 2026
@houko houko merged commit fc3c4f7 into main Mar 22, 2026
1 check passed
@houko houko deleted the feat/883-subagent-session-context branch March 22, 2026 03:26
This was referenced Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/channels Messaging channel adapters area/kernel Core kernel (scheduling, RBAC, workflows) area/runtime Agent loop, LLM drivers, WASM sandbox

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Implement subagent session management

1 participant