-
Notifications
You must be signed in to change notification settings - Fork 8.3k
feat: polluted memories #13008
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: polluted memories #13008
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -337,6 +337,19 @@ pub async fn persist_dynamic_tools( | |
| } | ||
| } | ||
|
|
||
| pub async fn mark_thread_memory_mode_polluted( | ||
| context: Option<&codex_state::StateRuntime>, | ||
| thread_id: ThreadId, | ||
| stage: &str, | ||
| ) { | ||
| let Some(ctx) = context else { | ||
| return; | ||
| }; | ||
| if let Err(err) = ctx.mark_thread_memory_mode_polluted(thread_id).await { | ||
| warn!("state db mark_thread_memory_mode_polluted failed during {stage}: {err}"); | ||
| } | ||
| } | ||
|
|
||
| /// Reconcile rollout items into SQLite, falling back to scanning the rollout file. | ||
| pub async fn reconcile_rollout( | ||
| context: Option<&codex_state::StateRuntime>, | ||
|
|
@@ -375,6 +388,7 @@ pub async fn reconcile_rollout( | |
| } | ||
| }; | ||
| let mut metadata = outcome.metadata; | ||
| let memory_mode = outcome.memory_mode.unwrap_or_else(|| "enabled".to_string()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Do not default to Useful? React with 👍 / 👎.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't do |
||
| metadata.cwd = normalize_cwd_for_state_db(&metadata.cwd); | ||
| match archived_only { | ||
| Some(true) if metadata.archived_at.is_none() => { | ||
|
|
@@ -392,6 +406,16 @@ pub async fn reconcile_rollout( | |
| ); | ||
| return; | ||
| } | ||
| if let Err(err) = ctx | ||
| .set_thread_memory_mode(metadata.id, memory_mode.as_str()) | ||
| .await | ||
| { | ||
| warn!( | ||
| "state db reconcile_rollout memory_mode update failed {}: {err}", | ||
| rollout_path.display() | ||
| ); | ||
| return; | ||
| } | ||
| if let Ok(meta_line) = crate::rollout::list::read_session_meta_line(rollout_path).await { | ||
| persist_dynamic_tools( | ||
| Some(ctx), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Backfill now defaults missing rollout
memory_modeto"enabled"and writes it back unconditionally. On any backfill pass over legacy rollouts, existingthreads.memory_modevalues can be clobbered, causing polluted/disabled threads to become eligible for stage1/phase2 processing again.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't happen