Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .agents/skills/update-dedupe/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ By default this targets the current repo and looks back 7 days. It collects only
## Evidence Rules

- Only encode a cluster when at least two independent closed-as-duplicate events point at the same canonical issue, or a maintainer explicitly asks for one.
- Skip the PR when there is no repeated signal.
- Skip the update when there is no repeated signal.
- Do not weaken precision-over-recall for dedupe.

## Final Checks

- Re-read the updated `dedupe-issue-local` companion skill and confirm any new clusters are explicit.
- Keep the companion concise; prefer canonical links and short distinguishing notes over long prose.
- Commit any changes on a local branch named `oz-agent/update-dedupe`. Do NOT push the branch; the Python entrypoint will run a write-surface guard and push only when the guard passes.
- If the updates warrant a PR, it will be opened from the pushed branch. Tag `@captainsafia` as a reviewer on that PR.
- Commit any changes on a local branch named `oz-agent/update-dedupe-<YYYY-MM-DD>` using the current UTC date. Do NOT push the branch or perform any pull-request operation. The Python entrypoint will run a write-surface guard, push only when the guard passes, and leave pull-request publication and reviewer assignment to the deterministic workflow using the resolved self-improvement config and repository ownership metadata.
- Validate any temporary JSON with `jq` before relying on it.
3 changes: 1 addition & 2 deletions .agents/skills/update-pr-review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,5 @@ Use that temporary data as evidence when refining the skills, then remove it bef

- Re-read the updated `review-pr-local` and/or `review-spec-local` companion skills and confirm any new rules are explicit.
- Keep each companion concise; do not turn them into long style guides.
- Commit any changes on a local branch named `oz-agent/update-pr-review`. Do NOT push the branch; the Python entrypoint will run a write-surface guard and push only when the guard passes.
- If the updates warrant a PR, it will be opened from the pushed branch. Tag `@captainsafia` as a reviewer on that PR.
- Commit any changes on a local branch named `oz-agent/update-pr-review-<YYYY-MM-DD>` using the current UTC date. Do NOT push the branch or perform any pull-request operation. The Python entrypoint will run a write-surface guard, push only when the guard passes, and leave pull-request publication and reviewer assignment to the deterministic workflow using the resolved self-improvement config and repository ownership metadata.
- Validate any temporary JSON with `jq` before relying on it.
5 changes: 2 additions & 3 deletions .agents/skills/update-triage/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,13 @@ By default this targets the current repo and looks back 7 days. It collects issu
## Evidence Rules

- Prefer patterns backed by multiple issues or a strong explicit maintainer statement.
- Skip the PR when there is no repeated signal. A one-off maintainer override is not enough evidence.
- Skip the update when there is no repeated signal. A one-off maintainer override is not enough evidence.
- Avoid encoding reporter-authored content as triage rules.
- Do not weaken the reserved-label rules (`ready-to-implement`, `ready-to-spec`) or the mutual exclusivity of `duplicate_of` and `follow_up_questions`.

## Final Checks

- Re-read the updated `triage-issue-local` companion skill and confirm any new rules are explicit.
- Keep the companion concise; do not turn it into a long style guide.
- Commit any changes on a local branch named `oz-agent/update-triage`. Do NOT push the branch; the Python entrypoint will run a write-surface guard and push only when the guard passes.
- If the updates warrant a PR, it will be opened from the pushed branch. Tag `@captainsafia` as a reviewer on that PR.
- Commit any changes on a local branch named `oz-agent/update-triage-<YYYY-MM-DD>` using the current UTC date. Do NOT push the branch or perform any pull-request operation. The Python entrypoint will run a write-surface guard, push only when the guard passes, and leave pull-request publication and reviewer assignment to the deterministic workflow using the resolved self-improvement config and repository ownership metadata.
- Validate any temporary JSON with `jq` before relying on it.
11 changes: 6 additions & 5 deletions .github/scripts/oz_workflows/repo_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,12 @@ def assert_write_surface(

# Shared push/PR plumbing for the narrowed self-improvement loops.
#
# Each ``update-<agent>`` Python entrypoint invokes Oz, which leaves a
# local commit on ``oz-agent/update-<agent>`` without pushing. The
# entrypoint then calls :func:`maybe_push_update_branch` to run the
# write-surface guard, push the branch to ``origin`` only when the guard
# passes, and open a pull request so a human reviewer is notified.
# Each ``update-<agent>`` Python entrypoint invokes Oz, which leaves a local
# commit on a date-stamped ``oz-agent/update-<agent>-<YYYY-MM-DD>`` branch
# without pushing. The entrypoint then calls
# :func:`maybe_push_update_branch` to run the write-surface guard, push the
# branch to ``origin`` only when the guard passes, and open a pull request so
# a human reviewer is notified.


def branch_exists(repo_root: Path, branch: str) -> bool:
Expand Down
11 changes: 6 additions & 5 deletions .github/scripts/tests/test_self_improvement_guards.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
"""Tests for the write-surface guards on the narrowed self-improvement loops.

Each ``update-<agent>`` entrypoint runs ``assert_write_surface`` against
the changed files on ``oz-agent/update-<agent>`` before pushing. These
tests exercise the prefix lists declared in each entrypoint to confirm
that a simulated diff inside the allowed surface passes and a simulated
diff that touches a core skill or ``.github/scripts/*`` aborts the run.
Each ``update-<agent>`` entrypoint runs ``assert_write_surface`` against the
changed files on a date-stamped ``oz-agent/update-<agent>-<YYYY-MM-DD>``
branch before pushing. These tests exercise the prefix lists declared in each
entrypoint to confirm that a simulated diff inside the allowed surface passes
and a simulated diff that touches a core skill or ``.github/scripts/*`` aborts
the run.
"""

from __future__ import annotations
Expand Down
22 changes: 22 additions & 0 deletions .github/scripts/tests/test_update_self_improvement_scripts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import re
import unittest
from types import SimpleNamespace
from unittest.mock import patch
Expand All @@ -10,6 +11,12 @@


class UpdateScriptsTest(unittest.TestCase):
def _assert_update_branch_has_date_suffix(
self, module: object, prefix: str
) -> None:
branch = getattr(module, "UPDATE_BRANCH")
self.assertRegex(branch, rf"^{re.escape(prefix)}-\d{{4}}-\d{{2}}-\d{{2}}$")

def _assert_main_does_not_pass_hardcoded_reviewer(self, module: object) -> None:
with patch.object(module, "build_agent_config", return_value={}), patch.object(
module, "run_agent", return_value=SimpleNamespace(run_id="run-123")
Expand Down Expand Up @@ -60,6 +67,21 @@ def test_update_triage_relies_on_shared_resolution(self) -> None:
def test_update_dedupe_relies_on_shared_resolution(self) -> None:
self._assert_main_does_not_pass_hardcoded_reviewer(update_dedupe)

def test_update_pr_review_branch_includes_date_suffix(self) -> None:
self._assert_update_branch_has_date_suffix(
update_pr_review, "oz-agent/update-pr-review"
)

def test_update_triage_branch_includes_date_suffix(self) -> None:
self._assert_update_branch_has_date_suffix(
update_triage, "oz-agent/update-triage"
)

def test_update_dedupe_branch_includes_date_suffix(self) -> None:
self._assert_update_branch_has_date_suffix(
update_dedupe, "oz-agent/update-dedupe"
)

def test_update_pr_review_uses_uploaded_pr_metadata(self) -> None:
self._assert_main_passes_pr_metadata(update_pr_review)

Expand Down
3 changes: 2 additions & 1 deletion .github/scripts/update_dedupe.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

from datetime import UTC, datetime
from textwrap import dedent
from oz_workflows.artifacts import load_pr_metadata_artifact

Expand All @@ -11,7 +12,7 @@
)


UPDATE_BRANCH = "oz-agent/update-dedupe"
UPDATE_BRANCH = f"oz-agent/update-dedupe-{datetime.now(UTC).date().isoformat()}"
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [IMPORTANT] The date-only branch suffix still collides for same-day reruns; if a scheduled/manual rerun produces another update before the existing branch is merged or deleted, git push origin <branch> can reject before _pr_exists_for_branch runs. Include a run/attempt component or fetch/update the existing branch before pushing, and apply the same fix to the other update scripts.

ALLOWED_PREFIXES: tuple[str, ...] = (
".agents/skills/dedupe-issue-local/",
)
Expand Down
3 changes: 2 additions & 1 deletion .github/scripts/update_pr_review.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

from datetime import UTC, datetime
from textwrap import dedent
from oz_workflows.artifacts import load_pr_metadata_artifact

Expand All @@ -11,7 +12,7 @@
)


UPDATE_BRANCH = "oz-agent/update-pr-review"
UPDATE_BRANCH = f"oz-agent/update-pr-review-{datetime.now(UTC).date().isoformat()}"
# Write surface is strictly the review companions. The issue-triage config
# is owned by ``update-triage`` (and the triage label taxonomy is a triage
# signal, not a PR-review signal). Letting this loop edit it would create
Expand Down
3 changes: 2 additions & 1 deletion .github/scripts/update_triage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

from datetime import UTC, datetime
from textwrap import dedent
from oz_workflows.artifacts import load_pr_metadata_artifact

Expand All @@ -11,7 +12,7 @@
)


UPDATE_BRANCH = "oz-agent/update-triage"
UPDATE_BRANCH = f"oz-agent/update-triage-{datetime.now(UTC).date().isoformat()}"
ALLOWED_PREFIXES: tuple[str, ...] = (
".agents/skills/triage-issue-local/",
".github/issue-triage/",
Expand Down
Loading