Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 37 additions & 5 deletions crates/protocol/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,25 @@ pub enum TimeoutKind {
Total,
}

// Mirrored 1:1 from the TUI adapter's own internal `GateKind`
// (crates/runtime/src/adapter/tui/classify.rs) -- a Rust-only name, not
// part of the shipped schema, so it stays in this plain comment rather
// than the doc below.
/// Which recognized vendor first-run gate blocked a run at readiness.
/// Closed set, never derived from captured PTY text, so a
/// `firstRunGateDetected` event carries no redaction obligation of its
/// own (see that event's doc comment).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export)]
pub enum FirstRunGateKind {
ClaudeWorkspaceTrust,
ClaudeThemePicker,
ClaudeSignIn,
CodexDirectoryTrust,
CodexSignIn,
}

/// Why a settled run resumed to `working`. The two causes map exactly
/// to `runResumed`'s two journaling call sites, which race each other
/// for the same edge -- see that event's own doc comment.
Expand Down Expand Up @@ -1072,6 +1091,18 @@ pub enum RuntimeEvent {
worker_id: WorkerId,
question: Option<Redacted>,
},
/// A TUI adapter's readiness poll recognized a vendor first-run gate
/// blocking the run (workspace trust, a theme picker, sign-in, ...).
/// Journaled once, immediately before the paired
/// `escalationRaised { reason: "vendorFirstRunGate" }` -- `kind` is a
/// closed enum, never captured PTY text, so this event carries no
/// redaction obligation of its own.
FirstRunGateDetected {
run_id: RunId,
task_id: TaskId,
worker_id: WorkerId,
kind: FirstRunGateKind,
},
/// A worker escalated a blocking condition to its leader or a human
/// operator. `reason` is a plain, machine-assigned code (never raw
/// worker content); `question` has already crossed the redaction
Expand Down Expand Up @@ -1613,14 +1644,15 @@ mod redaction_enumeration {
(
"RuntimeEvent::EscalationRaised.reason",
"A machine-assigned code from a closed set, chosen by the runtime and never \
caller- or vendor-derived: the only two production construction sites pass \
caller- or vendor-derived: the three production construction sites pass \
the literals `repeated_failure` \
(crates/runtime/src/adapter/run_lifecycle.rs) and `write_violation` \
(crates/runtime/src/domain/repository.rs). This reason previously \
(crates/runtime/src/adapter/run_lifecycle.rs), `write_violation` \
(crates/runtime/src/domain/repository.rs), and `vendorFirstRunGate` \
(crates/runtime/src/adapter/event_sink.rs). This reason previously \
offered two supports and neither existed -- it cited \"the field's own doc\", \
which had no doc, and said the worker's text travels in the sibling \
`question`, which no production site populates. What actually secures the \
field is the literals above.",
`question`, which no production site populates before `vendorFirstRunGate`. \
What actually secures the field is the literals above.",
),
(
"RuntimeEventKind::PolicyViolation.profile_id",
Expand Down
6 changes: 3 additions & 3 deletions crates/protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ pub use display::{
};
pub use event::RunFlags;
pub use event::{
AnsweredBy, Classified, ContentClass, DiagnosticLevel, EventEnvelope, EventSource, PlanSpec,
Redacted, ResumeCause, RuntimeEvent, RuntimeEventKind, SubtaskSpec, TimeoutKind, Timestamp,
TimestampParseError, TurnOutcome,
AnsweredBy, Classified, ContentClass, DiagnosticLevel, EventEnvelope, EventSource,
FirstRunGateKind, PlanSpec, Redacted, ResumeCause, RuntimeEvent, RuntimeEventKind, SubtaskSpec,
TimeoutKind, Timestamp, TimestampParseError, TurnOutcome,
};
pub use ids::{
ApprovalId, ArtifactId, EscalationId, MessageId, OperationId, PolicyViolationId, ProjectId,
Expand Down
Loading
Loading