Skip to content

fix: preserve managed agent color intent - #132

Merged
myobie merged 8 commits into
mainfrom
schickling-assistant/2026-07-31-managed-agent-color
Jul 31, 2026
Merged

fix: preserve managed agent color intent#132
myobie merged 8 commits into
mainfrom
schickling-assistant/2026-07-31-managed-agent-color

Conversation

@schickling-assistant

@schickling-assistant schickling-assistant commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Why

Managed interactive agents can be reconciled from automation whose command-capture environment sets NO_COLOR. st2 currently forwards that unrelated ambient preference through systemd-run and pty run, so the agent disables ANSI output even though its terminal advertises color support.

The source matters: an ambient value owned by the reconciler should not silently become durable agent policy, while an Agent Spec that explicitly declares NO_COLOR must remain authoritative.

What

  • Remove ambient NO_COLOR from the primary managed agent PTY unless the Agent Spec declares it.
  • Persist that removal in PTY metadata so a restart from a polluted environment cannot reintroduce it.
  • Preserve environment removals when the inner pty run command is wrapped by systemd-run --scope.
  • Leave non-agent tasks unchanged.

How

The canonical agent launch removes NO_COLOR from the live command environment and records --unset-env NO_COLOR in PTY metadata. An explicit Agent Spec assignment remains authoritative and persists through the existing --env path. The isolation wrapper forwards both environment assignments and removals instead of dropping removal entries.

Dependency

Depends on merged PTY main at d5fabc3917407aeb937a012bd97679c303e18033, which contains both the persisted environment-removal contract from compoundingtech/pty#144 and the machine-stream composition from compoundingtech/pty#141. The flake input and development shell are pinned to that exact revision so integration tests cannot accidentally use an older user-profile PTY.

Rollout order is strict: deploy and activate that compatible PTY before deploying this st2. A pre---unset-env PTY may silently ignore the option and launch without persisting the removal, so the initial environment can look correct while a later restart reintroduces the caller ambient value. The Nix input and development shell carry the exact dependency; Cargo installs rely on the documented runtime prerequisite.

Verification

  • Unit TDD covers the persisted removal argument, explicit assignment, non-agent negative control, and isolation-wrapper forwarding.
  • Portable real-PTY coverage launches both Agent Spec variants, restarts them with caller NO_COLOR=1, and observes unset twice for the default agent and 1 twice for the explicit agent.
  • Linux-specific real-systemd-scope coverage repeats the two-boot contract behind a fail-loud prerequisite gate; it cannot silently degrade to pass-through.
  • The R06 specification records ambient-versus-declared NO_COLOR, persisted removal, isolation-wrapper propagation, and non-mutating adoption. Requirements remain unchanged. Nathan explicit approval is requested for adding this exact sentence to R06: “The effective environment includes declared assignments and declared removals. Restart or replacement under a different ambient environment must not reintroduce a value intentionally absent from the launch definition.”
  • The original shell-parameter observer failed under a real scope because systemd expanded it before the shell. The replacement observes NO_COLOR with printenv and an unset fallback.
  • Independent exact-head receipt at 2f8db8a573a2ddf421533a7fd3c973c6139d793c used locally built PTY 0.12.0+d5fabc3: focused unit coverage passed; portable real-PTY and real Linux systemd-scope restart cases passed. Each live case also passed three consecutive times on the runtime-equivalent parent after replacing attached-client exit timing with the durable second snapshot as the receipt. The predecessor 99f7eac742c152a52b3ddb5cbfe080306c3d6253 passed hosted Nix: run 30633306803, job 91164620732.

The current main branch also has unrelated local clean-PATH, formatting, and clippy failures outside this diff; this PR does not change or bypass them.

Posted on behalf of @schickling
field value
agent_name co1-sage
agent_session_id ed878dac-3735-4276-b3e0-ea1b1cd65291
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 st2/schickling-assistant/2026-07-31-managed-agent-color
machine dev3
tooling_profile dotfiles@0fb7e03

@schickling-assistant
schickling-assistant force-pushed the schickling-assistant/2026-07-31-managed-agent-color branch from 6a59470 to 7540325 Compare July 31, 2026 11:42
@schickling
schickling marked this pull request as ready for review July 31, 2026 12:35
@schickling-assistant

Copy link
Copy Markdown
Contributor Author

Nathan, Johannes explicitly asked that the durable VRS—including requirements—cover this work. docs/vrs/spec.md says requirements changes need your explicit approval.

May I update R06 with this additional contract?

The effective environment includes declared assignments and declared removals. Restart or replacement under a different ambient environment must not reintroduce a value intentionally absent from the launch definition.

I would then update the R06 specification section to describe the canonical-agent NO_COLOR policy, explicit-assignment precedence, persisted PTY removal, and adoption remaining non-mutating. No vision change.

Posted on behalf of @schickling
field value
agent_name co1-sage
agent_session_id ed878dac-3735-4276-b3e0-ea1b1cd65291
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 st2/schickling-assistant/2026-07-31-managed-agent-color
machine dev3
tooling_profile dotfiles@0fb7e03

@myobie
myobie marked this pull request as draft July 31, 2026 12:40

@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: 57e26d753d

ℹ️ 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/run.rs
@schickling
schickling marked this pull request as ready for review July 31, 2026 12:43
@myobie
myobie marked this pull request as draft July 31, 2026 12:45
@myobie
myobie marked this pull request as ready for review July 31, 2026 12:52
@schickling-assistant
schickling-assistant force-pushed the schickling-assistant/2026-07-31-managed-agent-color branch from 8ade64a to 6215bf5 Compare July 31, 2026 12:52
@schickling-assistant
schickling-assistant marked this pull request as draft July 31, 2026 12:53
@schickling-assistant

Copy link
Copy Markdown
Contributor Author

@nathanherald — quick approval ping: implementation, hostile-restart proofs, and the updated spec are green against merged PTY main. The only remaining VRS blocker is your explicit approval for the proposed R06 sentence above; Johannes asked us to include protected requirements. A yes/no on that exact wording is enough, and the same approval decision is pending for evals R04/R05 in compoundingtech/evals#63.

Posted on behalf of @schickling
field value
agent_name co1-sage
agent_session_id ed878dac-3735-4276-b3e0-ea1b1cd65291
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 st2/schickling-assistant/2026-07-31-managed-agent-color
machine dev3
tooling_profile dotfiles@0fb7e03

myobie commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@schickling-assistant, is exact head 99f7eac742c152a52b3ddb5cbfe080306c3d6253 ready for review and merge from your side, including its PTY --unset-env dependency?

@schickling-assistant

Copy link
Copy Markdown
Contributor Author

Not quite yet. Fresh exact-compatibility proof found one documentation blocker at 99f7eac: the prior pinned PTY (afeb3b6) does not reject --unset-env; it silently treats/ignores the unknown argument, launches successfully, and records no removal (unsetEnv=null). The initial launch can therefore look correct while a later restart reintroduces the ambient value. I am correcting the rollout wording to describe that partial-compatibility hazard and rerunning the exact receipt/restart proofs.

The other remaining gate is your explicit approval (or rejection) of the proposed protected R06 requirements sentence above. Your two commits establish the implementation/spec direction, but I have not treated them as approval to edit requirements.md because the repository contract asks for that explicitly.

I will give you an exact final head and proof receipt after both are resolved.

Posted on behalf of @schickling
field value
agent_name co1-sage
agent_session_id ed878dac-3735-4276-b3e0-ea1b1cd65291
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 dotfiles/schickling/2026-07-20-cos-misc
machine dev3
tooling_profile dotfiles@0fb7e03

@schickling-assistant

Copy link
Copy Markdown
Contributor Author

@nathanherald — the implementation and merged PTY dependency are green from my side at the new exact head 986dc0f5f95509cce75dfe0920a0587153feeed8.

I preserved your durable second-snapshot receipt and corrected one rollout detail found by fresh review: the prior PTY may silently ignore --unset-env and launch without persisting the tombstone rather than failing before launch. Exact-head proof is green: focused unit 3/3, portable restart 1/1, real systemd user-scope restart 1/1, Cargo all-target/all-feature check, diff check, and local VRS check (with only the inherited Agent Spec anchor warnings).

The PR remains draft solely because the exact protected R06 sentence in the first comment still needs explicit approval. Your readiness question does not unambiguously approve that wording. If you approve that exact requirement change, a direct “yes” is enough; I will apply it and rerun the VRS/static boundary before ready/merge.

Posted on behalf of @schickling
field value
agent_name co1-sage
agent_session_id ed878dac-3735-4276-b3e0-ea1b1cd65291
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 st2/schickling-assistant/2026-07-31-managed-agent-color
machine dev3
tooling_profile dotfiles@0fb7e03

@schickling
schickling marked this pull request as ready for review July 31, 2026 16:03
schickling-assistant and others added 8 commits July 31, 2026 21:39
agent-session-id: ed878dac-3735-4276-b3e0-ea1b1cd65291
agent-tool: Codex CLI
agent-tool-version: 0.145.0
agent-model: unknown
agent-runtime-profile: /nix/store/mnx8agbdq3wiyb6vz63lhgscgazkrn98-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/5r69m9k2llmri3na81518zx0a7y0d3cn-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@0fb7e03
agent-session-id: ed878dac-3735-4276-b3e0-ea1b1cd65291
agent-tool: Codex CLI
agent-tool-version: 0.145.0
agent-model: unknown
agent-runtime-profile: /nix/store/mnx8agbdq3wiyb6vz63lhgscgazkrn98-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/5r69m9k2llmri3na81518zx0a7y0d3cn-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@0fb7e03
agent-session-id: ed878dac-3735-4276-b3e0-ea1b1cd65291
agent-tool: Codex CLI
agent-tool-version: 0.145.0
agent-model: unknown
agent-runtime-profile: /nix/store/mnx8agbdq3wiyb6vz63lhgscgazkrn98-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/5r69m9k2llmri3na81518zx0a7y0d3cn-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@0fb7e03
agent-session-id: ed878dac-3735-4276-b3e0-ea1b1cd65291
agent-tool: Codex CLI
agent-tool-version: 0.145.0
agent-model: unknown
agent-runtime-profile: /nix/store/mnx8agbdq3wiyb6vz63lhgscgazkrn98-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/5r69m9k2llmri3na81518zx0a7y0d3cn-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@0fb7e03
agent-session-id: ed878dac-3735-4276-b3e0-ea1b1cd65291
agent-tool: Codex CLI
agent-tool-version: 0.145.0
agent-model: unknown
agent-runtime-profile: /nix/store/mnx8agbdq3wiyb6vz63lhgscgazkrn98-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/5r69m9k2llmri3na81518zx0a7y0d3cn-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@0fb7e03
agent-session-id: ed878dac-3735-4276-b3e0-ea1b1cd65291
agent-tool: Codex CLI
agent-tool-version: 0.145.0
agent-model: unknown
agent-runtime-profile: /nix/store/mnx8agbdq3wiyb6vz63lhgscgazkrn98-coding-agent-runtime-profile/share/coding-agents/profile.json
agent-skills-manifest: /nix/store/5r69m9k2llmri3na81518zx0a7y0d3cn-agent-skills-corpus/share/agent-skills/manifest.json
tooling-profile: dotfiles@0fb7e03
@schickling-assistant
schickling-assistant force-pushed the schickling-assistant/2026-07-31-managed-agent-color branch from 986dc0f to 2f8db8a Compare July 31, 2026 19:41
@schickling-assistant

Copy link
Copy Markdown
Contributor Author

@nathanherald — #132 is now ready for review at rebased exact head 2f8db8a573a2ddf421533a7fd3c973c6139d793c on current st2/main (3744c42e). Your restart-receipt and rollout-order commits are preserved; the corrected legacy-PTY compatibility wording is included. Rebased proof is green: focused units 3/3, portable restart 1/1, real systemd user-scope restart 1/1, Cargo all-target/all-feature check, diff check, and VRS check.

The PR body now consolidates the exact proposed protected R06 sentence for your explicit approval or revision. Per Johannes, that approval remains visible but no longer holds the implementation-ready PR in draft.

Posted on behalf of @schickling
field value
agent_name co1-sage
agent_session_id ed878dac-3735-4276-b3e0-ea1b1cd65291
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 st2/schickling-assistant/2026-07-31-managed-agent-color
machine dev3
tooling_profile dotfiles@0fb7e03

@myobie

myobie commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Nathan accepts the current exact head 2f8db8a573a2ddf421533a7fd3c973c6139d793c and its current specification text. This accepts the implementation-ready PR as written; it does not add the separate proposed requirements.md sentence. I am merging this exact head now. Deployment remains ordered: activate a compatible PTY before this st2 revision.

@myobie
myobie merged commit 8ca0f36 into main Jul 31, 2026
1 check passed
@myobie
myobie deleted the schickling-assistant/2026-07-31-managed-agent-color branch July 31, 2026 20:14
@schickling-assistant

Copy link
Copy Markdown
Contributor Author

Merged at the exact reviewed head. Thank you, Nathan, for the durable restart receipt, rollout-order correction, and the explicit requirements boundary — this lands the behavior without pretending the separate R06 wording was approved.

celebration

Posted on behalf of @schickling
field value
agent_name co1-sage
agent_session_id ed878dac-3735-4276-b3e0-ea1b1cd65291
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 dotfiles/schickling/2026-07-20-cos-misc
machine dev3
tooling_profile dotfiles@0fb7e03

@schickling schickling added area:pty PTY sessions and terminal integration · Set: manual area:reconcile Supervisor run loop, lifecycle, restart, park, and teardown · Set: manual origin:agent Filed or primarily produced by an AI agent · Set: manual type:bug Something broken or a regression · 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:pty PTY sessions and terminal integration · Set: manual area:reconcile Supervisor run loop, lifecycle, restart, park, and teardown · Set: manual origin:agent Filed or primarily produced by an AI agent · Set: manual type:bug Something broken or a regression · Set: manual

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants