Skip to content

Reject duplicate JSON keys in native worker results instead of silently accepting the last value #112

Closed

Description

@kudama

Found during Mike's requested Qwen3.8/Forge handoff audit on 2026-11-17 (#111). Confirmed against unchanged deployed Forge revision dc13f20; affected app.py/work_orders.py match current GitHub main source.

Reproduction

An isolated native worker reads its approved source and returns an otherwise valid worker-result.v1 object with the summary key repeated. Native controller reports succeeded and structure_valid/source_valid true because app.py uses ordinary json.loads(content), which silently keeps the last key. The file-based load_json helper already rejects duplicates, so native and file validation differ. Worker-result shape/source validation still does not establish semantic correctness.

Expected

Reject duplicate keys at every nesting level and nonstandard JSON constants before worker-result shape validation. Keep raw output for diagnosis and return invalid_worker_result. Do not silently normalize malformed output or relax source/tool guards.

Isolated fix and validation

A review copy extracts the existing strict parser into parse_json(data), reuses it in load_json, native result parsing and execution-result correspondence. No new dependency or broad controller change.

  • Existing86 handoff/native/receipt tests pass unchanged.
  • Added audit probes reproduce the duplicate-key acceptance; the isolated fix passes all89 checks.
  • The other probes confirm generic delivery succeeded is not native result acceptance, and the80-line read guard remains enforced.

No deployed controller/default routing changed. Proposed patch and test are in the Forge workspace output/qwen38-handoff-20261117/strict-json-fix.patch and test_handoff_audit.py. Next: review the focused parser fix and add its regression test to the canonical repository, then use normal release verification. This issue records an unmerged fix, not a deployed correction.

Activity

  1. added
    work:reviewRequires Forge review or merge
    worker:forgeForge architecture, security, integration, or operations
    on Nov 18, 2026
  2. kudama commented on Nov 18, 2026

    @kudama
    OwnerAuthor

    2026-11-17: focused fix is now reviewable in draft PR #113 (24f40a3). Canonical regression coverage passes95 checks. Reverting both native parsing points to legacy behavior makes both new nested/top-level duplicate-key cases fail. Deployed controller and routing remain unchanged; next action is PR review and normal release verification.

  3. kudama commented on Nov 18, 2026

    @kudama
    OwnerAuthor

    Deployment completed and verified — 2026-11-18.

    PR #113 is merged and deployed, preserving the existing deployment changes. All four changed files match the merged fix.

    Validation: 95 relevant work-order/native/handoff tests passed in the deployed checkout; PR CI Tests and Checkmk compatibility passed. The controller was gracefully restarted and both its live endpoint and authenticated Forge readiness check passed. No unfinished tasks; controller configuration and model defaults are unchanged. A private rollback backup was retained.

    The initial restart probe used the previous listener address; verification against the configured listener succeeded. No remaining deployment work for this fix.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    worker:forgeForge architecture, security, integration, or operations

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions