Skip to content

fix(prompt): respect Python runtime syntax metadata#109

Open
rohitjavvadi wants to merge 2 commits into
openclaw:mainfrom
rohitjavvadi:fix/python-runtime-syntax-context
Open

fix(prompt): respect Python runtime syntax metadata#109
rohitjavvadi wants to merge 2 commits into
openclaw:mainfrom
rohitjavvadi:fix/python-runtime-syntax-context

Conversation

@rohitjavvadi
Copy link
Copy Markdown
Contributor

@rohitjavvadi rohitjavvadi commented May 24, 2026

Summary

  • add Python target-runtime metadata to source, route, and standalone pytest-suite review context
  • add Python compatibility guidance for version-specific syntax checks
  • cover Python 3.14 PEP 758 metadata and prompt behavior in mapper/prompt tests

Fixes #106.

Real behavior proof

I reran the issue reproduction against the built CLI on a minimal Python 3.14 project containing .python-version, requires-python = ">=3.14", and the PEP 758 handler syntax:

except TypeError, ValueError:
    return 0

Command:

node dist/cli.js --root /tmp/clawpatch-pep758-proof-final.jvdhwI --state-dir /tmp/clawpatch-pep758-proof-final.jvdhwI/.clawpatch --plain init
node dist/cli.js --root /tmp/clawpatch-pep758-proof-final.jvdhwI --state-dir /tmp/clawpatch-pep758-proof-final.jvdhwI/.clawpatch --plain map
node dist/cli.js --root /tmp/clawpatch-pep758-proof-final.jvdhwI --state-dir /tmp/clawpatch-pep758-proof-final.jvdhwI/.clawpatch --plain review --provider codex --model gpt-5.5 --limit 1 --jobs 1

Output excerpt:

clawpatch map mapper-done mapper=python seeds=2 elapsed=0s
clawpatch map done features=2 usedAgent=false elapsed=0s
clawpatch review feature-start index=1 total=1 feature=feat_library_25faef2bc4 title=Python source root
clawpatch review feature-done index=1 total=1 feature=feat_library_25faef2bc4 findings=0 elapsed=19s
clawpatch review done run=20260524T062216-b1e3a8 reviewed=1 findings=0
reviewed: 1
findings: 0

I also verified the standalone pytest-suite path flagged in review. A pytest-only Python 3.14 fixture now maps the test-suite feature with runtime metadata in context:

{
  "title": "Python test suite tests",
  "contextFiles": [
    { "path": "pyproject.toml", "reason": "python target runtime metadata" },
    { "path": ".python-version", "reason": "python target runtime metadata" },
    { "path": "runtime.txt", "reason": "python target runtime metadata" },
    { "path": "tests/test_pep758.py", "reason": "nearby test" }
  ],
  "ownedFiles": [
    { "path": "tests/test_pep758.py", "reason": "pytest file" }
  ],
  "tests": [
    { "path": "tests/test_pep758.py", "command": "pytest" }
  ]
}

Checks

  • ./node_modules/.bin/vitest run src/mapper.test.ts src/prompt.test.ts
  • ./node_modules/.bin/tsc -p tsconfig.json --noEmit
  • ./node_modules/.bin/oxfmt --check src/mappers/python.ts src/mapper.test.ts src/prompt.ts src/prompt.test.ts
  • ./node_modules/.bin/oxlint . --config oxlint.json
  • git diff --check
  • pnpm build
  • pnpm typecheck
  • pnpm lint
  • pnpm format:check
  • pnpm test

@rohitjavvadi rohitjavvadi requested a review from a team as a code owner May 24, 2026 05:37
@clawsweeper
Copy link
Copy Markdown

clawsweeper Bot commented May 24, 2026

Codex review: needs maintainer review before merge.

Latest ClawSweeper review: 2026-05-24 06:34 UTC / May 24, 2026, 2:34 AM ET.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Summary
This PR adds Python target-runtime metadata context for Python mapper features, Python 3.14 PEP 758 prompt guidance, and mapper/prompt regression tests.

Reproducibility: yes. The linked issue provides a minimal Python 3.14 repro and current-main source inspection shows the mapper/prompt path lacks target-runtime context and PEP 758 guidance.

PR rating
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Summary: The PR has strong terminal proof and a clean bounded implementation with focused regression coverage.

Rank-up moves:

  • none
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Real behavior proof
Sufficient (terminal): The PR body includes copied terminal output from a built clawpatch review run on the Python 3.14 PEP 758 repro showing findings=0, plus standalone pytest-suite mapped context output.

Next step before merge
No ClawSweeper repair lane is needed because review found no blocking defect and the remaining action is normal maintainer merge review.

Security
Cleared: The diff only changes local TypeScript mapper/prompt logic and tests; it does not add dependencies, CI, publishing, secrets, or external code execution paths.

Review details

Best possible solution:

Merge this bounded mapper and prompt fix after normal maintainer checks, then let it close the linked issue at #106.

Do we have a high-confidence way to reproduce the issue?

Yes. The linked issue provides a minimal Python 3.14 repro and current-main source inspection shows the mapper/prompt path lacks target-runtime context and PEP 758 guidance.

Is this the best way to solve the issue?

Yes. Threading runtime metadata into Python feature context and adding narrow prompt guidance is the maintainable fix direction, and the follow-up commit covers the standalone pytest-suite path flagged in the earlier review.

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes copied terminal output from a built clawpatch review run on the Python 3.14 PEP 758 repro showing findings=0, plus standalone pytest-suite mapped context output.
  • add rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🦞 diamond lobster, patch quality is 🐚 platinum hermit, and The PR has strong terminal proof and a clean bounded implementation with focused regression coverage.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes copied terminal output from a built clawpatch review run on the Python 3.14 PEP 758 repro showing findings=0, plus standalone pytest-suite mapped context output.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a normal-priority false-positive review bug affecting Python projects that use version-specific syntax metadata.
  • rating: 🐚 platinum hermit: Current PR rating is 🐚 platinum hermit because proof is 🦞 diamond lobster, patch quality is 🐚 platinum hermit, and The PR has strong terminal proof and a clean bounded implementation with focused regression coverage.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes copied terminal output from a built clawpatch review run on the Python 3.14 PEP 758 repro showing findings=0, plus standalone pytest-suite mapped context output.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes copied terminal output from a built clawpatch review run on the Python 3.14 PEP 758 repro showing findings=0, plus standalone pytest-suite mapped context output.

What I checked:

  • Current main mapper gap: Current main builds Python CLI, source, route, and standalone pytest-suite features without Python target-runtime metadata in their context files. (src/mappers/python.ts:132, 857d854ac8d0)
  • Current main prompt gap: Current main review prompts include generic review instructions but no Python runtime syntax guidance. (src/prompt.ts:184, 857d854ac8d0)
  • PR mapper change: The PR diff adds runtimeMetadataFiles and threads those refs into Python CLI, source, Flask/FastAPI/Django route, and standalone pytest-suite context. (src/mappers/python.ts:67, 63eb06aa473b)
  • PR prompt change: The PR diff adds Python compatibility guidance that tells reviewers to treat included runtime metadata as authoritative and not report PEP 758 syntax as invalid for Python 3.14+ projects. (src/prompt.ts:280, 63eb06aa473b)
  • Regression coverage: The PR adds focused mapper tests for source and standalone pytest-suite runtime metadata plus a prompt test for Python runtime syntax guidance. (src/mapper.test.ts:13412, 63eb06aa473b)
  • Real behavior proof: The PR body includes copied terminal output from a built CLI run on a minimal Python 3.14 PEP 758 repro showing reviewed=1 and findings=0, plus a mapped standalone pytest-suite JSON excerpt with runtime metadata context. (63eb06aa473b)

Likely related people:

  • rohitjavvadi: Recent merged history shows multiple Python route/mapper changes in the same mapper and tests that this PR touches. (role: recent Python mapper contributor; confidence: high; commits: 12a7be1e50ea, 9e7dba1a17c6, 5625f6d765d7; files: src/mappers/python.ts, src/mapper.test.ts)
  • vincentkoc: History shows Python packaging support plus review prompt provenance work adjacent to this PR's runtime metadata and prompt changes. (role: Python packaging and prompt provenance contributor; confidence: medium; commits: 88e110d06600, 43df8aab17a6, 1745e208bed9; files: src/mappers/python.ts, src/prompt.ts, src/prompt.test.ts)
  • steipete: History shows recent prompt fixes, mapper refactors, and integration commits around the touched files. (role: recent prompt and mapper area contributor; confidence: medium; commits: d81fa8d5ebec, fb46ba954f0e, 3e58a0fbd0a7; files: src/prompt.ts, src/mappers/python.ts, src/mapper.test.ts)
  • xiamx: The Python mapper history lists the original Python feature mapping commit, which is central to the behavior this PR extends. (role: original Python mapper contributor; confidence: medium; commits: b03bf5200a73; files: src/mappers/python.ts, src/mapper.test.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 857d854ac8d0.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. labels May 24, 2026
@clawsweeper
Copy link
Copy Markdown

clawsweeper Bot commented May 24, 2026

ClawSweeper PR egg

✨ Hatched: 🥚 common Pearl Proofling

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: keeps receipts.
Image traits: location release reef; accessory miniature diff map; palette cobalt, lime, and pearl; mood sleepy but ready; pose balancing on a branch marker; shell paper lantern shell; lighting gentle morning glow; background small green status lights.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Pearl Proofling in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@rohitjavvadi rohitjavvadi marked this pull request as draft May 24, 2026 06:14
@rohitjavvadi rohitjavvadi marked this pull request as ready for review May 24, 2026 06:30
@rohitjavvadi
Copy link
Copy Markdown
Contributor Author

Added the missing standalone pytest-suite runtime metadata path and included real behavior proof in the PR body. @clawsweeper re-review

@clawsweeper
Copy link
Copy Markdown

clawsweeper Bot commented May 24, 2026

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect findings reported - PEP758

1 participant