Skip to content

fix(polymarket): consume gated legacy health during cutover #515

Description

@proerror77

Parent

#499

Change contract

Make legacy-Python cutover consume the immutable Gate health admission already
validated by gate.json, PASSED.sha256, and the production Gate policy,
instead of requiring another 240-second Python health publication before
promotion or after uploader drain.

Focused failing proof

The exact candidate a8883e08539e6dd3cb7ee9cb42a13d5e922ec77a459c28925f179c4559d6ff8f
passed the formal 900-second Gate and independent immutable/OSS verification.
The first cutover then failed before stopping Python with:

Polymarket cutover failed: cutover requires current fail-closed legacy health

Read-only ECS evidence t-jpn6si0w00wgsg0 confirmed Python remained active at
PID 717442, InvocationID 61712400966544b18b3dfca48b8ea99f, NRestarts 10;
the global Rust binary/control and all shadow/Gate units were absent. The current
atomic health file contained 9/2,778 exact trades HTTP 429 errors, all within the
Gate's bound of 28, but its payload timestamps and write cadence exceed the
cutover script's separate 240-second strict check. That check therefore
reintroduces the Python-cycle wait explicitly removed from the 900-second Gate
contract.

Acceptance criteria

  • Legacy-Python cutover uses the already verified immutable Gate policy and
    marker as the sole health admission evidence.
  • Cutover does not require a new/current Python health publication before
    transition or after uploader drain.
  • Exact Python PID, InvocationID, NRestarts, command, canonical unit, and
    restart-free final stop checks remain before production mutation.
  • The Python runtime identity is checked again after uploader drain and
    immediately before stop.
  • Rust-baseline health verification and rollback verify_fresh_legacy_runtime
    remain strict and unchanged.
  • A focused counterexample test proves a Gate-admitted legacy snapshot cannot
    be rejected later solely because no new Python cycle completed.
  • Gate policy rejection still blocks malformed, mixed-error, excessive-429,
    non-atomic, or identity-drift evidence.

Test seam

deployment/aliyun/test-polymarket-raw-ops-control-plane.sh verifies the cutover
control flow consumes immutable Gate admission, retains exact runtime identity,
and does not call current legacy-health admission in the promotion path.

Out of scope

Changing collector/uploader data behavior, changing the shared legacy or Rust
health policies, changing Gate duration, CI restructuring, research,
snapshot/#235, evaluator/MCTS, production mutation in this PR, or overwriting an
immutable release.

Rollout / rollback impact

After merge, build a new exact-main artifact, repeat the real closed-segment
preflight and 900-second Gate, then complete runtime issue #498. Any failed
identity, Gate, OSS, parity, cutover, or smoke check preserves/restores Python.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingready-for-agentFully specified and safe for an autonomous agent

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions