Skip to content

feat(catalog): declare the authoritative PTY registry - #66

Merged
schickling-assistant merged 1 commit into
mainfrom
schickling-assistant/2026-07-29-catalog-pty-root-v2
Jul 29, 2026
Merged

feat(catalog): declare the authoritative PTY registry#66
schickling-assistant merged 1 commit into
mainfrom
schickling-assistant/2026-07-29-catalog-pty-root-v2

Conversation

@schickling-assistant

Copy link
Copy Markdown
Contributor

Closes #31.

This is the bounded custom-PTY-root half of #45, rebased onto current main.
The teardown half of that older PR was already implemented independently on
main, so it is intentionally absent here.

Problem

The supervisor can run with an explicit shared PTY_ROOT, while an independent
reader such as st2 pty, st2 env, or st2 doctor falls back to
<catalog>/pty. The same catalog then has two answers for where its live tasks
are. In the current dotfiles rollout this made the supervisor's seats visible in
the global registry while st2 pty list --json returned [].

Contract

An optional <catalog>/catalog.kdl declares the registry:

catalog {
  pty-root "/run/agents/pty"
}

Resolution is:

  1. explicit ambient PTY_ROOT;
  2. the catalog declaration;
  3. <catalog>/pty.

The ambient override remains first so hermetic eval partitions keep working.
st2 validate rejects unknown catalog fields, preventing a typo from silently
recreating a split registry.

Verification

  • Real red/green E2E against the same isolated native PTY:
    • current main: st2 pty list --json returned [];
    • this branch: returned the running st2-root-contract-e2e session.
  • cargo test --lib --test catalog_config: 152 library tests and 3 catalog
    integration tests passed.
  • nix flake check -L: exit 0; all six x86_64-linux checks passed.
  • git diff --check origin/main...HEAD: passed.

No live catalog, service, or PTY registry was changed.

Posted on behalf of @schickling
field value
agent_name co2-shale
agent_session_id 591448c4-5967-4b12-ae43-1c6320dc1d25
agent_tool Codex CLI
agent_tool_version 0.145.0
agent_runtime Codex CLI 0.145.0
agent_model unknown
runtime_profile /nix/store/v2g542rika3abxn98x5yimz431j5br13-coding-agent-runtime-profile/share/coding-agents/profile.json
skills_manifest /nix/store/3aq75z8arl44fsvn49i2k4yqlzb1kcwb-agent-skills-corpus/share/agent-skills/manifest.json
worktree st2/schickling-assistant/2026-07-29-catalog-pty-root-v2
machine dev3
tooling_profile dotfiles@unknown-dirty

A catalog's session registry was only expressible as ambient environment:
`effective_pty_root` took an exported `PTY_ROOT`, else `<catalog>/pty`. A host
that wants one shared registry across catalogs therefore has to export the root
into every process that will ever read the catalog, and a reader that misses it
resolves a different registry — `doctor` then reports a live agent's task as
dead, which is the wrong diagnosis from the one command whose job is diagnosis.

`<catalog>/catalog.kdl` lets the folder say it itself:

  catalog {
    pty-root "/run/agents/pty"
  }

Resolution becomes exported `PTY_ROOT` → declaration → `<catalog>/pty`. Ambient
still wins so an eval run keeps its short decoupled partition, and a catalog
that declares nothing is byte-for-byte unchanged.

`st2 env`/`pty`/`shell` follow the declaration but not the ambient value: they
describe the catalog to bus-aware tools rather than echo the caller's registry.

The file is not a spec — `catalog` is not an `agent` node and `parse_spec`
rejects it as a top-level node — so a declaring catalog is still dispatched as a
catalog, pinned by a test. A mistyped field would resolve silently back to
`<catalog>/pty` and reproduce the exact symptom this fixes, so the field set is
closed and `st2 validate` fails it; the runtime path stays on the native root
rather than inventing one mid-teardown.
@schickling-assistant
schickling-assistant merged commit 33d159b into main Jul 29, 2026
1 check passed
@myobie

myobie commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

@schickling-assistant this should be per-machine, so I think it should be in:

  # agents/<host>/config.kdl
  host {
    pty-root "$CATALOG/pty"
  }

I'll prepare a PR and add you as reviewer.

@myobie
myobie deleted the schickling-assistant/2026-07-29-catalog-pty-root-v2 branch July 29, 2026 21:52
@schickling schickling added area:catalog Catalog structure, declarations, transactions, and admission · Set: manual area:pty PTY sessions and terminal integration · Set: manual origin:agent Filed or primarily produced by an AI agent · Set: manual type:feature New user-visible or system capability · Set: manual labels Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:catalog Catalog structure, declarations, transactions, and admission · Set: manual area:pty PTY sessions and terminal integration · Set: manual origin:agent Filed or primarily produced by an AI agent · Set: manual type:feature New user-visible or system capability · Set: manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A catalog cannot declare its pty root, so a shared session registry makes doctor red

3 participants