Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 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
10 changes: 7 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,13 @@ SAFETY_INJECTION_CHECK_ENABLED=true
# setting cannot rewrite Reborn callback URLs. Absent this var, Reborn uses
# the bound listener address. Set it to your public URL in production. Google
# product-auth still uses IRONCLAW_REBORN_GOOGLE_OAUTH_REDIRECT_URI explicitly.
# Also backs the one-click connect link appended to an OAuth-strategy channel's
# "connect your account" notice (<base>/chat?connect=<extension>); while unset,
# that notice stays at its static, link-free text.
# Also backs two setup links, both of which stay absent while it is unset (the
# copy around them keeps naming the destination in words):
# - the one-click connect link appended to an OAuth-strategy channel's
# "connect your account" notice (<base>/chat?connect=<extension>);
# - the personal-account setup link in device-link install guidance
# (<base>/extensions?configure=<extension>&setup=personal_account), which a
# user reading that guidance in Telegram or Slack cannot otherwise reach.
# IRONCLAW_REBORN_WEBUI_BASE_URL=https://myapp.example.com
#
# Optional per-call HTTP timeout (whole seconds) for the OAuth provider
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@ const CONNECT_LINK_BASE_URL_ENV: &str = "IRONCLAW_REBORN_WEBUI_BASE_URL";
/// consumer *fails startup* on a blank value; this consumer has a working
/// link-free fallback, so it ships dark instead — the two agree on what the
/// variable means, and differ only in what an unusable value costs.
fn connect_link_base_url_from_env() -> Option<String> {
///
/// Shared with the lifecycle surfaces' device-link guidance
/// (`ironclaw_extension_manager::install_guidance::personal_setup_link`), which
/// treats an unset origin the same way: keep the link-free copy rather than
/// advertise a relative path into a conversation.
pub(crate) fn connect_link_base_url_from_env() -> Option<String> {
let raw = std::env::var(CONNECT_LINK_BASE_URL_ENV).ok()?; // silent-ok: optional public-origin env read; unset keeps the notice link-free
normalize_connect_link_base_url(&raw)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1116,6 +1116,7 @@ pub(super) async fn build_backend_production(
&mut first_party_registry,
Arc::clone(&extension_management),
product_auth_services.runtime_credential_account_selection_service(),
crate::extension_host_assembly::connect_link_base_url_from_env(),
)
.map_err(|error| RebornBuildError::InvalidConfig {
reason: format!("extension lifecycle handlers are invalid: {error}"),
Expand Down
7 changes: 7 additions & 0 deletions crates/app/ironclaw_composition/src/product_surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ pub(crate) fn build_product_surface_with_channel_connection(
.product_auth
.runtime_credential_account_selection_service(),
);
// Device-link guidance hands the user the Extensions page rather than
// describing it, when the deployment published a public origin. Same
// env read as the channel connect notice, and the same fallback: no
// origin keeps the link-free copy.
lifecycle_service = lifecycle_service.with_setup_link_base_url(
crate::extension_host_assembly::connect_link_base_url_from_env(),
);
api = api.with_lifecycle_product_service(Arc::new(lifecycle_service));
}
// The generic channel-config configure port: the setup service renders
Expand Down
376 changes: 373 additions & 3 deletions crates/extensions/ironclaw_extension_host/src/product_lifecycle.rs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions crates/extensions/ironclaw_extension_manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ ironclaw_trust = { path = "../../kernel/ironclaw_trust", optional = true }
ed25519-dalek = "2.2.0"
hex = "0.4.3"
hmac = "0.13"
percent-encoding = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
sha2 = "0.11"
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,16 @@ async fn execute_install_with_activation(
if let Some(activation_visible_capability_ids) = activation_visible_capability_ids {
*visible_capability_ids = activation_visible_capability_ids;
}
*next_step = if install_response.phase == InstallationState::Active {
"Activation completed; model-visible extension tools are ready.".to_string()
} else {
"Activation did not complete; inspect the lifecycle phase and blockers.".to_string()
};
// Only the failure text is written here. On success the service has
// already composed `next_step` from the caller's device-link state, and
// a literal in this wrapper would be a third copy of guidance that
// `install_guidance` exists to own — the drift shape #7853 came from.
// Overwriting it dropped the per-user link direction for every CLI
// user, leaving it only in `message`, which this renderer never prints.
if install_response.phase != InstallationState::Active {
*next_step = "Activation did not complete; inspect the lifecycle phase and blockers."
.to_string();
}
}
Ok(install_response)
}
Expand Down Expand Up @@ -241,6 +246,53 @@ fn extension_source_label(source: LifecycleExtensionSource) -> &'static str {

#[cfg(test)]
mod tests {
/// The CLI install wrapper re-runs activation and rewrites the install
/// payload. It used to rewrite `next_step` unconditionally with a literal,
/// which threw away the per-caller device-link direction the service had
/// just composed — leaving it only on `message`, a field this renderer
/// never prints. A terminal user was told "ready" while a personal link
/// was still owed, which is #7853 on the default CLI path.
#[tokio::test]
async fn cli_install_keeps_the_device_link_direction_in_next_step() {
use crate::lifecycle_test_support::{
DEVICE_LINK_CHANNEL_FIXTURE_EXTENSION_ID,
build_lifecycle_test_services_with_device_link_channel_fixture,
};

let services =
build_lifecycle_test_services_with_device_link_channel_fixture("owner-cli-device-link")
.await;
let scope = crate::lifecycle_test_support::webui_gate_resource_scope_for_owner(
"owner-cli-device-link",
);

let response = execute_reborn_extension_lifecycle_service_command(
&services.lifecycle_service,
crate::lifecycle_test_support::lifecycle_product_context(scope),
RebornExtensionLifecycleCommand::Install {
id: DEVICE_LINK_CHANNEL_FIXTURE_EXTENSION_ID.to_string(),
},
)
.await
.expect("install the device-link fixture through the CLI command path");

let Some(LifecycleProductPayload::ExtensionInstall { next_step, .. }) =
response.payload.as_ref()
else {
panic!("expected an install payload, got {:?}", response.payload);
};
assert!(
next_step.contains("cannot run from chat"),
"the CLI must keep the device-link direction the service composed: {next_step}"
);
// And it must survive all the way into what the terminal actually shows.
let rendered = render_reborn_extension_lifecycle_response("install", &response);
assert!(
rendered.contains("cannot run from chat"),
"the rendered CLI output must carry it too: {rendered}"
);
}

use ironclaw_auth::{
AuthContinuationRef, AuthProductScope, AuthProviderId, AuthSurface, CredentialAccountLabel,
};
Expand Down
Loading
Loading