Skip to content

B4.1: Serialize PTY resize with finite output frontiers - #71

Open
omry wants to merge 1 commit into
pr70from
pr71
Open

omry wants to merge 1 commit into
pr70from
pr71

Conversation

@omry

@omry omry commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner

Apply TIOCSWINSZ after the already-admitted PTY prefix and its covering mark,
then acknowledge the exact dimensions and output offset. Preserve accepted
Starting resizes through phase handoffs, retain fatal resize-failed errors,
and let the existing drain supersede unapplied work.

Validate actual PTY dimensions, raw output, continuous producers, start and
completion crossings, ioctl failure and drain ordering. Exercise real Bash
SIGWINCH and ordinary return on all three qualified Linux/amd64 targets.


@omry
omry changed the base branch from main to pr70 October 16, 2026 04:26
@omry
omry added this pull request to stack #44 October 16, 2026 04:27
Comment thread runtime/envoy/session/start_linux.go Outdated
@omry

omry commented Oct 16, 2026 •

Copy link
Copy Markdown
Owner Author

PR-cycle state — maintained automatically. Do not edit by hand.

Mechanical PR-cycle state (JSON)
{
  "approval": {
    "candidate_revision_fingerprint": "sha256:e3992a17b5b882276e565a72b59e1dd18a269980b35b055fdfa264d04f1d4b6e",
    "evidence": {
      "attestations": [
        {
          "closure_identity": "sha256:5c2621aa3b5cc34bc4448d1876166e870dd10eaab839ef3c4f3fda5123f9dcb3",
          "document_identity": "sha256:9089495c887132f510fc0e55d960cf0395b1ea56d135de694095f98466716833",
          "sidecar_identity": "sha256:8c4c8a483925b2659899930058caccf7f6f0873585af40280d3cd97376791cc4"
        },
        {
          "closure_identity": "sha256:5c2621aa3b5cc34bc4448d1876166e870dd10eaab839ef3c4f3fda5123f9dcb3",
          "document_identity": "sha256:98b4fdc917f0807c30de93d32cf1f4b0cc32a8bb68d1c1b3d8bf1cdb267af525",
          "sidecar_identity": "sha256:52adcd1fbcefbdc34b749d4b249b37aef8959e93a9413e61b5bb0aaa4929a80b"
        },
        {
          "closure_identity": "sha256:5c2621aa3b5cc34bc4448d1876166e870dd10eaab839ef3c4f3fda5123f9dcb3",
          "document_identity": "sha256:9fc71791194e4e7e20cadb4c71d4900309bb4b40863759fb6de5bb6f8996a8f8",
          "sidecar_identity": "sha256:7910c7b9ead462b1ee566a56ed977555fee3cd3446067272d530e4dc48fbf958"
        },
        {
          "closure_identity": "sha256:5c2621aa3b5cc34bc4448d1876166e870dd10eaab839ef3c4f3fda5123f9dcb3",
          "document_identity": "sha256:f064097e51591052bd1ae470bcb5cd8e8a8265df4089651fecba2a32159b0c24",
          "sidecar_identity": "sha256:a88b3f115e0723f633eed27a9ee8b30cfe16773bda3ff1ee41aa1ac6e8edff86"
        }
      ],
      "candidate_revision_fingerprint": "sha256:e3992a17b5b882276e565a72b59e1dd18a269980b35b055fdfa264d04f1d4b6e",
      "check_conclusions": [
        {
          "conclusion": "SUCCESS",
          "name": "Envoy Go",
          "run_id": 116822397780
        },
        {
          "conclusion": "SUCCESS",
          "name": "Gitar",
          "run_id": 116822392565
        },
        {
          "conclusion": "SUCCESS",
          "name": "Package build",
          "run_id": 116822397674
        },
        {
          "conclusion": "SUCCESS",
          "name": "Python tests",
          "run_id": 116822397743
        },
        {
          "conclusion": "SUCCESS",
          "name": "Recording integration",
          "run_id": 116822397521
        },
        {
          "conclusion": "SUCCESS",
          "name": "Website docs",
          "run_id": 116822397824
        }
      ],
      "delivery_deferral_ledger_digest": "sha256:4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945",
      "finding_dispositions_digest": "sha256:9543636e4120d8ebbf62062705689a5a42290772ab04ac0e8427985098d66af7",
      "operation_identity": "sha256:2502956da5d661a66a7b7de1cd50e8fa2da4164beb03c0ea2203d182da6ef592",
      "review_request": {
        "body_digest": "sha256:cb379de0861c8cadf2ab5096b5cbb6d7d4de6ec981ecd2b72654d9eecd36a6da",
        "id": 6208690810
      },
      "review_result": {
        "body_digest": "sha256:65ce718b8202411f72c831eb4c245014589324c59aac6054725d357c8378d577",
        "id": 6208736881
      }
    },
    "evidence_fingerprint": "sha256:21ae268046f5c0b6d100aa0c8d29ed0da1b6f9b89c6039e6dbad073e55ada3ba",
    "head_sha": "a4fe9fa64ecdc5b1c00bb590d9d10c5920287a70",
    "operation_identity": "sha256:2502956da5d661a66a7b7de1cd50e8fa2da4164beb03c0ea2203d182da6ef592",
    "review_request_id": 6208690810,
    "review_result_id": 6208736881,
    "status": "approved-evidence-recorded"
  },
  "candidate_revision_fingerprint": "sha256:e3992a17b5b882276e565a72b59e1dd18a269980b35b055fdfa264d04f1d4b6e",
  "check_conclusions": [
    {
      "conclusion": "SUCCESS",
      "name": "Envoy Go",
      "run_id": 116822397780
    },
    {
      "conclusion": "SUCCESS",
      "name": "Gitar",
      "run_id": 116822392565
    },
    {
      "conclusion": "SUCCESS",
      "name": "Package build",
      "run_id": 116822397674
    },
    {
      "conclusion": "SUCCESS",
      "name": "Python tests",
      "run_id": 116822397743
    },
    {
      "conclusion": "SUCCESS",
      "name": "Recording integration",
      "run_id": 116822397521
    },
    {
      "conclusion": "SUCCESS",
      "name": "Website docs",
      "run_id": 116822397824
    }
  ],
  "check_observations": [
    {
      "checks": [
        {
          "conclusion": "SUCCESS",
          "name": "Envoy Go",
          "run_id": 116810901629,
          "run_status": "completed",
          "status": "success",
          "url": "https://github.com/omry/omegaflow/actions/runs/38850655285/job/116810901629"
        },
        {
          "conclusion": "SUCCESS",
          "name": "Gitar",
          "run_id": 116810905751,
          "run_status": "completed",
          "status": "success",
          "url": "https://github.com/omry/omegaflow/runs/116810905751"
        },
        {
          "conclusion": "SUCCESS",
          "name": "Package build",
          "run_id": 116810901456,
          "run_status": "completed",
          "status": "success",
          "url": "https://github.com/omry/omegaflow/actions/runs/38850655285/job/116810901456"
        },
        {
          "conclusion": "SUCCESS",
          "name": "Python tests",
          "run_id": 116810900979,
          "run_status": "completed",
          "status": "success",
          "url": "https://github.com/omry/omegaflow/actions/runs/38850655285/job/116810900979"
        },
        {
          "conclusion": "SUCCESS",
          "name": "Recording integration",
          "run_id": 116810901338,
          "run_status": "completed",
          "status": "success",
          "url": "https://github.com/omry/omegaflow/actions/runs/38850655285/job/116810901338"
        },
        {
          "conclusion": "SUCCESS",
          "name": "Website docs",
          "run_id": 116810901351,
          "run_status": "completed",
          "status": "success",
          "url": "https://github.com/omry/omegaflow/actions/runs/38850655285/job/116810901351"
        }
      ],
      "head_sha": "776ff78fc8e679af783121abc0fc1b8d3f14fcd4",
      "id": "sha256:c3d0851f2bf246e92b519efd8d8a711fdf9eeaac53c17d24a6e329ca89ca380a",
      "required_checks": [
        "Envoy Go",
        "Gitar",
        "Package build",
        "Python tests",
        "Recording integration",
        "Website docs"
      ],
      "status": "success"
    },
    {
      "checks": [
        {
          "conclusion": "SUCCESS",
          "name": "Envoy Go",
          "run_id": 116822397780,
          "run_status": "completed",
          "status": "success",
          "url": "https://github.com/omry/omegaflow/actions/runs/38854361407/job/116822397780"
        },
        {
          "conclusion": "SUCCESS",
          "name": "Gitar",
          "run_id": 116822392565,
          "run_status": "completed",
          "status": "success",
          "url": "https://github.com/omry/omegaflow/runs/116822392565"
        },
        {
          "conclusion": "SUCCESS",
          "name": "Package build",
          "run_id": 116822397674,
          "run_status": "completed",
          "status": "success",
          "url": "https://github.com/omry/omegaflow/actions/runs/38854361407/job/116822397674"
        },
        {
          "conclusion": "SUCCESS",
          "name": "Python tests",
          "run_id": 116822397743,
          "run_status": "completed",
          "status": "success",
          "url": "https://github.com/omry/omegaflow/actions/runs/38854361407/job/116822397743"
        },
        {
          "conclusion": "SUCCESS",
          "name": "Recording integration",
          "run_id": 116822397521,
          "run_status": "completed",
          "status": "success",
          "url": "https://github.com/omry/omegaflow/actions/runs/38854361407/job/116822397521"
        },
        {
          "conclusion": "SUCCESS",
          "name": "Website docs",
          "run_id": 116822397824,
          "run_status": "completed",
          "status": "success",
          "url": "https://github.com/omry/omegaflow/actions/runs/38854361407/job/116822397824"
        }
      ],
      "head_sha": "a4fe9fa64ecdc5b1c00bb590d9d10c5920287a70",
      "id": "sha256:f78b2882a5eefb8b9f19d9e81d18ed526b0df19ec117cae2da6d574bbc81ec72",
      "required_checks": [
        "Envoy Go",
        "Gitar",
        "Package build",
        "Python tests",
        "Recording integration",
        "Website docs"
      ],
      "status": "success"
    }
  ],
  "delivery_deferral_ledger_digest": "sha256:4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945",
  "delivery_deferrals": [],
  "findings": [
    {
      "classification": "current-slice defect",
      "evidence": [
        "https://github.com/omry/omegaflow/pull/71#discussion_r4290931037",
        "/home/omry/dev/omegaflow/temp/growth/b4-b5-delivery/B4.1/phase-completion-probe/before.log",
        "/home/omry/dev/omegaflow/temp/growth/b4-b5-delivery/B4.1/pr71-repair01-final-verification.json",
        "/home/omry/dev/omegaflow/temp/growth/b4-b5-delivery/B4.1/pr71-repair01-final-focused.log",
        "/home/omry/dev/omegaflow/temp/growth/b4-b5-delivery/B4.1/pr71-round01-thread-before-resolution.json",
        "/home/omry/dev/omegaflow/temp/growth/b4-b5-delivery/B4.1/pr71-review-round-round02.json"
      ],
      "id": 4290931037,
      "invariant": "A completed existing phase preserves its result while an accepted, unattempted resize remains queued for the next existing phase.",
      "proposed_fix": "Observe already completed work after ready private/fatal facts and before starting a pending resize. Preserve the pending request. Add success/error-result and private-fatal precedence regressions; complete focused and full validation, then fresh exact-head PR review.",
      "rationale": "Supplementary Gitar report led to isolated overlay reproduction: wait receives an already-closed work-done channel and a pending resize; a held output boundary consumes the completed phase deadline and returns DeadlineExceeded. The trusted Codex review is clean; this is a separately verified local finding, not a fabricated Codex finding.",
      "resolution_rationale": "Truth fix verified by two failed-before/passed-after probes, three regressions repeated20 times with race detection, complete local validation, and fresh clean exact-head review. The existing thread is already resolved. Both completed-work and selected-publication phase results are preserved while the unattempted resize remains queued.",
      "status": "resolved",
      "thread_id": "PRRT_kwDOTOFvvM6tEIAd"
    }
  ],
  "pr": {
    "base_ref": "pr70",
    "base_sha": "71cb614ddb92e893df9866e53725f8c29df971d9",
    "body_digest": "sha256:ef3557f1cf9b53bf174a50173f020726b7661a790260c7b125d471b19aa7442e",
    "diff_digest": "sha256:5c07284099cbc643002436fea5f5340ab258351f8b5bb4f201526b3f9fee872f",
    "head_ref": "pr71",
    "head_sha": "a4fe9fa64ecdc5b1c00bb590d9d10c5920287a70",
    "pr": 71,
    "repository": "omry/omegaflow",
    "scope_authority": [
      {
        "digest": "sha256:9fc71791194e4e7e20cadb4c71d4900309bb4b40863759fb6de5bb6f8996a8f8",
        "path": "docs/design/envoy-protocol-v1.md"
      },
      {
        "digest": "sha256:9089495c887132f510fc0e55d960cf0395b1ea56d135de694095f98466716833",
        "path": "docs/design/omegaflow-envoy-design.md"
      },
      {
        "digest": "sha256:f064097e51591052bd1ae470bcb5cd8e8a8265df4089651fecba2a32159b0c24",
        "path": "docs/design/reploy-environments-design.md"
      },
      {
        "digest": "sha256:98b4fdc917f0807c30de93d32cf1f4b0cc32a8bb68d1c1b3d8bf1cdb267af525",
        "path": "docs/design/reploy-integration-implementation-plan.md"
      }
    ],
    "title_digest": "sha256:18aeee00fb9a30358dedc729679dd2db077b0402fedaf09c3874f93263935c2d"
  },
  "record_version": 6,
  "review_observations": [],
  "review_requests": [
    {
      "base_established_at": "2026-10-16T04:26:46Z",
      "base_ref": "pr70",
      "base_sha": "71cb614ddb92e893df9866e53725f8c29df971d9",
      "body_digest": "sha256:02e537ffc6911d99f2398dceecbeac380103a47038b7fcade4a8071dad6d837f",
      "created_at": "2026-10-16T04:43:01Z",
      "head_sha": "776ff78fc8e679af783121abc0fc1b8d3f14fcd4",
      "id": 6208252286,
      "kind": "regular-review"
    },
    {
      "base_established_at": "2026-10-16T04:26:46Z",
      "base_ref": "pr70",
      "base_sha": "71cb614ddb92e893df9866e53725f8c29df971d9",
      "body_digest": "sha256:cb379de0861c8cadf2ab5096b5cbb6d7d4de6ec981ecd2b72654d9eecd36a6da",
      "created_at": "2026-10-16T05:20:57Z",
      "head_sha": "a4fe9fa64ecdc5b1c00bb590d9d10c5920287a70",
      "id": 6208690810,
      "kind": "regular-review"
    }
  ],
  "review_results": [
    {
      "base_ref": "pr70",
      "base_sha": "71cb614ddb92e893df9866e53725f8c29df971d9",
      "body_digest": "sha256:bc81f6e70bd4aed5cb6b2b00ab228632a60e6549e62a69cb69809e40936dfeeb",
      "commit_id": "776ff78fc8e679af783121abc0fc1b8d3f14fcd4",
      "id": 6208287827,
      "inline_message_ids": [],
      "request_comment_id": 6208252286,
      "result_kind": "clean",
      "status": "result",
      "submitted_at": "2026-10-16T04:46:08Z",
      "unresolved_thread_ids": [
        "PRRT_kwDOTOFvvM6tEIAd"
      ]
    },
    {
      "base_ref": "pr70",
      "base_sha": "71cb614ddb92e893df9866e53725f8c29df971d9",
      "body_digest": "sha256:65ce718b8202411f72c831eb4c245014589324c59aac6054725d357c8378d577",
      "commit_id": "a4fe9fa64ecdc5b1c00bb590d9d10c5920287a70",
      "id": 6208736881,
      "inline_message_ids": [],
      "request_comment_id": 6208690810,
      "result_kind": "clean",
      "status": "result",
      "submitted_at": "2026-10-16T05:24:49Z",
      "unresolved_thread_ids": []
    }
  ],
  "revision_fingerprint": "sha256:e3992a17b5b882276e565a72b59e1dd18a269980b35b055fdfa264d04f1d4b6e",
  "rounds": [
    {
      "applied_fix_paths": [
        "runtime/envoy/session/start_linux.go",
        "runtime/envoy/session/resize_linux_test.go"
      ],
      "disposition_changes": [
        4290931037
      ],
      "effective_diff_digest": "sha256:5c07284099cbc643002436fea5f5340ab258351f8b5bb4f201526b3f9fee872f",
      "finding_ids": [
        4290931037
      ],
      "invariants": [
        "Completed work and selected publication preserve their phase result; accepted unattempted resize remains queued for the next existing phase."
      ],
      "outcome": "corrected-head-needs-review",
      "proposed_fix_paths": [
        "runtime/envoy/session/start_linux.go",
        "runtime/envoy/session/resize_linux_test.go"
      ],
      "resulting_head": "a4fe9fa64ecdc5b1c00bb590d9d10c5920287a70",
      "review_observation_id": null,
      "review_request_id": 6208252286,
      "review_result_id": 6208287827,
      "reviewed_head": "776ff78fc8e679af783121abc0fc1b8d3f14fcd4",
      "root_cause": "The wait loop attempted pending resize before selecting completed work and again after granting publication. The unrelated boundary could consume the phase deadline after its operation result was selected. The same two-file repair observes done first and retains the existing publication choice until its worker joins.",
      "round": 1,
      "unresolved_current_slice_findings": 0,
      "unresolved_design_blockers": 0
    },
    {
      "applied_fix_paths": [],
      "disposition_changes": [
        4290931037
      ],
      "effective_diff_digest": "sha256:5c07284099cbc643002436fea5f5340ab258351f8b5bb4f201526b3f9fee872f",
      "finding_ids": [],
      "invariants": [
        "Finite PTY prefix and mark precede exact TIOCSWINSZ acknowledgement.",
        "Accepted unattempted resize does not replace a completed phase or selected publication.",
        "Ready private failure and original bounded phase ownership remain authoritative."
      ],
      "outcome": "clean",
      "proposed_fix_paths": [],
      "resulting_head": "a4fe9fa64ecdc5b1c00bb590d9d10c5920287a70",
      "review_observation_id": null,
      "review_request_id": 6208690810,
      "review_result_id": 6208736881,
      "reviewed_head": "a4fe9fa64ecdc5b1c00bb590d9d10c5920287a70",
      "root_cause": "No unresolved defect remains after the bounded original-source correction and fresh exact-head review. No new code or metadata change in round2.",
      "round": 2,
      "unresolved_current_slice_findings": 0,
      "unresolved_design_blockers": 0
    }
  ],
  "schema": "awd:swe:pr-cycle-state",
  "version": 2
}

@omry
omry marked this pull request as ready for review October 16, 2026 04:37
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T05:24:50.978511Z a4fe9fa Manual request
🔒 Security Review ✅ Completed 2026-10-16T04:39:26.827084Z 776ff78 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@omry

omry commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

@codex, regular review 776ff78

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 776ff78fc8

ℹ️ 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".

Apply TIOCSWINSZ after the already-admitted PTY prefix and its covering mark,
then acknowledge the exact dimensions and output offset. Preserve accepted
Starting resizes through phase handoffs, retain fatal resize-failed errors,
and let the existing drain supersede unapplied work.

Validate actual PTY dimensions, raw output, continuous producers, start and
completion crossings, ioctl failure and drain ordering. Exercise real Bash
SIGWINCH and ordinary return on all three qualified Linux/amd64 targets.
@gitar-bot

gitar-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 closed / 1 findings

🟡 Medium risk · Applying PTY window changes during live sessions could deliver SIGWINCH at an unexpected output boundary, altering interactive command behavior.

Serializes PTY resize so TIOCSWINSZ is applied after the admitted output prefix and its covering mark, then acknowledges exact dimensions and output offset. Resolved the finding where a pending resize timeout overrode an already-finished phase's success. No open issues found.

✅ 1 closed
✅ Edge Case: Pending resize timeout overrides an already-finished phase's success

📄 runtime/envoy/session/start_linux.go:288-296 📄 runtime/envoy/session/resize_linux.go:73-85
In wait, the pending-resize branch at line 288 runs before if finished. Here is the sequence. A resize arrives while a phase worker is running and is stored in c.resize. The worker then commits and closes done, which sets finished=true. On the next loop pass applyPendingResize runs under the same phase ctx. If that ctx expires during the resize boundary (waiting for the barrier or the telemetry write), wait returns DeadlineExceeded instead of finishErr (nil). In Complete's final work (completion_linux.go:82-93), operation_completed has already gone out on the wire, yet Complete returns an error and never clears c.active. The coordinator then treats a committed terminal result as failed and stays non-reusable. The same thing can turn a completed input barrier into an input-barrier-timeout.

Fix: once the phase work has finished, a context error from the resize should not replace its result. Keep the request in c.resize (as the retry path already does) and return finishErr. Only resize-failed or a channel failure should propagate.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@omry

omry commented Oct 16, 2026

Copy link
Copy Markdown
Owner Author

@codex, regular review a4fe9fa

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: a4fe9fa64e

ℹ️ 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".

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved PR reviewed and approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant