Reject symbolic links in memory workspaces (#39205)

## What changed

- Reject a symbolic link used as the memory root.
- Recursively remove symbolic links before preparing or seeding the memory workspace.
- Remove and reject symbolic links created during consolidation, including when the worker fails, so they cannot affect files outside the workspace.

## Testing

Add Unix startup tests covering pre-existing extension links and links created by both successful and failed consolidation workers.

GitOrigin-RevId: f96e03812773f7beaa16455dd77370ee47d8a71f
This commit is contained in:
jif authored and copyberry committed 2026-08-18 14:14:57 +00:00
1 parent b5ea64a203
commit a04940cb12
5 files changed
+171 -4

No files matched your search

+4
View File
@@ -11,6 +11,7 @@ use crate::runtime::SpawnedConsolidationAgent;
use crate::sync_rollout_summaries_from_memories;
use crate::workspace::memory_workspace_diff;
use crate::workspace::prepare_memory_workspace;
use crate::workspace::remove_memory_symlinks;
use crate::workspace::reset_memory_workspace_baseline;
use crate::workspace::validate_consolidation_artifacts;
use crate::workspace::write_workspace_diff;
@@ -478,6 +479,9 @@ mod agent {
}
}
} else if !agent_completed {
if let Err(err) = remove_memory_symlinks(&memory_root).await {
tracing::error!("failed removing memory workspace symbolic links: {err}");
}
job::failed(context.as_ref(), &db, &claim, "failed_agent").await;
}
});