Skip to content

feat(cli): add attach-only mode - #123

Merged
myobie merged 2 commits into
compoundingtech:mainfrom
schickling-assistant:schickling-assistant/2026-07-30-attach-only
Jul 30, 2026
Merged

feat(cli): add attach-only mode#123
myobie merged 2 commits into
compoundingtech:mainfrom
schickling-assistant:schickling-assistant/2026-07-30-attach-only

Conversation

@schickling-assistant

Copy link
Copy Markdown
Contributor

Why

pty attach currently prompts to restart retained dead-session metadata. A
TTY-backed relay can remain at that prompt after its target dies, then consume
later input intended for the target as permission to execute the stored command.

Closes #122.

What

Add pty attach --no-restart <ref> as an explicit attach-only policy:

  • running sessions attach normally;
  • missing, exited, and vanished sessions exit nonzero without prompting;
  • an attached client exits with the daemon and cannot start a second
    incarnation.

The existing interactive prompt and --auto-restart behavior remain unchanged.
Focused help, generated completion metadata, README usage, and the changelog
document the new flag.

How

The CLI now models attach restart behavior as a three-state policy:
prompt | always | never. The never branch refuses before entering the
dead-session presentation/restart path, so it does not display or execute
retained launch metadata. Contradictory --no-restart --auto-restart input is
rejected.

Rationale

This keeps the safety policy at the CLI boundary where the unsafe prompt exists,
while leaving the lower-level attach client and the existing interactive
contract intact.

Tests

  • npm run typecheck
  • npm run build
  • npx vitest run tests/attach-no-restart.test.ts tests/help.test.ts tests/completions.test.ts tests/nesting-prevention.test.ts (57 passed)
  • nix build .#pty --no-link
  • Full local suite: 1,430 passed, 20 skipped, 4 environment-dependent failures
    in untouched shell/screenshot tests (zsh absent from the local Nix dev shell;
    local Vim resolves to Neovim and Vim/nano terminal-query screenshots time out).

The new regression suite covers missing, exited, vanished, running-then-exited,
delayed-input/no-second-incarnation, default interactive compatibility, and
--auto-restart compatibility.

Companion eval coverage: compoundingtech/evals#42.

Posted on behalf of @schickling
field value
agent_name co2-bear
agent_session_id a078daee-6f98-4916-91a8-d21291407789
agent_tool Codex CLI
agent_tool_version 0.145.0
agent_runtime Codex CLI 0.145.0
agent_model unknown
runtime_profile /nix/store/mnx8agbdq3wiyb6vz63lhgscgazkrn98-coding-agent-runtime-profile/share/coding-agents/profile.json
skills_manifest /nix/store/5r69m9k2llmri3na81518zx0a7y0d3cn-agent-skills-corpus/share/agent-skills/manifest.json
worktree pty-attach-only/schickling-assistant/2026-07-30-attach-only
machine dev3
tooling_profile dotfiles@0fb7e03

@schickling
schickling marked this pull request as ready for review July 30, 2026 08:27

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 22409acd12

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/completions.ts
@schickling-assistant
schickling-assistant marked this pull request as draft July 30, 2026 08:41
@schickling
schickling marked this pull request as ready for review July 30, 2026 08:52
@schickling-assistant
schickling-assistant marked this pull request as draft July 30, 2026 08:55
@myobie
myobie marked this pull request as ready for review July 30, 2026 12:14
@myobie
myobie merged commit afeb3b6 into compoundingtech:main Jul 30, 2026
2 checks passed
myobie pushed a commit to compoundingtech/evals that referenced this pull request Jul 30, 2026
Validated after compoundingtech/pty#123 landed as afeb3b6234b7010b7db802fd029766ad17c14219. The merged PTY tree is identical to authorized head 36547b02c32116cca81df4147a638da7df6981a5. Scoped attach-only cell passed 8/8; KDL, semantic, harness, overnight, catalog, and PII gates passed. No paid provider was launched.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pty attach needs an explicit attach-only/no-restart mode

2 participants