feature: let `session.archive` set where it writes, so a second Cortex can keep its own sessions
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 54/100
Línea de trabajo
Read the session.archive configuration and cost_ledger.dir handling referenced in the issue, along with laptop-service.md; inspect how the archive chooses its directory and applies the local-install rule. Trace startup logging and the DELETE /v1/sessions loopback restriction. Done means an absolute dir overrides the default locally and enables archiving off a local install only when explicitly set with enabled: true, while existing retention and safety behavior remains intact.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Problem
The session archive always writes to ~/.cortex/sessions, and runs only when Cortex is started from a config inside ~/.cortex. There is no setting for the location.
That rules out keeping sessions on disk for any Cortex other than the one installed in ~/.cortex, for example:
- a second, side-by-side Cortex for development or experiments, run from a scratch directory next to your everyday one (the shape
docs/evolve-plugin-e2e.mduses on ports477xx); - a demo or walkthrough that should keep everything it produces in one directory you can inspect and then delete.
Today such a Cortex keeps sessions in memory only. Restart it and every session is gone, including from agentop observe and the session API.
The only workaround I found is to start the second Cortex with HOME pointed at a scratch directory that contains its own .cortex/, holding a copy of the config and of the CA:
mkdir -p "$WALK/cortex-home/.cortex"
cp -R ~/.cortex/ca "$WALK/cortex-home/.cortex/ca" # copies the CA private key
sed -e 's/127.0.0.1:4760\([0-9]\)/127.0.0.1:4770\1/g' \
-e "s|$HOME/.cortex/ca|$WALK/cortex-home/.cortex/ca|" \
~/.cortex/config.yaml > "$WALK/cortex-home/.cortex/config.yaml"
HOME="$WALK/cortex-home" cortex --config "$WALK/cortex-home/.cortex/config.yaml"
It works: the archive is enabled, sessions survive a restart, and /v1/sessions?archived=true and agentop list them. But it has costs:
- The CA's private key is duplicated into a scratch directory.
HOMEmoves more than the archive: the cost ledger, the plugin store and the price list move too, and anything else keyed on a local install changes with it (memory limit, bundled pricing).- It's hard to explain in a walkthrough, and easy to get subtly wrong.
Proposal
Add a dir to session.archive, mirroring cost_ledger.dir:
session:
archive:
enabled: true
dir: /absolute/path/to/sessions # default ~/.cortex/sessions; a relative path is refused
Behaviour:
dirmust be absolute, refused otherwise with the same reasoning ascost_ledger.dir(a relative path depends on the working directory, not the config).- Off a local install, the archive runs only when both
enabled: trueanddirare set. Withoutdir, the current rule stands, so a cluster still can't turn the archive on just by mounting a volume over~/.cortex. - On a local install,
diroverrides the default location; everything else is unchanged. - Retention,
max_bytesand clearing behave as today.DELETE /v1/sessionskeeps its loopback-only rule, so a non-loopback Cortex with an explicitdirstill can't be cleared over the API, and the startup line keeps saying so. - The startup log line already names the directory, so an operator can see where content is written.
Why this keeps the current safety reasoning
The existing docs (config.SessionArchiveConfig, laptop-service.md) explain why there is no dir: the archive stores raw prompts, completions and tool results, and on a cluster that needs a decision of its own rather than "a mounted path". This proposal keeps that: off a local install, nothing turns on unless someone writes both enabled: true and an explicit absolute dir, which is a decision rather than an accident of a mount. On a laptop, it only lets a user choose where their own history goes.
Alternatives considered
- Keep the
HOMEworkaround. Works, but duplicates the CA key and moves unrelated state; see above. - A
--session-archive-dirflag. Same effect, but the archive's other settings are config, and a flag is invisible in the config a reader inspects. - Save sessions on demand through the API (
GET /v1/sessions/{id}to a file). Fine for one session, but loses restart survival, agentop's archived list and retention.
Open questions
- Should
dirbe allowed to point inside another Cortex's~/.cortex, or refused to avoid two processes sharing one archive? - Should the plugin store and cost ledger get the same treatment, so a side-by-side Cortex can be fully self-contained without touching
HOME?
Context
Related: #1645 (running Cortex without touching the everyday install).
Found while writing a walkthrough that runs a dev Cortex with the evolve plugin next to an everyday install, and wanting its sessions to survive a restart for later inspection. Tested on Cortex evolve-plugin (ab08dda3, on main 8b0facd5), macOS arm64.
- Lenguaje dominante
- Go
- Estrellas
- 23
- Forks
- 44
- Merge medio
- 14 h 38 min
- PR fusionados (30 d)
- 254
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de rossoctl/cortex
-
feature: agentop observe — show a request and its response as one rowPosiblemente ocupada @huang195 la tomó hoy. Abiertoenhancement ux
rossoctl/cortex#1681 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
feature: agentop observe — search user prompts and agent responses across a session's eventsPosiblemente ocupada @huang195 la tomó hoy. Abiertoenhancement ux
rossoctl/cortex#1680 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
feedback laptop
Dificultad 5/5 Más de una semana Aptitud para principiantes 28/100
Los mantenedores suelen responder en 1 día
-
chore: Remove the decline_responses_websockets translation after a deprecation releasePosiblemente ocupada @Alan-Cha la tomó hace 4 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
rossoctl/cortex#1625 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
agentop configure codex/opencode can wait on itself when an agent runs itPosiblemente ocupada @Alan-Cha la tomó hace 10 días. Abierto
rossoctl/cortex#1530 · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de rossoctl/cortex
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
router-for-me/CLIProxyAPI#7330 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug os:ios
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
hajimehoshi/ebiten#4039 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 9 días