fix(agent-access): tighten stop session id validation #110

Merged
pdurlej merged 2 commits from codex/issues/79-stop-session-id into main 2026-05-07 12:33:55 +02:00
Collaborator

Canary status: approve_merge — 6/6 reviewers OK on 06829460c8.

Canary Context Pack

Product story

Agent-access session commands should use one canonical session-id shape. After list/prune hardening, --stop remained more permissive than the IDs generated by the wrapper, which creates unnecessary audit ambiguity.

What changed

  • Removed the looser STOP_SESSION_ID_PATTERN.
  • --stop <session-id> now uses the same canonical SESSION_ID_PATTERN as generated/listed/pruned sessions.
  • Added a regression test that TT-12345678 fails with invalid session id before filesystem lookup.

Why it changed

This closes a small lifecycle-hardening residue from #79 and prior canary weak signals without touching prune/list behavior.

Files touched

  • scripts/agent-access/codex-openclaw-ssh-agent
  • control-plane/platformctl/tests/test_agent_access_ssh_agent.py

Relevant context

  • Parent #79: session lifecycle hardening.
  • Issue #109: tighten stop session id validation.
  • #84/#90: startup/signal cleanup merged.
  • #93: --list merged.
  • #108: conservative --prune merged.
  • Security-sensitive lane from #82 applies.

Runtime evidence

  • PYTHONPATH=control-plane pytest -q control-plane/platformctl/tests/test_agent_access_ssh_agent.py -> 18 passed
  • PYTHONPATH=control-plane pytest -q control-plane/platformctl/tests -> 177 passed
  • git diff --check origin/main -> pass
  • Current diff secret-pattern scan -> pass

Known constraints

This is only validation tightening. It may reject previously accepted malformed stop IDs, but those IDs were never produced by the wrapper's session creation path.

Explicit out-of-scope

  • No --list/--prune behavior changes.
  • No live socket probing.
  • No TTL policy changes.
  • No Infisical, Forgejo PAT, CI, or OpenClaw runtime changes.

Requested decision

Approve merge if canary confirms the validator tightening is safe and the existing valid stop flow remains covered.

Merge blockers

  • Breaking stop for canonical wrapper-generated session IDs.
  • Secret leakage in validation/error paths.
  • Any accidental change to list/prune semantics.

Spec sources read

  • Issue #79 — parent lifecycle hardening scope.
  • Issue #109 — child scope and acceptance criteria.
  • scripts/agent-access/codex-openclaw-ssh-agent — implementation target.
  • control-plane/platformctl/tests/test_agent_access_ssh_agent.py — wrapper test harness.
  • Prior canary outputs for lifecycle slices — weak signal on looser stop validator.

Closes #109
Refs #79

Canary status: approve_merge — 6/6 reviewers OK on 06829460c80bed29d99eba8ba3995c19662f1c82. ## Canary Context Pack ### Product story Agent-access session commands should use one canonical session-id shape. After list/prune hardening, `--stop` remained more permissive than the IDs generated by the wrapper, which creates unnecessary audit ambiguity. ### What changed - Removed the looser `STOP_SESSION_ID_PATTERN`. - `--stop <session-id>` now uses the same canonical `SESSION_ID_PATTERN` as generated/listed/pruned sessions. - Added a regression test that `TT-12345678` fails with `invalid session id` before filesystem lookup. ### Why it changed This closes a small lifecycle-hardening residue from #79 and prior canary weak signals without touching prune/list behavior. ### Files touched - `scripts/agent-access/codex-openclaw-ssh-agent` - `control-plane/platformctl/tests/test_agent_access_ssh_agent.py` ### Relevant context - Parent #79: session lifecycle hardening. - Issue #109: tighten stop session id validation. - #84/#90: startup/signal cleanup merged. - #93: `--list` merged. - #108: conservative `--prune` merged. - Security-sensitive lane from #82 applies. ### Runtime evidence - `PYTHONPATH=control-plane pytest -q control-plane/platformctl/tests/test_agent_access_ssh_agent.py` -> `18 passed` - `PYTHONPATH=control-plane pytest -q control-plane/platformctl/tests` -> `177 passed` - `git diff --check origin/main` -> pass - Current diff secret-pattern scan -> pass ### Known constraints This is only validation tightening. It may reject previously accepted malformed stop IDs, but those IDs were never produced by the wrapper's session creation path. ### Explicit out-of-scope - No `--list`/`--prune` behavior changes. - No live socket probing. - No TTL policy changes. - No Infisical, Forgejo PAT, CI, or OpenClaw runtime changes. ### Requested decision Approve merge if canary confirms the validator tightening is safe and the existing valid stop flow remains covered. ### Merge blockers - Breaking stop for canonical wrapper-generated session IDs. - Secret leakage in validation/error paths. - Any accidental change to list/prune semantics. ## Spec sources read - Issue #79 — parent lifecycle hardening scope. - Issue #109 — child scope and acceptance criteria. - `scripts/agent-access/codex-openclaw-ssh-agent` — implementation target. - `control-plane/platformctl/tests/test_agent_access_ssh_agent.py` — wrapper test harness. - Prior canary outputs for lifecycle slices — weak signal on looser stop validator. Closes #109 Refs #79
fix(agent-access): tighten stop session id validation
All checks were successful
canary-required / collect-diff (pull_request) Successful in 3s
pyfallow / Pyfallow gate (control-plane) (pull_request) Successful in 16s
python-ci / Python 3.11 (pull_request) Successful in 32s
python-ci / Python 3.12 (pull_request) Successful in 33s
python-ci / Python 3.13 (pull_request) Successful in 33s
canary-required / canary (pull_request) Successful in 12s
06829460c8
Author
Collaborator

Canary 3+3 result: approve_merge on 06829460c80bed29d99eba8ba3995c19662f1c82.

Evidence:

  • Review command completed successfully.
  • 6/6 reviewers OK: tech-gpt, tech-claude, tech-glm, product-claude, product-glm, product-gpt.
  • Focused tests: 18 passed.
  • Full platformctl tests: 177 passed.

Non-blocking follow-ups noted by reviewers:

  • Consider making the invalid session id error message more operator-friendly.
  • Consider symmetric lifecycle tests for list/prune canonical id behavior if those surfaces gain id-targeted inputs later.
Canary 3+3 result: approve_merge on `06829460c80bed29d99eba8ba3995c19662f1c82`. Evidence: - Review command completed successfully. - 6/6 reviewers OK: tech-gpt, tech-claude, tech-glm, product-claude, product-glm, product-gpt. - Focused tests: 18 passed. - Full platformctl tests: 177 passed. Non-blocking follow-ups noted by reviewers: - Consider making the invalid session id error message more operator-friendly. - Consider symmetric lifecycle tests for list/prune canonical id behavior if those surfaces gain id-targeted inputs later.
Merge branch 'main' into codex/issues/79-stop-session-id
All checks were successful
canary-required / collect-diff (pull_request) Successful in 3s
pyfallow / Pyfallow gate (control-plane) (pull_request) Successful in 16s
python-ci / Python 3.11 (pull_request) Successful in 31s
python-ci / Python 3.12 (pull_request) Successful in 31s
python-ci / Python 3.13 (pull_request) Successful in 33s
canary-required / canary (pull_request) Successful in 13s
41890a1ea4
Sign in to join this conversation.
No reviewers
No labels
W6d-automerge-calibration
agent/claude-code
agent/codex
agent/hermes
agent/iskra
agent/ollama
agent/patchwarden
automerge-candidate
class/security-sensitive
cutover-gate
dependency/blocked
dependency/blocks-others
dependency/cross-repo
dependency/needs-confirmation
domain:agents
domain:ci
domain:docs
domain:forgejo
domain:infra
domain:memory
domain:runtime
domain:signal
domain:ux
flow/architecture
flow/blocked
flow/deployed
flow/done
flow/implementation
flow/intake
flow/maintained
flow/observed
flow/ready
flow/refining
flow/retired
flow/review
iterating
judge/codex-candidate
judge/hermes-candidate
judge/low-confidence
judge/needs-refinement
judge/operator-needed
judge/p0
judge/p1
judge/p2
judge/p3
judge/park
judge/patchwarden-candidate
judge/stale-priority
kind/adr
kind/bug
kind/chore
kind/feature
kind/infra
kind/ops
kind/refactor
kind/research
large-impact
merge/auto
merge/manual
merge/manual-dependency-conflict
merge/manual-failing-tests
merge/manual-merge-conflict
merge/manual-missing-review
merge/manual-operator-preference
merge/manual-red-zone
merge/manual-security-sensitive
merge/manual-unclear-scope
merge/manual-unknown
meta
mode:operator-only
mode:patchwarden-iskra-approved
mode:safe-auto
needs-operator-decision
needs-triage
not-ready
observed/erroring
observed/needs-followup
observed/pending
observed/retire-candidate
observed/unused
observed/used
operator-emotional
owner-attention
phase/02
phase/03
priority:p0
priority:p1
priority:p2
priority:p3
proposed
ready-for-agent
ready-for-operator
recovery
review:claude-reviewed
review:codex-reviewed
review:dziadek-reviewed
review:needs-human
risk/exposure
risk/process
risk/product
risk/runtime
safety:external-write
safety:no-prod-mutation
safety:prod-impact
safety:secret-touch
size/large
size/medium
size/small
size/tiny
size/unknown
source/adr
source/agent-generated
source/manual
source/operator-chat
source/voice-note
status:blocked
status:codex-ready
status:merged:pending-evidence
status:needs-evidence
status:operator-needed
status:parked
tier/full
tier/lite
tier/stacked
tier:0-platform-substrate
tier:1-iskra-value-layer
tier:2-tools-products-modules
type:bug
type:chore
type:docs
type:feat
type:policy
type:research
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pdurlej/platform!110
No description provided.