Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
112 lines
3.8 KiB
Rust
112 lines
3.8 KiB
Rust
//! Exercises config reloads while preparation is waiting on executor discovery.
|
|
|
|
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
use tokio::sync::Notify;
|
|
|
|
struct PausedExecutor {
|
|
entered: Notify,
|
|
resume: Notify,
|
|
queries: Mutex<Vec<bool>>,
|
|
}
|
|
|
|
impl SkillProvider for PausedExecutor {
|
|
fn list<'a>(&'a self, query: SkillListQuery<'a>) -> SkillProviderFuture<'a, SkillCatalog> {
|
|
Box::pin(async move {
|
|
self.queries
|
|
.lock()
|
|
.unwrap_or_else(std::sync::PoisonError::into_inner)
|
|
.push(query.include_bundled_skills);
|
|
self.entered.notify_one();
|
|
self.resume.notified().await;
|
|
Ok(SkillCatalog::default())
|
|
})
|
|
}
|
|
|
|
fn read<'a>(
|
|
&'a self,
|
|
_request: SkillReadRequest<'a>,
|
|
) -> SkillProviderFuture<'a, SkillReadResult> {
|
|
Box::pin(async { panic!("executor reads are not expected") })
|
|
}
|
|
|
|
fn search(&self, _request: SkillSearchRequest) -> SkillProviderFuture<'_, SkillSearchResult> {
|
|
Box::pin(async { panic!("executor searches are not expected") })
|
|
}
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn config_reload_during_preparation_applies_to_next_step() -> TestResult {
|
|
let executor = Arc::new(PausedExecutor {
|
|
entered: Notify::new(),
|
|
resume: Notify::new(),
|
|
queries: Mutex::default(),
|
|
});
|
|
let providers = SkillProviders::new().with_executor_provider(executor.clone());
|
|
let mut builder = ExtensionRegistryBuilder::new();
|
|
install_with_providers(&mut builder, providers, skills_extension_config);
|
|
let registry = builder.build();
|
|
let session = ExtensionData::new("session");
|
|
let thread = ExtensionData::new("thread");
|
|
let turn = ExtensionData::new("turn");
|
|
let config = default_config();
|
|
let updated = TestConfig {
|
|
bundled_skills_enabled: false,
|
|
..config.clone()
|
|
};
|
|
registry.thread_lifecycle_contributors()[0]
|
|
.on_thread_start(ThreadStartInput {
|
|
config: &config,
|
|
session_source: &SessionSource::Cli,
|
|
persistent_thread_state_available: true,
|
|
environments: &[],
|
|
mcp_resource_client: None,
|
|
extension_metrics: None,
|
|
session_store: &session,
|
|
thread_store: &thread,
|
|
})
|
|
.await;
|
|
start_registered_turn(®istry, &session, &thread, "turn").await;
|
|
let roots = vec![SelectedCapabilityRoot {
|
|
id: "skills".into(),
|
|
location: CapabilityRootLocation::Environment {
|
|
environment_id: "env-1".into(),
|
|
path: PathUri::parse("file:///skills")?,
|
|
},
|
|
}];
|
|
let step = ExtensionData::new("step");
|
|
let next_step = ExtensionData::new("next-step");
|
|
let model_info = catalog_model_info();
|
|
for store in [&step, &next_step] {
|
|
let (_sections, ()) = tokio::join!(
|
|
prepared_world_state(
|
|
®istry,
|
|
&roots,
|
|
WorldStateContributionInput {
|
|
previous_world_state: None,
|
|
step_store: store,
|
|
model_info: &model_info,
|
|
thread_id: akode_protocol::ThreadId::new(),
|
|
turn_id: "turn",
|
|
environments: &[],
|
|
extension_metrics: None,
|
|
session_store: &session,
|
|
thread_store: &thread,
|
|
turn_store: &turn,
|
|
}
|
|
),
|
|
async {
|
|
executor.entered.notified().await;
|
|
registry.config_contributors()[0]
|
|
.on_config_changed(&session, &thread, &config, &updated);
|
|
executor.resume.notify_one();
|
|
}
|
|
);
|
|
}
|
|
assert_eq!(
|
|
*executor.queries.lock().unwrap(),
|
|
vec![true, false]
|
|
);
|
|
Ok(())
|
|
}
|