Preserve human overrides across repeated heartbeat instructions (#47851)

## Why

Unchanged scheduled heartbeat instructions should not become fresh authorization evidence that supersedes a later human override or floods Guardian review context.

## What changed

- Capture heartbeat provenance per input, including when steering an active turn, and persist it in history and retained context.
- Coalesce unchanged instructions for each automation at their original acceptance order. Preserve changed instruction versions and ordinary human messages.
- Represent repeated heartbeats as references to earlier instructions in Guardian transcripts, while tracking the latest input turn separately for trusted skill selection.
- Limit coalescing to recognized, bounded heartbeat envelopes with host-provided provenance.

## Testing

Add regression coverage for human overrides across repeated and steered heartbeats, instruction changes, checkpoint restoration, transcript references, envelope parsing, and latest-turn trusted skills in delegated reviews.

GitOrigin-RevId: 31e444ddb685a1a618be26d3cc32fb562296946b
This commit is contained in:
felixxia-oai
2026-09-24 14:48:41 +00:00
committed by copyberry
parent 12fd929f72
commit e7f119819a
29 changed files with 1084 additions and 71 deletions
+4 -4
View File
@@ -96,8 +96,8 @@ impl TurnInputRequest {
self
}
/// Options consulted only by start-capable submission methods when this
/// request starts a turn.
/// Options for new turns, also consulted for input provenance and active-turn
/// compatibility when steering.
pub fn on_start(mut self, start: TurnStartOptions) -> Self {
self.start = start;
self
@@ -161,8 +161,8 @@ pub enum CyberAccessProgram {
/// child input, Core also compares root lineage to detect ambiguity.
#[derive(Clone, Debug, Default)]
pub struct TurnStartOptions {
/// Source classification for the caller that starts a new turn.
/// Ignored when the submitted input steers an active turn.
/// Source classification for this request. Recorded on new turns and captured
/// as input provenance when steering, without changing the active turn's trigger.
pub turn_trigger: Option<String>,
/// Structured-output schema for a new turn. When steering, Core rejects
/// the input if the active turn uses a different schema.