Remove thread gating from consideration work
This commit is contained in:
parent
47ddcd5516
commit
63625603bc
4 changed files with 82 additions and 62 deletions
|
|
@ -98,10 +98,6 @@ pub fn commit_request(
|
||||||
let identity = cache
|
let identity = cache
|
||||||
.get::<crate::EpiphanyRuntimeIdentity>(crate::RUNTIME_IDENTITY_KEY)?
|
.get::<crate::EpiphanyRuntimeIdentity>(crate::RUNTIME_IDENTITY_KEY)?
|
||||||
.ok_or_else(|| anyhow!("model direction consideration requires runtime identity"))?;
|
.ok_or_else(|| anyhow!("model direction consideration requires runtime identity"))?;
|
||||||
let Some(thread) = cache.get::<crate::EpiphanyThreadStateEntry>(crate::THREAD_STATE_KEY)?
|
|
||||||
else {
|
|
||||||
return Ok(None);
|
|
||||||
};
|
|
||||||
let model = crate::assemble_repo_model_view(runtime_store)?;
|
let model = crate::assemble_repo_model_view(runtime_store)?;
|
||||||
let model_basis = model.reasoning_basis();
|
let model_basis = model.reasoning_basis();
|
||||||
let mut terminal = cache
|
let mut terminal = cache
|
||||||
|
|
@ -126,7 +122,7 @@ pub fn commit_request(
|
||||||
schema_version: REQUEST_SCHEMA.into(),
|
schema_version: REQUEST_SCHEMA.into(),
|
||||||
request_id: request_id.clone(),
|
request_id: request_id.clone(),
|
||||||
runtime_id: identity.runtime_id,
|
runtime_id: identity.runtime_id,
|
||||||
thread_id: thread.thread_id,
|
thread_id: request_id.clone(),
|
||||||
model_projection_digest: model_basis.projection_digest,
|
model_projection_digest: model_basis.projection_digest,
|
||||||
model_source_documents: model_basis.source_documents,
|
model_source_documents: model_basis.source_documents,
|
||||||
previous_terminal_result_id,
|
previous_terminal_result_id,
|
||||||
|
|
@ -241,7 +237,6 @@ pub fn render_prompt(request: &AdmittedModelDirectionConsiderationRequest) -> St
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use sha2::{Digest, Sha256};
|
use sha2::{Digest, Sha256};
|
||||||
use std::collections::BTreeMap;
|
|
||||||
|
|
||||||
fn model_basis() -> crate::EpiphanyRepoModelBasis {
|
fn model_basis() -> crate::EpiphanyRepoModelBasis {
|
||||||
let source_documents = vec![crate::EpiphanyMindDocumentVersion {
|
let source_documents = vec![crate::EpiphanyMindDocumentVersion {
|
||||||
|
|
@ -346,32 +341,33 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn cold_runtime_without_thread_has_no_direction_request_yet() -> Result<()> {
|
fn keyed_repo_model_without_thread_creates_direction_request() -> Result<()> {
|
||||||
let temp = tempfile::tempdir()?;
|
let temp = tempfile::tempdir()?;
|
||||||
let store = temp.path().join("runtime.cc");
|
let store = temp.path().join("runtime.cc");
|
||||||
let mut cache = crate::runtime_spine_cache(&store)?;
|
crate::initialize_runtime_spine(
|
||||||
cache.put(
|
&store,
|
||||||
crate::RUNTIME_IDENTITY_KEY,
|
crate::RuntimeSpineInitOptions {
|
||||||
&crate::EpiphanyRuntimeIdentity {
|
|
||||||
schema_version: crate::RUNTIME_SPINE_SCHEMA_VERSION.into(),
|
|
||||||
runtime_id: "runtime-cold".into(),
|
runtime_id: "runtime-cold".into(),
|
||||||
display_name: "Cold runtime".into(),
|
display_name: "Cold runtime".into(),
|
||||||
runtime_kind: "resident".into(),
|
|
||||||
created_at: "2026-07-18T00:00:00Z".into(),
|
created_at: "2026-07-18T00:00:00Z".into(),
|
||||||
updated_at: "2026-07-18T00:00:00Z".into(),
|
},
|
||||||
supported_document_types: Vec::new(),
|
)?;
|
||||||
metadata: BTreeMap::new(),
|
let mut cache = crate::runtime_spine_cache(&store)?;
|
||||||
|
cache.put(
|
||||||
|
crate::REPO_MODEL_IDENTITY_KEY,
|
||||||
|
&crate::EpiphanyRepoModelIdentityDocument {
|
||||||
|
schema_epoch: crate::REPO_MODEL_SCHEMA_EPOCH.into(),
|
||||||
|
graph_id: "graph-cold".into(),
|
||||||
|
runtime_id: "runtime-cold".into(),
|
||||||
|
swarm_id: "swarm-cold".into(),
|
||||||
|
workspace_id: "workspace-cold".into(),
|
||||||
|
body_binding_sha256: "sha256:body-cold".into(),
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
assert!(commit_request(&store, "2026-07-18T00:01:00Z")?.is_none());
|
let request = commit_request(&store, "2026-07-18T00:01:00Z")?
|
||||||
let mut reloaded = crate::runtime_spine_cache(&store)?;
|
.ok_or_else(|| anyhow!("keyed RepoModel should create direction work"))?;
|
||||||
reloaded.pull_all_backing_stores()?;
|
assert_eq!(request.thread_id, request.request_id);
|
||||||
assert!(
|
|
||||||
reloaded
|
|
||||||
.get_all::<AdmittedModelDirectionConsiderationRequest>()?
|
|
||||||
.is_empty()
|
|
||||||
);
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -211,10 +211,6 @@ pub fn commit_request(
|
||||||
let identity = cache
|
let identity = cache
|
||||||
.get::<crate::EpiphanyRuntimeIdentity>(crate::RUNTIME_IDENTITY_KEY)?
|
.get::<crate::EpiphanyRuntimeIdentity>(crate::RUNTIME_IDENTITY_KEY)?
|
||||||
.ok_or_else(|| anyhow!("consideration requires runtime identity"))?;
|
.ok_or_else(|| anyhow!("consideration requires runtime identity"))?;
|
||||||
let Some(thread) = cache.get::<crate::EpiphanyThreadStateEntry>(crate::THREAD_STATE_KEY)?
|
|
||||||
else {
|
|
||||||
return Ok(None);
|
|
||||||
};
|
|
||||||
let model_basis = crate::assemble_repo_model_view(runtime_store)?.reasoning_basis();
|
let model_basis = crate::assemble_repo_model_view(runtime_store)?.reasoning_basis();
|
||||||
let feedback = crate::admitted_persona_feedback(persona_feedback_store, &identity.runtime_id)?
|
let feedback = crate::admitted_persona_feedback(persona_feedback_store, &identity.runtime_id)?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
|
@ -242,7 +238,7 @@ pub fn commit_request(
|
||||||
data_classification: feedback.data_classification.clone(),
|
data_classification: feedback.data_classification.clone(),
|
||||||
source_provider_identity_id: feedback.bifrost_provider_identity_id,
|
source_provider_identity_id: feedback.bifrost_provider_identity_id,
|
||||||
runtime_id: identity.runtime_id,
|
runtime_id: identity.runtime_id,
|
||||||
thread_id: thread.thread_id,
|
thread_id: request_id.clone(),
|
||||||
repository: repository.into(),
|
repository: repository.into(),
|
||||||
persona_id: persona_id.into(),
|
persona_id: persona_id.into(),
|
||||||
model_projection_digest: model_basis.projection_digest,
|
model_projection_digest: model_basis.projection_digest,
|
||||||
|
|
@ -460,39 +456,73 @@ pub fn request_candidate_modeling_review(
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use std::collections::BTreeMap;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn cold_runtime_without_thread_defers_feedback_consideration() -> Result<()> {
|
fn keyed_feedback_and_repo_model_without_thread_create_consideration() -> Result<()> {
|
||||||
let temp = tempfile::tempdir()?;
|
let temp = tempfile::tempdir()?;
|
||||||
let runtime = temp.path().join("runtime.cc");
|
let runtime = temp.path().join("runtime.cc");
|
||||||
let feedback = temp.path().join("feedback.cc");
|
let feedback = temp.path().join("feedback.cc");
|
||||||
let mut cache = crate::runtime_spine_cache(&runtime)?;
|
crate::initialize_runtime_spine(
|
||||||
cache.put(
|
&runtime,
|
||||||
crate::RUNTIME_IDENTITY_KEY,
|
crate::RuntimeSpineInitOptions {
|
||||||
&crate::EpiphanyRuntimeIdentity {
|
|
||||||
schema_version: crate::RUNTIME_SPINE_SCHEMA_VERSION.into(),
|
|
||||||
runtime_id: "runtime-cold".into(),
|
runtime_id: "runtime-cold".into(),
|
||||||
display_name: "Cold runtime".into(),
|
display_name: "Cold runtime".into(),
|
||||||
runtime_kind: "resident".into(),
|
|
||||||
created_at: "2026-07-18T00:00:00Z".into(),
|
created_at: "2026-07-18T00:00:00Z".into(),
|
||||||
updated_at: "2026-07-18T00:00:00Z".into(),
|
|
||||||
supported_document_types: Vec::new(),
|
|
||||||
metadata: BTreeMap::new(),
|
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
assert!(
|
let mut cache = crate::runtime_spine_cache(&runtime)?;
|
||||||
commit_request(
|
cache.put(
|
||||||
&runtime,
|
crate::REPO_MODEL_IDENTITY_KEY,
|
||||||
&feedback,
|
&crate::EpiphanyRepoModelIdentityDocument {
|
||||||
"feedback-1",
|
schema_epoch: crate::REPO_MODEL_SCHEMA_EPOCH.into(),
|
||||||
"GameCult/Epiphany",
|
graph_id: "graph-cold".into(),
|
||||||
"epiphany",
|
runtime_id: "runtime-cold".into(),
|
||||||
"resident-feedback-consideration-v0",
|
swarm_id: "swarm-cold".into(),
|
||||||
"2026-07-18T00:01:00Z",
|
workspace_id: "workspace-cold".into(),
|
||||||
)?
|
body_binding_sha256: "sha256:body-cold".into(),
|
||||||
.is_none()
|
},
|
||||||
);
|
)?;
|
||||||
|
let admitted = crate::LocalAdmittedPersonaFeedback {
|
||||||
|
schema_version: crate::LOCAL_PERSONA_FEEDBACK_SCHEMA_VERSION.into(),
|
||||||
|
feedback_id: "feedback-1".into(),
|
||||||
|
admission_id: "admission-1".into(),
|
||||||
|
source_actor_id: "actor-1".into(),
|
||||||
|
source_provider: "bifrost".into(),
|
||||||
|
target_runtime_id: "runtime-cold".into(),
|
||||||
|
target_repository: "GameCult/Epiphany".into(),
|
||||||
|
target_persona_id: "epiphany".into(),
|
||||||
|
source_room_id: "discord://room-1".into(),
|
||||||
|
feedback_text: "Inspect the keyed Mind.".into(),
|
||||||
|
source_discussion_refs: vec!["discord://message-1".into()],
|
||||||
|
bifrost_provider_identity_id: "bifrost-1".into(),
|
||||||
|
authority: "resident-pressure-only".into(),
|
||||||
|
private_state_exposed: false,
|
||||||
|
source_visibility: "organization".into(),
|
||||||
|
data_classification: "organization_feedback".into(),
|
||||||
|
packet_sha256: "sha256-feedback".into(),
|
||||||
|
source_observer_id: "bifrost-discord".into(),
|
||||||
|
source_observer_runtime_id: "bifrost-runtime".into(),
|
||||||
|
source_event_id: "event-1".into(),
|
||||||
|
discord_guild_id: "guild-1".into(),
|
||||||
|
discord_channel_id: "channel-1".into(),
|
||||||
|
discord_message_id: "message-1".into(),
|
||||||
|
};
|
||||||
|
let mut feedback_cache = cultcache_rs::CultCache::new();
|
||||||
|
feedback_cache.register_entry_type::<crate::LocalAdmittedPersonaFeedback>()?;
|
||||||
|
let (entry, _) = feedback_cache.prepare_entry(&admitted.feedback_id, &admitted)?;
|
||||||
|
assert!(SingleFileMessagePackBackingStore::new(&feedback).insert_entry_if_absent(entry)?);
|
||||||
|
|
||||||
|
let request = commit_request(
|
||||||
|
&runtime,
|
||||||
|
&feedback,
|
||||||
|
"feedback-1",
|
||||||
|
"GameCult/Epiphany",
|
||||||
|
"epiphany",
|
||||||
|
"resident-feedback-consideration-v0",
|
||||||
|
"2026-07-18T00:01:00Z",
|
||||||
|
)?
|
||||||
|
.ok_or_else(|| anyhow!("admitted feedback should create consideration work"))?;
|
||||||
|
assert_eq!(request.thread_id, request.request_id);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -860,7 +860,10 @@ mod tests {
|
||||||
(agent_launch, "build_epiphany_reorient_launch_request"),
|
(agent_launch, "build_epiphany_reorient_launch_request"),
|
||||||
(worker_launch, "EpiphanyReorientLaunchRequestInput"),
|
(worker_launch, "EpiphanyReorientLaunchRequestInput"),
|
||||||
] {
|
] {
|
||||||
assert!(!source.contains(forbidden), "obsolete reorientation authority {forbidden:?} survived");
|
assert!(
|
||||||
|
!source.contains(forbidden),
|
||||||
|
"obsolete reorientation authority {forbidden:?} survived"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6021,12 +6021,6 @@ pub fn promote_autonomous_direction_options_for_modeling(
|
||||||
let mut opening = runtime_spine_cache(runtime_store)?;
|
let mut opening = runtime_spine_cache(runtime_store)?;
|
||||||
opening.pull_all_backing_stores()?;
|
opening.pull_all_backing_stores()?;
|
||||||
let identity = require_identity(&opening)?;
|
let identity = require_identity(&opening)?;
|
||||||
if opening
|
|
||||||
.get::<crate::EpiphanyThreadStateEntry>(crate::THREAD_STATE_KEY)?
|
|
||||||
.is_none()
|
|
||||||
{
|
|
||||||
return Ok(Vec::new());
|
|
||||||
}
|
|
||||||
if opening
|
if opening
|
||||||
.get::<crate::EpiphanyRepoModelIdentityDocument>(crate::REPO_MODEL_IDENTITY_KEY)?
|
.get::<crate::EpiphanyRepoModelIdentityDocument>(crate::REPO_MODEL_IDENTITY_KEY)?
|
||||||
.is_none()
|
.is_none()
|
||||||
|
|
@ -6265,9 +6259,6 @@ pub fn promote_autonomous_direction_options_for_modeling(
|
||||||
current
|
current
|
||||||
.get_envelope::<EpiphanyRuntimeIdentity>(RUNTIME_IDENTITY_KEY)?
|
.get_envelope::<EpiphanyRuntimeIdentity>(RUNTIME_IDENTITY_KEY)?
|
||||||
.ok_or_else(|| anyhow!("runtime identity envelope disappeared"))?,
|
.ok_or_else(|| anyhow!("runtime identity envelope disappeared"))?,
|
||||||
current
|
|
||||||
.get_envelope::<crate::EpiphanyThreadStateEntry>(crate::THREAD_STATE_KEY)?
|
|
||||||
.ok_or_else(|| anyhow!("thread envelope disappeared"))?,
|
|
||||||
current
|
current
|
||||||
.get_envelope::<crate::RuntimeRepositoryBodyStoreBinding>(
|
.get_envelope::<crate::RuntimeRepositoryBodyStoreBinding>(
|
||||||
crate::RUNTIME_BODY_STORE_BINDING_KEY,
|
crate::RUNTIME_BODY_STORE_BINDING_KEY,
|
||||||
|
|
|
||||||
Reference in a new issue