[limen GH-organvm-limen-895] Dedup repairs by work-intent, not just task-ID (two sessions raced the same red-trunk fix)#968
Conversation
…e same red-trunk fix) limen task GH-organvm-limen-895
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ccedbe4c0
ℹ️ 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".
| lf.tasks.append(build_task(verdict, repo, num, url, stamp)) | ||
| emitted.append(tid) |
There was a problem hiding this comment.
Restore same-run heal-task dedupe
When sick contains the same PR more than once (for example duplicate --pr inputs, or any overlapping/duplicated search rows), this appends duplicate Task objects with the same stable id because tasks_by_id is only a snapshot loaded before the loop. The previous existing.add(tid) prevented duplicates within a single live pass; update the in-memory map/set after appending so tasks.yaml does not end up with repeated task IDs in one run.
Useful? React with 👍 / 👎.
| if mt is not None and mt.status in _MAINRED_ACTIVE_STATUSES: | ||
| continue |
There was a problem hiding this comment.
Move trunk-repair skip before applying the emit limit
When the scan window contains more sick PRs than --limit and the first limit entries include CI-red PRs covered by an active HEAL-mainred, these skipped entries still consume the already-sliced sick[:limit] quota, so later actionable conflicts/stale-base repairs in the same window are not emitted at all. Apply the trunk-repair suppression before capping, or keep scanning until the run has emitted up to the limit of non-suppressed heal tasks.
Useful? React with 👍 / 👎.
| if verdict == "CI-RED": | ||
| mainred_tid = f"HEAL-mainred-{repo.replace('/', '-').lower()}" | ||
| mt = tasks_by_id.get(mainred_tid) | ||
| if mt is not None and mt.status in _MAINRED_ACTIVE_STATUSES: |
There was a problem hiding this comment.
Check the PR base before suppressing CI fixes
When a CI-red PR targets a non-default/release branch in the same repo, an active HEAL-mainred-<repo> does not necessarily heal that PR, but this check suppresses the PR-level repair solely by repo id. assess() already fetches baseRefName, so carry that through and only skip CI-fix tasks whose base is the trunk covered by the mainred task; otherwise branch-specific red PRs can be left with no heal task while the unrelated trunk repair is active.
Useful? React with 👍 / 👎.
Autonomous limen dispatch of task
GH-organvm-limen-895.GitHub issue #895. From PREC-2026-07-10-same-repair-raced-by-two-sessions.
dispatch.py release_stale_tasks()dedups bysession_id+ stale age, but nothing prevents two sessions fixing the SAME logical thing under different task IDs — this session's green-main agent and another session's PR #871 both fixed the same CI-red main. Fix: route trunk-red repair through ONE claimable keyed HEAL task (self-heal.pyalreRefs: #895
Produced in an isolated worktree off origin — review before merge.