A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
rlm: keep factory children from waking the parent (#3820)
Sebastian Müller8a912aff4091
diff --git a/.changes/fac-quiet-children.md b/.changes/fac-quiet-children.mdnew file mode 100644index 0000000000..7236f3eb19--- /dev/null+++ b/.changes/fac-quiet-children.md@@ -0,0 +1 @@+- Factory runs no longer wake the parent session once per state: factory children are told their final message is the state's output instead of replying with `agent_message.send`, and their exit and failure notices are no longer posted into the parent conversation (the factory still reads every settle and failure through `rlm.collect`).diff --git a/crates/pa-cli/src/print_boundary/tests.rs b/crates/pa-cli/src/print_boundary/tests.rsindex f24f6bd747..77b468a4e4 100644--- a/crates/pa-cli/src/print_boundary/tests.rs+++ b/crates/pa-cli/src/print_boundary/tests.rs@@ -132,6 +132,7 @@ async fn faux_engine_with_telemetry(rlm_usage_store: None,progress_note_emit: None,rlm_depth: None,+ factory_child: false,daemonless: true,model_info: Some(model.clone()),prewarm_ipython_kernel: None,diff --git a/crates/pa-cli/src/print_goal.rs b/crates/pa-cli/src/print_goal.rsindex 649f9e7196..0dac664259 100644--- a/crates/pa-cli/src/print_goal.rs+++ b/crates/pa-cli/src/print_goal.rs@@ -855,6 +855,7 @@ mod tests {rlm_subagent_host: None,rlm_usage_store: None,progress_note_emit: None,+ factory_child: false,daemonless: true,rlm_depth: None,model_info: Some(model.clone()),@@ -1473,6 +1474,7 @@ mod tests {rlm_subagent_host: None,rlm_usage_store: None,progress_note_emit: None,+ factory_child: false,daemonless: true,rlm_depth: None,model_info: Some(model.clone()),diff --git a/crates/pa-cli/src/print_rlm.rs b/crates/pa-cli/src/print_rlm.rsindex 08cae24014..4b71307fae 100644--- a/crates/pa-cli/src/print_rlm.rs+++ b/crates/pa-cli/src/print_rlm.rs@@ -144,6 +144,9 @@ impl InlineSessionNode {/// One spawned child: its node, engine, driver task, and live state.pub(crate) struct InlineChild {pub(crate) rlm_child_id: String,+ /// A factory state's child: the factory reads its settle through+ /// collect, so no terminal notice reaches the parent.+ factory: bool,pub(crate) node: Arc<InlineSessionNode>,pub(crate) engine: Arc<SessionEngine>,/// The child's model and request auth (the drive's boundary calls).@@ -535,7 +538,7 @@ async fn settle_child(child: &Arc<InlineChild>, run_error: Option<String>) {// can observe the settled child before the parent's queue holds its// row — the quiescence check reads the child state before the// parent's queue and cannot return through the gap.- if let (Some(parent), Some(notice)) = (&parent, notice) {+ if let (Some(parent), Some(notice)) = (&parent, notice.filter(|_| !child.factory)) {let delivered = match serde_json::to_value(notice) {Ok(value) => deliver_row(parent, value),Err(error) => Err(anyhow::anyhow!(@@ -796,6 +799,7 @@ impl RlmSubagentHost for InlineHost {thinking,semantic_parent_session_id: Some(node.session_id.clone()),spawned_by_request_id: request.spawned_by_request_id.clone(),+ factory_child: request.factory.is_some(),};let headless = crate::print_runtime::build_engine(&recipe.options,@@ -810,6 +814,7 @@ impl RlmSubagentHost for InlineHost {let _ = child_node.engine.set(Arc::downgrade(&engine));let child = Arc::new(InlineChild {rlm_child_id: child_id.clone(),+ factory: request.factory.is_some(),node: Arc::clone(&child_node),engine: Arc::clone(&engine),model: headless.model,diff --git a/crates/pa-cli/src/print_runtime.rs b/crates/pa-cli/src/print_runtime.rsindex 68047a9726..df8535e2c7 100644--- a/crates/pa-cli/src/print_runtime.rs+++ b/crates/pa-cli/src/print_runtime.rs@@ -507,6 +507,8 @@ pub(crate) struct ChildEngineOverrides {pub thinking: pa_types::ai::ModelThinkingLevel,pub semantic_parent_session_id: Option<String>,pub spawned_by_request_id: Option<String>,+ /// The spawn carried a factory run tag.+ pub factory_child: bool,}/// A child's model source: a real-provider child carries its resolved@@ -527,6 +529,7 @@ pub(crate) struct HeadlessEmbeddingFields {Option<Arc<dyn pa_core::session_engine::rlm_host::RlmSubagentHost>>,pub(crate) extra_host_handlers: Option<pa_core::kernel::shared::HostRequestHandlers>,pub(crate) rlm_depth: Option<u32>,+ pub(crate) factory_child: bool,pub(crate) bash_wake: pa_core::session_engine::bash_notices::BashNoticeWake,/// The RPC mode's wake handle, carried onto the engine handle so the/// queue-pump listener parks on it; `None` outside the RPC embedding.@@ -578,6 +581,10 @@ pub(crate) fn headless_embedding_fields(embedding: &HeadlessEmbedding) -> HeadleHeadlessEmbedding::Child(overrides) => Some(overrides.node.depth),HeadlessEmbedding::Root { .. } | HeadlessEmbedding::Rpc => None,},+ factory_child: matches!(+ embedding,+ HeadlessEmbedding::Child(overrides) if overrides.factory_child+ ),bash_wake,rpc_bash_wake,on_late_sent_agent_message,@@ -767,6 +774,7 @@ pub(crate) async fn build_headless_engine_with(rlm_subagent_host,extra_host_handlers,rlm_depth,+ factory_child,bash_wake,rpc_bash_wake,on_late_sent_agent_message,@@ -839,6 +847,7 @@ pub(crate) async fn build_headless_engine_with(rlm_usage_store: None,progress_note_emit: None,rlm_depth,+ factory_child,daemonless: true,model_info: Some(model.clone()),// The kernel boots in the background at creation; a spawneddiff --git a/crates/pa-cli/src/print_runtime/faux.rs b/crates/pa-cli/src/print_runtime/faux.rsindex a071fad3cd..462b1e70ea 100644--- a/crates/pa-cli/src/print_runtime/faux.rs+++ b/crates/pa-cli/src/print_runtime/faux.rs@@ -129,6 +129,7 @@ pub(crate) async fn build_faux_engine_with(rlm_subagent_host,extra_host_handlers,rlm_depth,+ factory_child,bash_wake,rpc_bash_wake,on_late_sent_agent_message,@@ -163,6 +164,7 @@ pub(crate) async fn build_faux_engine_with(rlm_usage_store: None,progress_note_emit: None,rlm_depth,+ factory_child,daemonless: true,model_info: Some(model.clone()),// A Rust-only verification harness: no background kernel boot in tests.diff --git a/crates/pa-cli/src/print_session_command.rs b/crates/pa-cli/src/print_session_command.rsindex 069e1e4d0c..7803f08610 100644--- a/crates/pa-cli/src/print_session_command.rs+++ b/crates/pa-cli/src/print_session_command.rs@@ -348,6 +348,7 @@ mod tests {rlm_subagent_host: None,rlm_usage_store: None,progress_note_emit: None,+ factory_child: false,daemonless: true,rlm_depth: None,model_info: Some(model.clone()),diff --git a/crates/pa-core/src/prompts/system_prompt.rs b/crates/pa-core/src/prompts/system_prompt.rsindex 9fef5959d8..840e4a565e 100644--- a/crates/pa-core/src/prompts/system_prompt.rs+++ b/crates/pa-core/src/prompts/system_prompt.rs@@ -86,6 +86,9 @@ pub struct BuildSystemPromptOptions<'a> {pub rlm_depth: Option<u32>,/// Human-readable parent name or id for child communication doctrine.pub rlm_parent_agent: Option<&'a str>,+ /// Whether this child runs one factory state: the factory reads its+ /// final message, so the child does not reply to the parent.+ pub factory_child: bool,/// Whether the session runs without a daemon (no scheduler, no/// heartbeat firing). The wake-up facts the daemonless line states/// must match the embedding's wiring.@@ -324,10 +327,16 @@ fn session_role_section(options: &BuildSystemPromptOptions, has_ipython: bool) -"You are a child agent spawned by {}. Task prompts are labeled `[task from parent]`.",options.rlm_parent_agent.unwrap_or("your parent agent")));- if has_ipython {+ if options.factory_child {+ lines.push(+ "Your final message is this state's output, which the factory reads; do not message the parent.".to_string(),+ );+ } else if has_ipython {lines.push("When a task calls for an answer, reply explicitly with `await agent_message.send(message, receiver_role=\"parent\")`. Not every message or task needs a reply; continue cleanup after sending and go idle normally.".to_string(),);+ }+ if has_ipython {lines.push("For long-running work, report brief progress with `await rlm.progress_note('...')` (at most 512 characters, throttled to about one note per 10 seconds); the parent sees notes without needing a reply.".to_string(),);@@ -484,6 +493,21 @@ mod tests {.contains("You are a child agent spawned by the lead."));}+ #[test]+ fn factory_child_gets_the_factory_line_instead_of_the_reply_line() {+ const REPLY: &str = "reply explicitly with `await agent_message.send(";+ const FACTORY: &str = "Your final message is this state's output";+ let mut child = base_options();+ child.rlm_depth = Some(1);+ let normal = build_system_prompt(&child);+ assert!(normal.contains(REPLY));+ assert!(!normal.contains(FACTORY));+ child.factory_child = true;+ let factory = build_system_prompt(&child);+ assert!(factory.contains(FACTORY));+ assert!(!factory.contains(REPLY));+ }+#[test]fn custom_prompt_replaces_layers_keeps_tail() {let mut options = base_options();diff --git a/crates/pa-core/src/session_engine/engine.rs b/crates/pa-core/src/session_engine/engine.rsindex 3d93b6af01..2f80a55b20 100644--- a/crates/pa-core/src/session_engine/engine.rs+++ b/crates/pa-core/src/session_engine/engine.rs@@ -54,6 +54,9 @@ pub struct SessionEngineConfig {/// The session's depth in the RLM recursion tree (0 for top-level/// sessions); gates the `refine.*` host requests.pub rlm_depth: Option<u32>,+ /// Whether this session is a factory state's child (its spawn carried a+ /// factory run tag); selects the child prompt's factory line.+ pub factory_child: bool,/// Whether the session runs without a daemon: nothing outside the/// session itself (no scheduler, no bash-completion wake) starts a/// turn. Set explicitly by the embedding; print sessions are@@ -596,6 +599,7 @@ pub async fn create_session(mut config: SessionEngineConfig) -> anyhow::Result<S// A spawned child's prompt must read "depth: N (not root)" with// the child-agent reply doctrine, never the root identity.rlm_depth: config.rlm_depth,+ factory_child: config.factory_child,daemonless: config.daemonless,can_spawn: config.rlm_subagent_host.is_some(),generic_mcp_servers,diff --git a/crates/pa-core/src/session_engine/engine/tests.rs b/crates/pa-core/src/session_engine/engine/tests.rsindex 73b05489a9..97962c3abd 100644--- a/crates/pa-core/src/session_engine/engine/tests.rs+++ b/crates/pa-core/src/session_engine/engine/tests.rs@@ -132,6 +132,7 @@ async fn engine_runs_tool_loop_and_persists() {rlm_usage_store: None,progress_note_emit: None,rlm_depth: None,+ factory_child: false,daemonless: true,telemetry: None,model_info: None,@@ -241,6 +242,7 @@ async fn spawned_child_prompt_stamps_its_depth() {rlm_usage_store: None,progress_note_emit: None,rlm_depth: Some(2),+ factory_child: false,daemonless: true,telemetry: None,model_info: None,@@ -313,6 +315,7 @@ async fn oauth_creds_unlock_generic_mcp_gating_in_new_sessions() {rlm_usage_store: None,progress_note_emit: None,rlm_depth: None,+ factory_child: false,daemonless: true,telemetry: None,model_info: None,@@ -502,6 +505,7 @@ async fn create_session_appends_missing_resume_settings_rows() {rlm_usage_store: None,progress_note_emit: None,rlm_depth: None,+ factory_child: false,daemonless: true,telemetry: None,model_info: None,@@ -884,6 +888,7 @@ async fn late_receipts_recorded_before_the_row_lands_apply_on_landing() {rlm_usage_store: None,progress_note_emit: None,rlm_depth: None,+ factory_child: false,daemonless: true,telemetry: None,model_info: None,diff --git a/crates/pa-core/tests/abort_kernel_cell.rs b/crates/pa-core/tests/abort_kernel_cell.rsindex bd364b528b..978a38640f 100644--- a/crates/pa-core/tests/abort_kernel_cell.rs+++ b/crates/pa-core/tests/abort_kernel_cell.rs@@ -167,6 +167,7 @@ async fn abort_during_a_kernel_cell_settles_the_turn_immediately() {rlm_usage_store: None,progress_note_emit: None,rlm_depth: None,+ factory_child: false,daemonless: true,telemetry: None,model_info: None,diff --git a/crates/pa-core/tests/turn_boundary_kernel.rs b/crates/pa-core/tests/turn_boundary_kernel.rsindex 764973ab11..dd4d48dd81 100644--- a/crates/pa-core/tests/turn_boundary_kernel.rs+++ b/crates/pa-core/tests/turn_boundary_kernel.rs@@ -203,6 +203,7 @@ async fn turn_boundary_host_requests_round_trip_through_a_real_kernel() {rlm_usage_store: None,progress_note_emit: None,rlm_depth: None,+ factory_child: false,daemonless: true,telemetry: None,model_info: Some(registry_model()),diff --git a/crates/pa-daemon/src/agent_engine.rs b/crates/pa-daemon/src/agent_engine.rsindex aaead45632..741dce31bd 100644--- a/crates/pa-daemon/src/agent_engine.rs+++ b/crates/pa-daemon/src/agent_engine.rs@@ -281,6 +281,9 @@ pub struct AgentSessionEngine {/// This session's RLM recursion depth (0 for top-level): gates the kernel `refine.*` host/// requests.rlm_depth: std::sync::atomic::AtomicU32,+ /// Whether this session runs a factory state (its create carried a+ /// factory run tag): selects the child prompt's factory line.+ factory_child: std::sync::atomic::AtomicBool,/// The depth bound's source stamp (`default` | `env` | `global` |/// `inherited` | `chat`).rlm_max_depth_source: std::sync::Mutex<&'static str>,diff --git a/crates/pa-daemon/src/agent_engine/lifecycle.rs b/crates/pa-daemon/src/agent_engine/lifecycle.rsindex aceaf87295..edd2adc80a 100644--- a/crates/pa-daemon/src/agent_engine/lifecycle.rs+++ b/crates/pa-daemon/src/agent_engine/lifecycle.rs@@ -188,6 +188,7 @@ impl AgentSessionEngine {autonomous_queue_purge: std::sync::Mutex::new(None),cwd,rlm_depth: std::sync::atomic::AtomicU32::new(0),+ factory_child: std::sync::atomic::AtomicBool::new(false),rlm_max_depth_source: std::sync::Mutex::new("default"),pending_max_depth: std::sync::Mutex::new(None),reloaded_goal_update: std::sync::Mutex::new(None),@@ -1182,6 +1183,9 @@ impl AgentSessionEngine {rlm_usage_store,progress_note_emit,rlm_depth: Some(self.rlm_depth.load(std::sync::atomic::Ordering::Relaxed)),+ factory_child: self+ .factory_child+ .load(std::sync::atomic::Ordering::Relaxed),// The worker session runs under the daemon scheduler and its wake-ups.daemonless: false,model_info: Some(model.clone()),diff --git a/crates/pa-daemon/src/agent_engine/session_engine_impl.rs b/crates/pa-daemon/src/agent_engine/session_engine_impl.rsindex 56759926d6..288ee6bda4 100644--- a/crates/pa-daemon/src/agent_engine/session_engine_impl.rs+++ b/crates/pa-daemon/src/agent_engine/session_engine_impl.rs@@ -866,6 +866,8 @@ impl SessionEngine for AgentSessionEngine {// This session's own depth gates the kernel `refine.*` host requests (depth-0 only).self.rlm_depth.store(identity.rlm_depth, std::sync::atomic::Ordering::Relaxed);+ self.factory_child+ .store(identity.factory_child, std::sync::atomic::Ordering::Relaxed);if let Some(thinking) = &identity.thinking {pa_ai::models::thinking_level_from_str(thinking).ok_or_else(|| anyhow::anyhow!("unknown thinking level \"{thinking}\""))?;diff --git a/crates/pa-daemon/src/engine/wire.rs b/crates/pa-daemon/src/engine/wire.rsindex 0a72edc625..60eb3c268b 100644--- a/crates/pa-daemon/src/engine/wire.rs+++ b/crates/pa-daemon/src/engine/wire.rs@@ -272,6 +272,9 @@ pub struct RlmSessionIdentity {/// file is a top-level runtime and spawns no edge, and a replacement/// runtime has none.pub semantic_spawn: Option<SemanticSpawnOrigin>,+ /// The create's runtime metadata carries a factory run tag: the+ /// session runs one factory state.+ pub factory_child: bool,}/// A created session's semantic-edge provenance (TSdiff --git a/crates/pa-daemon/src/rlm_children.rs b/crates/pa-daemon/src/rlm_children.rsindex 40ac12bc10..fb9585c962 100644--- a/crates/pa-daemon/src/rlm_children.rs+++ b/crates/pa-daemon/src/rlm_children.rs@@ -189,6 +189,9 @@ struct ChildRecord {/// The terminal notice was claimed: exactly one of the settle watcher,/// the delete path, or a late natural settle delivers it.notice_delivered: bool,+ /// A factory state's child: the factory reads its settle through+ /// collect, so no terminal notice reaches the parent conversation.+ factory: bool,/// The task prompt was admitted; never settle a pre-prompt child (it/// is idle with an empty queue by construction).prompt_admitted: bool,@@ -773,6 +776,7 @@ impl SupervisorChildSessions {live_observation: None,direct_observation: Arc::new(Mutex::new(())),notice_delivered: false,+ factory: false,prompt_admitted: true,error: None,closed_by_parent: false,diff --git a/crates/pa-daemon/src/rlm_children/host.rs b/crates/pa-daemon/src/rlm_children/host.rsindex 75a347d556..e3e97c2980 100644--- a/crates/pa-daemon/src/rlm_children/host.rs+++ b/crates/pa-daemon/src/rlm_children/host.rs@@ -174,6 +174,7 @@ impl RlmSubagentHost for SupervisorChildSessions {live_observation: None,direct_observation: Arc::new(Mutex::new(())),notice_delivered: false,+ factory: request.factory.is_some(),prompt_admitted: false,error: None,closed_by_parent: false,diff --git a/crates/pa-daemon/src/rlm_children/lifecycle.rs b/crates/pa-daemon/src/rlm_children/lifecycle.rsindex 9f28538917..9b947a3901 100644--- a/crates/pa-daemon/src/rlm_children/lifecycle.rs+++ b/crates/pa-daemon/src/rlm_children/lifecycle.rs@@ -769,7 +769,7 @@ impl SupervisorChildSessionsInner {create_rlm_child_terminal_notice(¬ice, now_ms())}};- self.deliver_terminal_notice(message).await;+ self.deliver_terminal_notice(record, message).await;}/// Settle one child as failed (TS's thrown-run arm): the record@@ -857,7 +857,7 @@ impl SupervisorChildSessionsInner {// the thrown-run arm): a child that committed requests before// failing still returns them; a zero-commit child records nothing.self.record_child_return(record).await;- self.deliver_terminal_notice(message).await;+ self.deliver_terminal_notice(record, message).await;self.fire_settle_hook(record).await;true}@@ -871,8 +871,16 @@ impl SupervisorChildSessionsInner {/// (`child_status_notices`): the parent's queue admission accepts a/// reserved-kind row exclusively with a live mint, and answers/// anything a caller sends — with or without a guessed nonce —- /// loudly instead.- pub(super) async fn deliver_terminal_notice(&self, message: CustomMessage) {+ /// loudly instead. A factory child's notice is dropped: the factory+ /// reads the settle through collect and posts its own milestones.+ pub(super) async fn deliver_terminal_notice(+ &self,+ record: &Arc<Mutex<ChildRecord>>,+ message: CustomMessage,+ ) {+ if record.lock().await.factory {+ return;+ }let Some(content) = custom_message_text(&message) else {eprintln!("pa-daemon: RLM child notice carried no text content");return;diff --git a/crates/pa-daemon/src/rlm_children/registry.rs b/crates/pa-daemon/src/rlm_children/registry.rsindex f2c0b938b5..b896580c93 100644--- a/crates/pa-daemon/src/rlm_children/registry.rs+++ b/crates/pa-daemon/src/rlm_children/registry.rs@@ -417,10 +417,10 @@ impl SupervisorChildSessionsInner {})};if let Some(notice) = notice {- self.deliver_terminal_notice(super::create_rlm_child_terminal_notice(- ¬ice,- super::now_ms(),- ))+ self.deliver_terminal_notice(+ record,+ super::create_rlm_child_terminal_notice(¬ice, super::now_ms()),+ ).await;}}@@ -618,6 +618,7 @@ fn ledger_child_records(live_observation: None,direct_observation: Arc::new(Mutex::new(())),notice_delivered: true,+ factory: edge.factory.is_some(),prompt_admitted: true,error: None,closed_by_parent: false,diff --git a/crates/pa-daemon/src/rlm_children/usage_emit_tests.rs b/crates/pa-daemon/src/rlm_children/usage_emit_tests.rsindex 9a250ba4af..9ccb7b7a67 100644--- a/crates/pa-daemon/src/rlm_children/usage_emit_tests.rs+++ b/crates/pa-daemon/src/rlm_children/usage_emit_tests.rs@@ -62,6 +62,7 @@ fn record_with_file(child_id: &str, session_file: &Path) -> Arc<Mutex<ChildRecorlive_observation: None,direct_observation: Arc::new(Mutex::new(())),notice_delivered: false,+ factory: false,prompt_admitted: true,error: None,closed_by_parent: false,diff --git a/crates/pa-daemon/src/rlm_children/watch_tests.rs b/crates/pa-daemon/src/rlm_children/watch_tests.rsindex 84fa38dec0..52c8969865 100644--- a/crates/pa-daemon/src/rlm_children/watch_tests.rs+++ b/crates/pa-daemon/src/rlm_children/watch_tests.rs@@ -435,6 +435,39 @@ async fn spawn_child(sessions: &SupervisorChildSessions) -> RlmSpawnHandle {.expect("spawn must succeed against the fake supervisor")}+#[tokio::test]+async fn a_factory_child_settles_without_a_parent_notice() {+ let (follow_up_tx, mut follow_up_rx) = mpsc::unbounded_channel();+ let (sessions, _kill_rx) =+ sessions_with_fake_supervisor(follow_up_tx, 0, FakeKill::Success, FakeChild::Healthy).await;+ sessions+ .spawn(RlmSpawnRequest {+ prompt: "f20 child task".to_string(),+ name: Some("f20-worker".to_string()),+ model: None,+ thinking: None,+ spawned_by_request_id: None,+ factory: Some(pa_core::session_engine::rlm_host::RlmFactoryTag {+ run_id: "run".to_string(),+ spec_id: "spec".to_string(),+ state_id: "state".to_string(),+ }),+ })+ .await+ .expect("spawn must succeed against the fake supervisor");+ sessions.notify_turn_done();++ // The factory's own signal still reports the settle.+ let results = sessions.collect(Vec::new(), 10_000).await.expect("collect");+ assert_eq!(results[0].status, "done");+ let notice =+ tokio::time::timeout(std::time::Duration::from_millis(500), follow_up_rx.recv()).await;+ assert!(+ notice.is_err(),+ "a factory child must not notify the parent: {notice:?}"+ );+}+/// [`sessions_with_fake_supervisor`] whose fake answers `list_agent_peers`/// from `peers`: the supervisor's pushed worker roster that the live roster/// read joins each child row onto.@@ -2743,6 +2776,7 @@ fn an_already_settled_child_never_re_scores_as_an_unreachable_error() {live_observation: None,direct_observation: Arc::new(Mutex::new(())),notice_delivered: false,+ factory: false,prompt_admitted: true,error: None,closed_by_parent: false,@@ -2816,6 +2850,7 @@ async fn the_unreachable_give_up_skips_the_exit_capture_when_a_capture_stands()live_observation: None,direct_observation: Arc::new(Mutex::new(())),notice_delivered: false,+ factory: false,prompt_admitted: true,error: None,closed_by_parent: false,diff --git a/crates/pa-daemon/src/worker/create.rs b/crates/pa-daemon/src/worker/create.rsindex 7ae49e2b2d..1176a038fb 100644--- a/crates/pa-daemon/src/worker/create.rs+++ b/crates/pa-daemon/src/worker/create.rs@@ -179,6 +179,9 @@ impl Worker {}_ => (None, None, None, None),};+ let factory_child = payload+ .get("runtimeMetadata")+ .is_some_and(|metadata| metadata.get("factory").is_some());let thinking = payload.get("thinking").and_then(Value::as_str)@@ -605,6 +608,7 @@ impl Worker {thinking,child_script: child_script.clone(),semantic_spawn,+ factory_child,}) {return response_failure(None, "create", &error.to_string(), None);}diff --git a/crates/pa-daemon/src/worker/lifecycle.rs b/crates/pa-daemon/src/worker/lifecycle.rsindex 893e76bff7..d0d7f7f3ee 100644--- a/crates/pa-daemon/src/worker/lifecycle.rs+++ b/crates/pa-daemon/src/worker/lifecycle.rs@@ -336,6 +336,7 @@ impl Worker {child_script,// A TS replacement runtime has no semantic spawn.semantic_spawn: None,+ factory_child: false,}) {Ok(()) => self.reseed_rlm_children().await,Err(error) => eprintln!("pa-daemon: replacement identity rebind failed: {error:#}"),