mirror of
https://github.com/openai/codex.git
synced 2026-11-13 14:46:14 +00:00
Make external session detection limits configurable (#34449)
## What changed - Add `maxSessionAgeDays` and `maxSessions` to the external-agent config detection request. - Apply the requested limits when discovering sessions from supported migration sources. - Preserve the existing defaults of a 30-day maximum age and 50 sessions when either option is omitted. GitOrigin-RevId: 46376e94b64f1f61d8776e34d82cdd2cdeb36ca0
This commit is contained in:
1 parent
9078e32371
commit
3bc49e1721
18 files changed
+195
-25
No files matched your search
@@ -1,5 +1,27 @@
|
||||
use crate::sessions::ExternalAgentSessionMigration;
|
||||
use std::path::PathBuf;
|
||||
use std::time::Duration;
|
||||
|
||||
const DEFAULT_SESSION_IMPORT_MAX_AGE: Duration = Duration::from_secs(30 * 24 * 60 * 60);
|
||||
const DEFAULT_SESSION_IMPORT_MAX_COUNT: usize = 50;
|
||||
|
||||
/// Bounds session discovery for an external-agent import.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct ExternalAgentSessionImportLimits {
|
||||
/// Oldest source-session modification age that remains eligible.
|
||||
pub max_age: Duration,
|
||||
/// Maximum number of eligible sessions returned by detection.
|
||||
pub max_sessions: usize,
|
||||
}
|
||||
|
||||
impl Default for ExternalAgentSessionImportLimits {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
max_age: DEFAULT_SESSION_IMPORT_MAX_AGE,
|
||||
max_sessions: DEFAULT_SESSION_IMPORT_MAX_COUNT,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ExternalAgentConfigDetectOptions {
|
||||
|
||||
Reference in new issue
Block a user