Skip to content

[spark-compete] fix(codex): protect json.loads() from corrupted state file in manifest replay#10

Open
driasim wants to merge 2 commits into
vibeforge1111:mainfrom
driasim:fix/json-loads-protection
Open

[spark-compete] fix(codex): protect json.loads() from corrupted state file in manifest replay#10
driasim wants to merge 2 commits into
vibeforge1111:mainfrom
driasim:fix/json-loads-protection

Conversation

@driasim

@driasim driasim commented May 31, 2026

Copy link
Copy Markdown
{
  "schema": "spark-compete-hotfix-v1",
  "event": "spark-compete-first-event",
  "submission_mode": "public_repo_pr",
  "submission_target_url": "https://github.com/vibeforge1111/keep-codex-fast/pull/10",
  "team": {
    "name": "Rayiea Hub",
    "members": [
      "Dr Asim",
      "Cardio",
      "Yasfib"
    ],
    "github_accounts": [
      "driasim",
      "trmidhi",
      "yasfib"
    ],
    "llm_device_holder": "Dr Asim",
    "device_holder_github": "https://github.com/driasim"
  },
  "target_repo": {
    "id": "vibeforge1111/keep-codex-fast",
    "source": "https://github.com/vibeforge1111/keep-codex-fast",
    "owner_surface": "keep-codex-fast"
  },
  "issue": {
    "type": "bug",
    "severity": "medium",
    "title": "fix(codex): protect json.loads() from corrupted state file in manifest replay",
    "actual_behavior": "Bug: fix(codex): protect json.loads() from corrupted state file in manifest replay",
    "expected_behavior": "Fix: fix(codex): protect json.loads() from corrupted state file in manifest replay",
    "repro_steps": [
      "Bug: fix(codex): protect json.loads() from corrupted state file in manifest replay"
    ],
    "affected_workflow": "Server/operator reliability"
  },
  "evidence": {
    "safe_links_only": true,
    "before_after_proof": "Bug: fix(codex): protect json.loads() from corrupted state file in manifest replay",
    "links": [
      "https://github.com/vibeforge1111/keep-codex-fast/pull/10"
    ],
    "forbidden": [
      "tokens",
      "logs",
      "passwords",
      "keys",
      "private chats"
    ]
  },
  "proposed_fix": {
    "approach": "fix(codex): protect json.loads() from corrupted state file in manifest replay",
    "files_expected": [
      "src/core/changes.py"
    ],
    "tests_or_smoke": "Targeted test verifies the fix."
  },
  "pr": {
    "branch": "fix/json-loads-protection",
    "title_prefix": "[spark-compete]",
    "author_github": "driasim",
    "body_must_include": [
      "packet",
      "team",
      "pr_author",
      "repo",
      "actual_behavior",
      "expected_behavior",
      "repro_steps",
      "before_after_proof",
      "tests_or_smoke",
      "duplicate_notes",
      "risk_notes",
      "review_claim"
    ],
    "url": "https://github.com/vibeforge1111/keep-codex-fast/pull/10"
  },
  "review_claim": {
    "impact_claim": "medium",
    "evidence_types": [
      "smoke_test"
    ],
    "duplicate_notes": "Checked open PRs, no duplicates found.",
    "risk_notes": "Safe change, no secrets or CI touched.",
    "review_state_requested": "pr_review"
  }
}

Team Rayiea Hub

Team name: Rayiea Hub
Author: driasim
Members: driasim, trmidhi, yasfib

Bug Summary

fix(codex): protect json.loads() from corrupted state file in manifest replay

Actual Behavior

Bug: fix(codex): protect json.loads() from corrupted state file in manifest replay

Expected Behavior

Fix: fix(codex): protect json.loads() from corrupted state file in manifest replay

Root Cause

Bug: fix(codex): protect json.loads() from corrupted state file in manifest replay

Testing

Targeted test verifies the fix.

Before / After Proof

Targeted test verifies the fix.

json.loads(line) on line 435 was called without try/except,
causing an unhandled crash if any line in the manifest JSONL
file is corrupted or contains unexpected content.

Wrapped in try/except json.JSONDecodeError with graceful
skip-and-report fallback.
Copilot AI review requested due to automatic review settings May 31, 2026 23:13

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Improve robustness of keep_codex_fast.py when reading a JSONL manifest by skipping empty lines and handling malformed JSON entries gracefully.

Changes:

  • Skip blank lines in the manifest input
  • Catch JSONDecodeError and continue processing subsequent lines
  • Emit a console message when encountering malformed manifest entries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +435 to +441
if not line.strip():
continue
try:
rec = json.loads(line)
except json.JSONDecodeError:
print(f"Skipping malformed manifest line: {line[:80]}", flush=True)
continue
Comment on lines +437 to +441
try:
rec = json.loads(line)
except json.JSONDecodeError:
print(f"Skipping malformed manifest line: {line[:80]}", flush=True)
continue
@driasim driasim changed the title [spark-compete] Fix unprotected json.loads() in manifest replay [spark-compete] fix(codex): protect json.loads() from corrupted state file in manifest replay Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants