Skip to content
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
7b6c6e2
docs(design): define web-app run notifications
BenKurrek Aug 13, 2026
64569c3
docs(design): unify WebUI session event transport
BenKurrek Aug 13, 2026
5e3017c
docs(plans): add web-app run-notifications implementation plan
BenKurrek Aug 13, 2026
548806e
feat(contracts): type the product stream selector and event envelopes
BenKurrek Aug 13, 2026
babc6ef
feat(webui): ticketed session WebSocket over a shared stream driver
BenKurrek Aug 13, 2026
3afc071
feat(webui): app-root SessionEventClient with SSE fallback and shared…
BenKurrek Aug 13, 2026
539e7be
test(integration): whole-path session-socket streaming evidence
BenKurrek Aug 13, 2026
b908bc9
chore(arch): re-pin ironclaw_product_contracts size ceiling for the s…
BenKurrek Aug 13, 2026
e1c351c
feat(assistant): run-completion notice store, stream, ingest, operati…
BenKurrek Aug 13, 2026
6d29249
feat(composition,webui): wire run-completion observer, coordinator, a…
BenKurrek Aug 13, 2026
654ee33
feat(outbound): typed RunCompletion push vocabulary and the web-app v…
BenKurrek Aug 13, 2026
dbfaf74
feat(assistant,composition): local_os validation and the authorized W…
BenKurrek Aug 13, 2026
acdb72b
feat(webui-frontend): run-completion notices, arbitration client, and…
BenKurrek Aug 13, 2026
76605a7
test(assistant): coordinator arbitration tests; carry the grant count…
BenKurrek Aug 31, 2026
93b671d
feat(assistant,composition,webui-frontend): reconcile run completions…
BenKurrek Aug 31, 2026
f566fb2
fix(gates): satisfy post-rebase architecture and lint gates
BenKurrek Aug 31, 2026
e204c25
fix(ci): panic-baseline safety rationales and CI-tolerant socket test…
BenKurrek Aug 31, 2026
cb936bb
fix(tests,gates): order-independent socket test; composition budget r…
BenKurrek Aug 31, 2026
cc6eb68
fix,test: address PR #8010 review round
BenKurrek Aug 31, 2026
5815dc6
fix: second review-wave items — grant param struct, retained causes, …
BenKurrek Sep 1, 2026
0bdfbbd
style: crate-qualified path for the cross-module NewGrant reference
BenKurrek Sep 1, 2026
d42ff78
Merge remote-tracking branch 'origin/main' into feat/session-events-r…
BenKurrek Sep 2, 2026
c046f2b
fix(run-completions,webui): review round 3 — evidence gating, replay …
BenKurrek Sep 2, 2026
0df129d
Merge origin/main into feat/session-events-run-completion-notifications
BenKurrek Sep 2, 2026
6bfa24f
docs(assistant): drop the aliased run_completion_store_error charter …
BenKurrek Sep 2, 2026
41d89df
fix(run-completions,webui): review round 4 — arbitration bound, curso…
BenKurrek Sep 2, 2026
5268187
test(run-completions,webui): cover the stream selector, push fail-clo…
BenKurrek Sep 2, 2026
39dbc75
feat(webui): replace the session WebSocket with one session SSE stream
BenKurrek Sep 2, 2026
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
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ secrecy = { version = "0.10", features = ["serde"] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
axum = { version = "0.8", features = ["ws"] }
futures = "0.3"
tokio-tungstenite = { version = "0.29", default-features = false, features = ["connect"] }
tower = { version = "0.5", features = ["util"] }
reqwest = { version = "0.12", default-features = false, features = ["json", "multipart", "rustls-tls-native-roots", "stream"] }
base64 = "0.22"
Expand Down Expand Up @@ -508,6 +510,10 @@ path = "tests/integration/web_access.rs"
name = "reborn_integration_webui_v2_product_api"
path = "tests/integration/webui_v2_product_api.rs"

[[test]]
name = "reborn_integration_session_events"
path = "tests/integration/session_events.rs"

[[test]]
name = "reborn_integration_webui_v2_router_smoke"
path = "tests/integration/webui_v2_router_smoke.rs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,22 @@ fn reborn_contracts_crates_carry_a_checked_size_ceiling() {
// typed notification records, pagination, and lifecycle command DTOs.
// Storage and lifecycle behavior live in ironclaw_notifications;
// this crate only owns the authenticated ProductSurface wire contract.
("ironclaw_product_contracts", 16_581),
// 16_581 -> 16_791 (2026-08-31, session event transport rebased onto
// the inbox vocabulary): +210 lines of vocabulary, no logic — the
// typed `ProductStreamSelector` / `ProductStreamEventEnvelope` /
// `ProductStreamEvent` stream contracts replacing the `stream_id`
// string + JSON-erased events, and the new `session_transport`
// module (the single-use session-socket ticket record and storage
// port; adapters live in webui/composition). Count read from this
// gate.
// 16_791 -> 17_130 (2026-08-31, run-completion notifications): +339
// lines of vocabulary, no logic — the `run_completions` wire module
// (notice/grant/clear stream events, intent/acknowledge/thread-read
// request-responses, unread snapshot, operation descriptors, and
// their bounds). Store, ingest, arbitration, and stream behavior all
// live in `ironclaw_assistant::run_completions`; composition owns
// the observer/coordinator wiring. Count read from this gate.
("ironclaw_product_contracts", 17_130),
// 832 -> 432 (2026-08-12, #7373 refresh merge, main): re-pinned to the
// measured count — this row still carried the +400 seed pad the
// 2026-08-07 re-pin removed from its siblings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ const FROZEN_OTHER_MODE_TYPES: &[&str] = &[
// JUSTIFIED (Bucket-3 by meaning): "hook-local id" — an identifier local to
// one hook, a genuine domain concept, not a deployment tier.
"HookLocalId",
// JUSTIFIED (Bucket-3 by meaning): the run-completion notification
// `local_os` presentation lane (2026-08-13 design §5.4) — a browser
// OS-notification intent kind mirroring the wire enum's `LocalOs`
// variant, not a deployment tier. The policy trait gates whether a
// `local_os` intent may win arbitration; `Deny*` is the fail-closed
// Phase-1 default until validated grants land.
"DenyLocalOsIntents",
"LocalOsIntentPolicy",
// RebornLocal* composition family — standalone-as-type mode names in the
// composition surface; shrinks with Slice B (deployment mode becomes a
// `DeploymentConfig` value):
Expand Down
12 changes: 12 additions & 0 deletions crates/app/ironclaw_cli/src/commands/serve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,18 @@ impl ServeCommand {
serve_config =
serve_config.with_session_channel_extension_id(extension_id.to_string());
}
// Session-socket tickets: composition owns the deployment-shape
// decision. Replica-shared storage shapes hand back a durable
// one-shot adapter; single-process shapes fall back to the
// host's bounded in-memory store. Either way the capability is
// advertised only because a real store is wired — a deployment
// where neither applies would leave `features.session_events`
// off and browsers on compatibility SSE.
let session_socket_tickets =
runtime.session_socket_ticket_store().unwrap_or_else(|| {
std::sync::Arc::new(ironclaw_webui::InMemorySessionSocketTicketStore::new())
});
serve_config = serve_config.with_session_socket_ticket_store(session_socket_tickets);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
{
serve_config = serve_config.with_protected_route_mount(openai_compat_mount);
}
Expand Down
4 changes: 4 additions & 0 deletions crates/app/ironclaw_composition/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ mod product_surface;
mod production_runtime_policy;
mod readiness;
mod root;
mod run_completion_observer;
mod run_completion_push;
mod runtime;
mod runtime_input;
mod runtime_mounts;
mod sandbox;
mod session_ticket_store;
mod standalone_bootstrap_assembly;
mod storage_catalog;
mod support;
Expand Down Expand Up @@ -445,6 +448,7 @@ const PER_USER_ALIASES: &[&str] = &[
// The web-app channel keeps its own alias above rather than moving here,
// because moving it would relocate live enrollment documents.
"/delivery-registrations",
"/run-notices",
"/run-state",
"/checkpoint-state",
"/approvals",
Expand Down
3 changes: 2 additions & 1 deletion crates/app/ironclaw_composition/src/product_surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ pub(crate) fn build_product_surface_with_channel_connection(
.with_auth_interactions(runtime.webui_auth_interaction_service())
.with_diagnostic_store(Arc::clone(&runtime.diagnostic_store))
.with_session_inbound_ledger(Arc::clone(&runtime.session_inbound_ledger))
.with_session_channel_directory(Arc::clone(&runtime.session_channel_directory));
.with_session_channel_directory(Arc::clone(&runtime.session_channel_directory))
.with_run_completions(runtime.run_completion_services());
let default_thread_scope = runtime.product_default_thread_scope();
api = api.with_suggestions(
runtime.suggestions_store(),
Expand Down
108 changes: 108 additions & 0 deletions crates/app/ironclaw_composition/src/run_completion_observer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
//! Journal-commit adapter for run-completion notifications (2026-08-13
//! design §5.2, §13).
//!
//! Composition owns the kernel-facing half: it filters committed process
//! batches to terminal successful `Completed` top-level agent-turn
//! processes with an owner user and a thread scope, then hands typed
//! observations to the product-owned `RunCompletionIngest`. Keeping the
//! `ironclaw_processes` vocabulary here preserves the §13 seam — when
//! `AgentExecution::subscribe` becomes the canonical observation facade, a
//! new adapter maps onto the same ingest port and nothing downstream moves.
//!
//! Retry contract: `Err` is returned only for retryable ingest failures, so
//! the journal store's durable observer cursor holds position and replays.
//! Ineligible and permanently-unresolvable runs return `Ok` (sanitized
//! anomaly metrics only) — one malformed historical run must not wedge the
//! shared cursor forever.

use std::sync::Arc;

use async_trait::async_trait;
use ironclaw_assistant::run_completions::ingest::{
CompletionIngestOutcome, CompletionObservation, RunCompletionIngest,
};
use ironclaw_host_api::resource::SYSTEM_RESERVED_ID;
use ironclaw_host_api::turn::{TurnRunId, TurnScope};
use ironclaw_processes::{ProcessJournalCommit, ProcessJournalCommitObserver, ProcessJournalKind};

pub(crate) struct RunCompletionJournalObserver {
ingest: Arc<RunCompletionIngest>,
}

impl RunCompletionJournalObserver {
pub(crate) fn new(ingest: Arc<RunCompletionIngest>) -> Self {
Self { ingest }
}

fn observation(commit: &ProcessJournalCommit) -> Option<CompletionObservation> {
// Terminal successful commit only — `Stopped` projects to a
// cancelled turn kind and never notifies.
if commit.kind != ProcessJournalKind::Completed {
return None;
}
if commit.state.process_kind != ironclaw_processes::ProcessKind::AgentTurn {
return None;
}
// Top-level only: subagents always carry parent/root process ids.
if commit.state.parent_process_id.is_some() || commit.state.root_process_id.is_some() {
return None;
}
let owner_user_id = commit.state.owner_user_id.clone()?;
if owner_user_id.as_str() == SYSTEM_RESERVED_ID
|| commit.state.scope.user_id.as_str() == SYSTEM_RESERVED_ID
{
return None;
}
// Thread-backed only; system inference and detached maintenance
// work never carry a thread scope.
let thread_id = commit.state.scope.thread_id.clone()?;
let scope = TurnScope::new_with_owner(
commit.state.scope.tenant_id.clone(),
commit.state.scope.agent_id.clone(),
commit.state.scope.project_id.clone(),
thread_id,
Some(owner_user_id.clone()),
);
Some(CompletionObservation {
run_id: TurnRunId::from_uuid(commit.state.process_id.as_uuid()),
scope,
owner_user_id,
// The journal's per-commit occurrence instant when recorded
// (post-#7700); snapshot creation time for older commits.
completed_at: commit.occurred_at.unwrap_or(commit.state.created_at),
})
}
}

#[async_trait]
Comment thread
BenKurrek marked this conversation as resolved.
Resolved
impl ProcessJournalCommitObserver for RunCompletionJournalObserver {
fn process_observer_id(&self) -> &'static str {
"web-app-run-completion-observer-v1"
}

async fn observe_process_commit(&self, commit: ProcessJournalCommit) -> Result<(), String> {
let Some(observation) = Self::observation(&commit) else {
return Ok(());
};
match self.ingest.ingest(observation).await {
Ok(
CompletionIngestOutcome::NoticeCreated
| CompletionIngestOutcome::AlreadyRecorded
| CompletionIngestOutcome::Ineligible
| CompletionIngestOutcome::NoFinalReply,
) => Ok(()),
Err(error) if error.retryable => Err(error.to_string()),
Err(error) => {
// Terminal ingest failure: advancing is deliberate — the
// sanitized reason is already recorded, and wedging the
// shared cursor would starve every later completion.
tracing::debug!(
target: "ironclaw::reborn::run_completions",
error = %error,
"terminal run-completion ingest failure; advancing observer cursor",
);
Ok(())
}
}
}
}
104 changes: 104 additions & 0 deletions crates/app/ironclaw_composition/src/run_completion_push.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
//! Composition half of run-completion external presentation (2026-08-13
//! design §6.1, §7.9): the host-owned web-app enrollment probe the
//! `local_os` policy consults.
//!
//! The probe reads the SAME host-owned delivery registrations the delivery
//! coordinator resolves for actual pushes, so "Enrolled" here can never
//! diverge from what a push would use. Browser-instance correlation rides
//! inside the registration's channel-opaque `document` (interpreted only
//! where it is used, mirroring the web-app adapter's own parsing rule);
//! records that predate correlation degrade to profile-level presence.

use std::sync::Arc;

use async_trait::async_trait;
use ironclaw_assistant::run_completions::push::{WebAppEnrollmentProbe, WebAppEnrollmentSnapshot};
use ironclaw_assistant::run_completions::store::RunCompletionOwner;
use ironclaw_host_api::ids::ExtensionId;
use ironclaw_product_contracts::delivery::{
DeliveryRegistrationScope, DeliveryRegistrationService,
};

pub(crate) struct RegistrationEnrollmentProbe {
registrations: Arc<dyn DeliveryRegistrationService>,
extension_id: ExtensionId,
}

impl RegistrationEnrollmentProbe {
pub(crate) fn new(
registrations: Arc<dyn DeliveryRegistrationService>,
extension_id: ExtensionId,
) -> Self {
Self {
registrations,
extension_id,
}
}
}

#[async_trait]
impl WebAppEnrollmentProbe for RegistrationEnrollmentProbe {
async fn enrollment(
&self,
owner: &RunCompletionOwner,
) -> Result<WebAppEnrollmentSnapshot, String> {
let scope = DeliveryRegistrationScope {
tenant_id: owner.tenant_id.clone(),
user_id: owner.user_id.clone(),
extension_id: self.extension_id.clone(),
};
let registrations = self
.registrations
.list(&scope)
.await
.map_err(|error| error.to_string())?;
let mut snapshot = WebAppEnrollmentSnapshot::default();
for registration in registrations {
match browser_instance_of(&registration.document) {
Some(instance_id) => snapshot.instance_ids.push(instance_id),
None => snapshot.uncorrelated += 1,
}
}
Ok(snapshot)
}
}

/// The optional `browser_instance_id` a correlated enrollment document
/// carries. A malformed document counts as uncorrelated rather than
/// failing the probe — the adapter prunes it on its own path.
fn browser_instance_of(document: &str) -> Option<String> {
#[derive(serde::Deserialize)]
struct CorrelatedDocument {
#[serde(default)]
browser_instance_id: Option<String>,
}
serde_json::from_str::<CorrelatedDocument>(document)
.ok()
.and_then(|document| document.browser_instance_id)
.filter(|id| !id.is_empty() && id.len() <= 128)
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn correlated_document_yields_instance_id() {
let document = r#"{"keys":{"p256dh":"k","auth":"a"},"browser_instance_id":"bi-1"}"#;
assert_eq!(browser_instance_of(document).as_deref(), Some("bi-1"));
}

#[test]
fn legacy_and_malformed_documents_are_uncorrelated() {
assert_eq!(
browser_instance_of(r#"{"keys":{"p256dh":"k","auth":"a"}}"#),
None
);
assert_eq!(browser_instance_of("not json"), None);
assert_eq!(
browser_instance_of(r#"{"browser_instance_id":""}"#),
None,
"empty ids never correlate"
);
}
}
Loading
Loading