Skip to content

emrg: a scheduled task's session id is its task name, without the emrg-evolution- prefix #2353

Closed

Description

@how2how2how2-arch

Observed

Every scheduled task's session id is built as emrg-evolution-{task name} in emrg/server/scheduler.py at three sites:

  • :933 — "session_id": f"emrg-evolution-{self.name}" in the derived config;
  • :979 — the same shape as the property's fallback;
  • :3309 — f"emrg-evolution-{record.get('name')}" in _idle_status, for a task that has no handler yet.

On an installation with four tasks that produces emrg-evolution-emrg-task, emrg-evolution-competition-task, emrg-evolution-silicon-science-cs-journal-task, emrg-evolution-silicon-science-cs-promote-task — visible in the GUI's session list and in every path under .emrg/sessions/.

Where observed: this repository, 2026-10-17, on the installation that runs those four tasks.

Why the prefix earns nothing

The task name is already unique: it is the key of tasks.yml, the key of the next-run/<name>.json file, and the name the scheduler reports everywhere. Interactive sessions are s_260808_0857_387c852f, so a bare task name cannot collide with one. The prefix therefore buys no disambiguation; it lengthens every id, takes room in the session list, and makes a task's history path read like an internal identifier rather than a name.

Expected

A scheduled task's session id is its task name and nothing else.

What the change must satisfy

  1. The three constructions in emrg/server/scheduler.py return the bare task name, and the comments that spell the old shape are corrected: emrg/session.py:77, emrg/server/scheduler.py:189, :2516, :3430, emrg/server/daemon.py:2258, :3772.

  2. The GUI's session-id check stops restricting the id's form. emrg/gui/daemon_client.js:109 holds

    const SESSION_ID_RE = /^(s_\d{6}_\d{4}_[0-9a-f]{4,8}|emrg-evolution-[A-Za-z0-9_-]+)$/;

    and emrg/gui/main.js:287 uses it to validate every session id crossing IPC. A bare task name does not match that pattern, so without this change the GUI could not open a task's session at all.

    The id's shape is not to be checked. What must remain is path safety, which is a different question: the id becomes a directory name (Session.__init__ builds cwd/.emrg/sessions/<id>), so refusing an empty string, a path separator, or a .. segment is about not escaping that directory — not about which names are permitted. A naming whitelist is what goes away; the traversal guard is not a naming rule and stays.

  3. No migration. A machine that already has emrg-evolution-<name> directories keeps them on disk unread, and the next run starts a session under the bare name. No rename, no lookup of the old name as a fallback.

  4. Tests and fixtures that spell the old id are updated. Historical records that quote an id as it was at the time (host-message tables in tests/) are evidence, not fixtures, and stay as they are.

Acceptance

A newly started task's session id is its task name and nothing else. The GUI opens that session instead of rejecting it, the TUI's session list shows it, and the task's history lives at <cwd>/.emrg/sessions/<task name>/. On a machine that still has an old emrg-evolution-<name> directory present, tasks run without error and simply begin a fresh session under the new name.

Activity

  1. how2how2how2-arch commented on Oct 17, 2026

    @how2how2how2-arch
    CollaboratorAuthor

    Handled by #2354

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions