Skip to content

refactor(cp): post-v1 hardening follow-ups from #1528 self-review #1530

Closed as not planned

Description

@chaodu-agent

Description

Non-blocking hardening items recorded during the round-3 self-review of #1528 (Agent Control Plane v1). None is a correctness, auth, or data-loss defect on a conforming deployment; they were classified SCOPE EXPANSION under docs/review-contract.md and deferred here rather than blocking the roll-up.

  1. Verify a pre-existing managed parent dir. prepare_socket_dir_with_managed_parent (crates/openab-core/src/control_plane/local.rs, NotFound arm): when $HOME/.openab already exists but run/ does not, the intermediate dir is not run through the same is_dir / uid == getuid() / mode & 0o077 == 0 checks the final dir gets. Reuse the Ok(meta) verification on the managed parent before create_dir(run).
  2. Duplicate guard on the spawn-ack path. primary.rs on_reply (Spawn ack) inserts into tracked / tracked_order without the contains_key guard on_delegate_result has. A non-conforming CP replaying (delegation_id, admission) would orphan accounted_bytes and leave a permanent duplicate in tracked_order. Reject with CommandError::Internal and warn!.
  3. Read the cap under the lock. executor.rs admit() reads effective_max() before lock_inflight(), so a concurrent re-register ack can decide one admission against a stale ceiling (off-by-one at most). Move the read below the lock.
  4. Single source of truth for the deadline window. 1..=1800 is repeated as literals in local.rs, src/main.rs (clap range) and the MCP JSON schema in src/cp_tools.rs. Export one pub const from openab_core::control_plane::local and assert the schema against it in a test.
  5. Garbled bail! string. crates/openab-cp/src/config.rs max_frame_bytes validation message contains a long literal run of spaces (missing \ continuation); the test only asserts contains("bundled runtime minimum") so it hides the defect. Fix the string and tighten the test.
  6. Heartbeat test margin. crates/openab-core/tests/cp_client.rs::heartbeats_keep_the_lease_alive asserts expired(2s).is_empty() after a 3.5 s real sleep with a 1 s heartbeat cadence — ~1 s margin under CI load. Widen the ratio or drive the sweep deterministically like the re-register test does.

Use Case

Keeps the CP runtime client at the verify-never-modify / bounded-state standard the v1 contract set, and removes a flake-prone timing assertion from the default cargo test loop. Refs #1528, #1474, #1475.

Activity

  1. chaodu-agent commented on Sep 10, 2026

    @chaodu-agent
    CollaboratorAuthor

    Items 2 (spawn-ack duplicate guard) and 3 (admit() reads the cap under the lock) were closed in #1528 c061158 alongside the round-4 fixes; regression test a_repeated_admission_in_a_delegate_ack_is_rejected_not_overwritten covers item 2. Items 1, 4, 5, 6 remain open here.

  2. github-actions commented on Sep 25, 2026

    @github-actions

    This issue has been open for more than 14 days with no linked pull request, so it is being closed as not planned.

    If this is still needed, please open a new issue with updated context and reference this closed issue instead of reopening it. A linked PR is the strongest signal that the work matters.

  3. added
    auto-closed-staleClosed by stale automation; reopening grants a permanent exemption
    and removed
    stale-close-pendingStale-close transaction in progress; recovered on next run if interrupted
    on Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions