mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-07 16:19:09 +00:00
Compare commits
2 commits
a094ab099b
...
d3017d27be
| Author | SHA1 | Date | |
|---|---|---|---|
| d3017d27be | |||
| 87652abb4b |
4 changed files with 11 additions and 124 deletions
|
|
@ -186,7 +186,7 @@ class ModelFallbackMiddleware(AgentMiddleware):
|
|||
)
|
||||
|
||||
def _jittered_delay(self, delay: float) -> float:
|
||||
return delay + random.uniform(0, delay * 0.25) if delay > 0 else 0.0
|
||||
return delay + random.uniform(-delay * 0.25, delay * 0.25) if delay > 0 else 0.0
|
||||
|
||||
def _log_retry(
|
||||
self, exc_type: str, use_fallback: bool, attempt: int, total: int, delay: float
|
||||
|
|
|
|||
|
|
@ -1,121 +0,0 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from collections.abc import Awaitable, Callable
|
||||
from typing import TypeVar, cast
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
_CACHE: dict[str, tuple[object, float]] = {}
|
||||
_LOCKS: dict[tuple[str, int], asyncio.Lock] = {}
|
||||
_REFRESH_TASKS: dict[tuple[str, int], asyncio.Task[None]] = {}
|
||||
|
||||
|
||||
def _now() -> float:
|
||||
return asyncio.get_running_loop().time()
|
||||
|
||||
|
||||
def _lock_for(key: str) -> asyncio.Lock:
|
||||
loop = asyncio.get_running_loop()
|
||||
lock_key = (key, id(loop))
|
||||
lock = _LOCKS.get(lock_key)
|
||||
if lock is None:
|
||||
lock = asyncio.Lock()
|
||||
_LOCKS[lock_key] = lock
|
||||
return lock
|
||||
|
||||
|
||||
async def cached(key: str, ttl_seconds: float, loader: Callable[[], Awaitable[T]]) -> T:
|
||||
now = _now()
|
||||
entry = _CACHE.get(key)
|
||||
if entry is not None:
|
||||
value, expires_at = entry
|
||||
if expires_at > now:
|
||||
return cast(T, value)
|
||||
|
||||
async with _lock_for(key):
|
||||
now = _now()
|
||||
entry = _CACHE.get(key)
|
||||
if entry is not None:
|
||||
value, expires_at = entry
|
||||
if expires_at > now:
|
||||
return cast(T, value)
|
||||
|
||||
stale = entry[0] if entry is not None else None
|
||||
has_stale = entry is not None
|
||||
try:
|
||||
value = await loader()
|
||||
except Exception:
|
||||
if has_stale:
|
||||
logger.warning(
|
||||
"TTL cache loader failed for %s; serving stale value", key, exc_info=True
|
||||
)
|
||||
return cast(T, stale)
|
||||
raise
|
||||
_CACHE[key] = (value, now + ttl_seconds)
|
||||
return value
|
||||
|
||||
|
||||
async def _refresh_stale_entry(
|
||||
key: str, ttl_seconds: float, loader: Callable[[], Awaitable[object]]
|
||||
) -> None:
|
||||
async with _lock_for(key):
|
||||
try:
|
||||
value = await loader()
|
||||
except Exception:
|
||||
logger.warning("TTL cache background refresh failed for %s", key, exc_info=True)
|
||||
return
|
||||
_CACHE[key] = (value, _now() + ttl_seconds)
|
||||
|
||||
|
||||
def _schedule_refresh(
|
||||
key: str, ttl_seconds: float, loader: Callable[[], Awaitable[object]]
|
||||
) -> None:
|
||||
loop = asyncio.get_running_loop()
|
||||
task_key = (key, id(loop))
|
||||
existing = _REFRESH_TASKS.get(task_key)
|
||||
if existing is not None and not existing.done():
|
||||
return
|
||||
|
||||
task = asyncio.create_task(_refresh_stale_entry(key, ttl_seconds, loader))
|
||||
_REFRESH_TASKS[task_key] = task
|
||||
task.add_done_callback(lambda _task: _REFRESH_TASKS.pop(task_key, None))
|
||||
|
||||
|
||||
async def cached_stale_while_revalidate(
|
||||
key: str,
|
||||
ttl_seconds: float,
|
||||
loader: Callable[[], Awaitable[T]],
|
||||
) -> T:
|
||||
now = _now()
|
||||
entry = _CACHE.get(key)
|
||||
if entry is not None:
|
||||
value, expires_at = entry
|
||||
if expires_at > now:
|
||||
return cast(T, value)
|
||||
_schedule_refresh(key, ttl_seconds, loader)
|
||||
return cast(T, value)
|
||||
return await cached(key, ttl_seconds, loader)
|
||||
|
||||
|
||||
def set_cached(key: str, value: object, ttl_seconds: float) -> None:
|
||||
try:
|
||||
expires_at = _now() + ttl_seconds
|
||||
except RuntimeError:
|
||||
expires_at = float("inf")
|
||||
_CACHE[key] = (value, expires_at)
|
||||
|
||||
|
||||
def invalidate(key: str) -> None:
|
||||
_CACHE.pop(key, None)
|
||||
|
||||
|
||||
def clear() -> None:
|
||||
_CACHE.clear()
|
||||
_LOCKS.clear()
|
||||
for task in _REFRESH_TASKS.values():
|
||||
task.cancel()
|
||||
_REFRESH_TASKS.clear()
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
{"_meta": {"last_synced": "fd2541ce", "last_synced_date": "2026-07-09"}}
|
||||
{"_meta": {"last_synced": "71e3b818", "last_synced_date": "2026-07-09"}}
|
||||
{"sha": "0b76afdc", "pr": 1653, "subject": "reviews block agenda, sticky headers, diff scroll", "disposition": "landed", "reason": "", "branch": "cherry-pick-upstream", "local_sha": null, "updated": "2026-07-02T00:00:00Z"}
|
||||
{"sha": "7530653b", "pr": 1655, "subject": "ResizeObserver settle for review scroll-to", "disposition": "landed", "reason": "", "branch": "cherry-pick-upstream", "local_sha": null, "updated": "2026-07-02T00:00:00Z"}
|
||||
{"sha": "23bd4a63", "pr": 1660, "subject": "top padding to sticky review block header", "disposition": "landed", "reason": "", "branch": "cherry-pick-upstream", "local_sha": null, "updated": "2026-07-02T00:00:00Z"}
|
||||
|
|
@ -83,3 +83,7 @@
|
|||
{"sha": "9cd7e464", "pr": 1700, "subject": "Fix workflow approval visibility (#1700)", "disposition": "wont-merge", "reason": "superseded — dev's list_workflow_approvals_for_thread already enforces owner-only 403", "branch": "", "local_sha": null, "updated": "2026-07-08T20:14:42Z"}
|
||||
{"sha": "22e024cb", "pr": 1704, "subject": "fix: link issue PRs and prompt repo conventions (#1704)", "disposition": "deferred", "reason": "issue/PR linking + repo-convention prompt; clean but prompt-conflict risk vs #113", "branch": "webhook-issue-linking", "local_sha": null, "updated": "2026-07-08T20:14:42Z"}
|
||||
{"sha": "fd2541ce", "pr": 1705, "subject": "fix: drop orphaned function_call items with stale OpenAI reasoning (#1705)", "disposition": "wont-merge", "reason": "N/A — edits sanitize_openai_responses.py which dev deleted in the Bedrock/Fireworks migration (#62)", "branch": "", "local_sha": null, "updated": "2026-07-08T20:14:42Z"}
|
||||
{"sha": "27b0ddeb", "pr": 1708, "subject": "feat: add GPT-5.6 OpenAI models (#1708)", "disposition": "deferred", "reason": "FLAG-HUMAN: adds OpenAI GPT-5.6 to the model picker; fork's picker is Bedrock/Fireworks-only — needs a product decision before adopting OpenAI models. Gateway (#155) can route OpenAI if adopted.", "branch": "model-picker", "local_sha": null, "updated": "2026-07-09T22:20:06Z"}
|
||||
{"sha": "62e0ca2d", "pr": 1709, "subject": "fix: stale admin model defaults after model upgrades (#1709)", "disposition": "deferred", "reason": "stale admin model-default cleanup in team_settings after model upgrades; applies to fork's default-model resolution.", "branch": "model-picker", "local_sha": null, "updated": "2026-07-09T22:20:06Z"}
|
||||
{"sha": "138ab9ec", "pr": 1710, "subject": "fix: bump langchain-fireworks to 1.4.4 (#1710)", "disposition": "deferred", "reason": "langchain-fireworks 1.4.4 bump; fork uses Fireworks as a primary provider — adopt with a lockfile refresh.", "branch": "deps", "local_sha": null, "updated": "2026-07-09T22:20:07Z"}
|
||||
{"sha": "71e3b818", "pr": 1713, "subject": "fix: align reviewer eval with published findings (#1713)", "disposition": "deferred", "reason": "reviewer-eval/judge alignment; touches reviewer.py + add_finding/publish_review which are fork-diverged — reconcile against fork's reviewer before porting.", "branch": "reviewer-eval", "local_sha": null, "updated": "2026-07-09T22:20:07Z"}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ Commits on `upstream/main` (langchain-ai/open-swe) not yet in `dev`, and the dec
|
|||
Rows key on the **upstream SHA** (stable across local cherry-picks). Deferred rows are provisional
|
||||
— re-inspect before picking. See the fork-maintenance runbook in `CLAUDE.md`.
|
||||
|
||||
**Last synced `upstream/main`:** `fd2541ce` (2026-07-09)
|
||||
**Last synced `upstream/main`:** `71e3b818` (2026-07-09)
|
||||
|
||||
| sha | pr | subject | decision | why | branch |
|
||||
|---|---|---|---|---|---|
|
||||
|
|
@ -94,5 +94,9 @@ Rows key on the **upstream SHA** (stable across local cherry-picks). Deferred ro
|
|||
| `feb7ac98` | #1689 | feat(web): surface thread sandbox ID with touch-friendly menu (#1689) | Deferred | applies clean but frontend<->backend contract (thread_api->queries->types->sidebar); needs UI build + e2e validation — separate PR | dashboard-ui |
|
||||
| `f53caff1` | #1701 | fix: fall back to core GitHub App scope when optional grants missing (#1701) | Deferred | FLAG-HUMAN: GitHub-App permission-ladder degrade (auth surface); heavy conflict on diverged github_app.py/_resolve_proxy_token | github-app-scope |
|
||||
| `22e024cb` | #1704 | fix: link issue PRs and prompt repo conventions (#1704) | Deferred | issue/PR linking + repo-convention prompt; clean but prompt-conflict risk vs #113 | webhook-issue-linking |
|
||||
| `27b0ddeb` | #1708 | feat: add GPT-5.6 OpenAI models (#1708) | Deferred | FLAG-HUMAN: adds OpenAI GPT-5.6 to the model picker; fork's picker is Bedrock/Fireworks-only — needs a product decision before adopting OpenAI models. Gateway (#155) can route OpenAI if adopted. | model-picker |
|
||||
| `62e0ca2d` | #1709 | fix: stale admin model defaults after model upgrades (#1709) | Deferred | stale admin model-default cleanup in team_settings after model upgrades; applies to fork's default-model resolution. | model-picker |
|
||||
| `138ab9ec` | #1710 | fix: bump langchain-fireworks to 1.4.4 (#1710) | Deferred | langchain-fireworks 1.4.4 bump; fork uses Fireworks as a primary provider — adopt with a lockfile refresh. | deps |
|
||||
| `71e3b818` | #1713 | fix: align reviewer eval with published findings (#1713) | Deferred | reviewer-eval/judge alignment; touches reviewer.py + add_finding/publish_review which are fork-diverged — reconcile against fork's reviewer before porting. | reviewer-eval |
|
||||
|
||||
_Maintenance: after a `git sync`, add new `dev..upstream/main` SHAs as **Untriaged** (edit `triage.jsonl`) and bump "Last synced". A successful `git cherry-pick -x` auto-moves the row to **Landed** via the `post-commit` journal + `make triage-reconcile`._
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue