Publish FI briefs to origin or fail the day
Some checks failed
Governed runtime contract / contract (push) Failing after 26s
Some checks failed
Governed runtime contract / contract (push) Failing after 26s
FI-WP-0004 grants origin publication. Local commit without push no longer posts fi_daily_brief (that cleared due while losing the file). Prompt/context refuse re-announcing cataloged models and invented sizes. Assistant: grok Assistant-Session: 01a09c6a-1cfc-75b1-a78d-c13eaf22241d
This commit is contained in:
parent
ee3800f26d
commit
11020e8f00
4 changed files with 136 additions and 42 deletions
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
activity-core owns *when* (Temporal schedule + fi_brief_status).
|
||||
This rein command owns *execution*: draft brief from playbook context,
|
||||
commit under freedom-intelligence, post fi_daily_brief for idempotence.
|
||||
commit under freedom-intelligence, **push to origin**, then post
|
||||
fi_daily_brief. A local-only commit is a failed day (FI-WP-0004).
|
||||
|
||||
No Claude Code / host coding agent — llm-connect only.
|
||||
"""
|
||||
|
|
@ -53,6 +54,8 @@ class FiResearchBriefResult:
|
|||
model_meta: dict[str, Any] = field(default_factory=dict)
|
||||
skipped_existing: bool = False
|
||||
collection_candidates: int = 0
|
||||
pushed: bool = False
|
||||
origin_sha: str = ""
|
||||
|
||||
|
||||
def _berlin_today() -> date:
|
||||
|
|
@ -93,6 +96,17 @@ def collect_context(repo: Path, day: date) -> str:
|
|||
f"{_truncate(last.read_text(encoding='utf-8', errors='replace'), 3500)}\n"
|
||||
)
|
||||
|
||||
catalog = repo / "inventory" / "catalog"
|
||||
if catalog.is_dir():
|
||||
lines = [
|
||||
"## Catalog (DO NOT re-announce these as new releases; "
|
||||
"DO NOT invent sizes that contradict these entries)\n"
|
||||
]
|
||||
for p in sorted(catalog.glob("*.yaml")):
|
||||
text = p.read_text(encoding="utf-8", errors="replace")
|
||||
lines.append(f"### {p.name}\n{_truncate(text, 900)}\n")
|
||||
chunks.append("\n".join(lines))
|
||||
|
||||
try:
|
||||
log = _git(repo, "log", f"-{_MAX_GIT_LOG}", "--oneline")
|
||||
chunks.append(f"## Recent git log\n{log}\n")
|
||||
|
|
@ -114,6 +128,12 @@ Rules:
|
|||
- Cover axes when there is signal: A frontier/commercial, B open/local,
|
||||
C training/FT, D harness/fleet.
|
||||
- Flag collection candidates only when license/size/rationale are clear.
|
||||
- NEVER re-announce a model that already has a catalog YAML as a "new release".
|
||||
- NEVER invent parameter counts or file sizes. If the card is not in context,
|
||||
write "unknown — verify card" rather than guessing. DeepSeek-V4-Flash-0731
|
||||
is a ~304B / ~13B-active MIT MoE (~167 GiB), NOT a 12B dense model.
|
||||
- Every non-empty axis row needs a primary URL in "sources".
|
||||
- Scan axes C (training) and D (harness) even if the result is an empty array.
|
||||
- Prefer primary sources; mark unverified claims as "unverified".
|
||||
- "No material delta" is allowed **only** when you have considered the prior
|
||||
brief + allowlist + reserve status and still find nothing. Even then:
|
||||
|
|
@ -317,12 +337,12 @@ def _truncate(text: str, n: int) -> str:
|
|||
return text[: n - 20] + "\n…(truncated)…\n"
|
||||
|
||||
|
||||
def _git(repo: Path, *args: str) -> str:
|
||||
def _git(repo: Path, *args: str, timeout: int = 60) -> str:
|
||||
result = subprocess.run(
|
||||
["git", "-C", str(repo), *args],
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=60,
|
||||
timeout=timeout,
|
||||
)
|
||||
if result.returncode != 0:
|
||||
raise FiResearchBriefError(
|
||||
|
|
@ -331,6 +351,15 @@ def _git(repo: Path, *args: str) -> str:
|
|||
return result.stdout.strip()
|
||||
|
||||
|
||||
def _publish_origin(repo: Path) -> str:
|
||||
"""Push HEAD to origin. FI-owned grant: origin is the durable brief store."""
|
||||
branch = _git(repo, "rev-parse", "--abbrev-ref", "HEAD")
|
||||
if not branch or branch == "HEAD":
|
||||
branch = "main"
|
||||
_git(repo, "push", "-u", "origin", f"HEAD:{branch}", timeout=120)
|
||||
return _git(repo, "rev-parse", "HEAD")
|
||||
|
||||
|
||||
def run_fi_research_brief(
|
||||
target_repo: Path,
|
||||
*,
|
||||
|
|
@ -357,6 +386,7 @@ def run_fi_research_brief(
|
|||
result.head_after = _git(repo, "rev-parse", "HEAD")
|
||||
except FiResearchBriefError:
|
||||
pass
|
||||
_finalize_publish(result, repo, commit=commit)
|
||||
_hub(result, report_to_hub, repo)
|
||||
return result
|
||||
|
||||
|
|
@ -448,22 +478,41 @@ def run_fi_research_brief(
|
|||
model_meta=meta,
|
||||
collection_candidates=n_cands,
|
||||
)
|
||||
_finalize_publish(result, repo, commit=commit)
|
||||
_hub(result, report_to_hub, repo)
|
||||
return result
|
||||
|
||||
|
||||
def _finalize_publish(
|
||||
result: FiResearchBriefResult, repo: Path, *, commit: bool
|
||||
) -> None:
|
||||
"""Origin push is required for a successful brief day when we commit."""
|
||||
if not commit or not result.ok:
|
||||
return
|
||||
try:
|
||||
sha = _publish_origin(repo)
|
||||
result.pushed = True
|
||||
result.origin_sha = sha
|
||||
result.head_after = sha
|
||||
except FiResearchBriefError as exc:
|
||||
result.ok = False
|
||||
result.reason = f"origin publish failed: {exc}"[:300]
|
||||
|
||||
|
||||
def _hub(result: FiResearchBriefResult, report_to_hub: bool, repo: Path) -> None:
|
||||
if not report_to_hub:
|
||||
return
|
||||
if result.ok:
|
||||
# Idempotence for activity-core fi_brief_status resolver
|
||||
# fi_daily_brief clears activity-core due. Only fire it when origin has
|
||||
# the brief (FI-WP-0004). Local commit without push is a failed day.
|
||||
published = result.ok and result.pushed
|
||||
if published:
|
||||
event_type = "fi_daily_brief"
|
||||
summary = (
|
||||
f"FI daily brief {result.date}"
|
||||
+ (
|
||||
" (already present)"
|
||||
" (already present, pushed)"
|
||||
if result.skipped_existing
|
||||
else f" wrote={result.wrote} committed={result.committed}"
|
||||
else f" wrote={result.wrote} committed={result.committed} pushed={result.pushed}"
|
||||
)
|
||||
)
|
||||
detail = {
|
||||
|
|
@ -473,18 +522,23 @@ def _hub(result: FiResearchBriefResult, report_to_hub: bool, repo: Path) -> None
|
|||
"collection_candidates": result.collection_candidates,
|
||||
"wrote": result.wrote,
|
||||
"committed": result.committed,
|
||||
"pushed": result.pushed,
|
||||
"origin_sha": result.origin_sha,
|
||||
"skipped_existing": result.skipped_existing,
|
||||
"executor": "rein-aharness",
|
||||
}
|
||||
else:
|
||||
event_type = "executor_run"
|
||||
summary = f"FI daily research brief failed: {result.reason}"
|
||||
summary = f"FI daily research brief failed: {result.reason or 'not published to origin'}"
|
||||
detail = {
|
||||
"repo": "freedom-intelligence",
|
||||
"ok": False,
|
||||
"date": result.date,
|
||||
"reason": result.reason,
|
||||
"model_meta": result.model_meta,
|
||||
"wrote": result.wrote,
|
||||
"committed": result.committed,
|
||||
"pushed": result.pushed,
|
||||
"executor": "rein-aharness",
|
||||
}
|
||||
hub.post_progress_event(summary=summary, event_type=event_type, detail=detail)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue