fix(claws): enforce 24h window and dedupe state in sageox-summary#504
fix(claws): enforce 24h window and dedupe state in sageox-summary#504
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds stateful per-team tracking and a new file-selection stage that picks UTC date-prefixed daily files (today/yesterday) and skips processing when none are new. Prompts now use an explicit file list; two new scripts select new files and atomically merge/prune state. Changes
Sequence Diagram(s)sequenceDiagram
participant Skill as "sageox-summary Skill"
participant Select as "select-new-files.sh"
participant State as "sageox-summary-state.json"
participant Claude as "Claude API"
participant Update as "update-state.sh"
Skill->>State: load (or init) state
Skill->>Select: request new files per team (today/yesterday)
Select->>State: read included_files for team
Select-->>Skill: return new basenames (0..N)
alt no new files for any team
Skill-->>Skill: short-circuit and emit single-line status
else new files exist
Skill->>Claude: invoke with --add-dir + {{FILE_LIST}} for teams with files
Claude-->>Skill: return summaries
Skill->>Update: send newly-summarized basenames per team via stdin
Update->>State: atomically merge, prune by cutoff, write updated JSON
Update-->>Skill: success (no stdout)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-Authored-By: SageOx <ox@sageox.ai> SageOx-Session: https://sageox.ai/repo/repo_019c5812-01e9-7b7d-b5b1-321c471c9777/sessions/2026-04-13T13-46-galexy-Oxa4Ab/view
d5721f1 to
55b731b
Compare
Summary
sageox-summaryusing the UTC date prefix in distilled filenames (YYYY-MM-DD-<uuid>.md). Over-includes today + yesterday to cleanly cover the day boundary, then filters against a new state file so repeated runs within the window never re-summarize the same content.~/.openclaw/memory/sageox-summary-state.json: a per-teamincluded_filesledger with atomic write + window-based pruning. First run = empty state = everything in the window is new. Malformed state = stderr warning (never mixed into stdout), treated as empty, overwritten on the next successful run.scripts/following the Agent Skills specscripts/convention:scripts/select-new-files.sh(enumeration + set-difference) andscripts/update-state.sh(merge + prune + atomic rename). SKILL.md carries orchestration and rationale; the scripts carry the shell plumbing.Why
The skill's prompt told Claude "read the last 24 hours", but nothing enforced the window —
claude -pwas pointed at the entirememory/daily/dir and trusted to filter by filename, which in practice meant every historical distill file was in scope. This PR makes the filter real, idempotent across re-runs, and atomic on state-file write so a kill mid-run can't silently poison the next invocation's candidate set.The script extraction is an agent-UX win beyond just token count: the executing OpenClaw agent no longer needs to parse my bash, pick a set-difference method, handle BSD-vs-GNU
dateportability, or get atomic-write semantics right. It just invokes two scripts with documented contracts.Depends on
revert: delete team-timezone feature, hardcode UTC everywhere) — distill's daily grouping is now UTC, which is what this PR's 24h window math assumes. Without revert: delete team-timezone feature, hardcode UTC everywhere #500 the window would be misaligned by up to a day for non-UTC teams. revert: delete team-timezone feature, hardcode UTC everywhere #500 is already merged to main.Test plan
sageox-summary-state.jsonNo new distilled content since last summary.and does not invoke Claudeincluded_filesupdates independently; teams with no new files pass through unchangedWhat I already verified locally
clawhub-skill-lint: PASS, 5 files, 29 KB / 50 MB, 0 critical, 0 warningyesterday_utc, BSD-vs-GNU awk portability (a bug my first pass shipped that the smoke tests caught)make lint/make testnot run — change is pure markdown + bash, no GoAgent-UX review summary
Ran the changes through an
agent-uxcoworker review before committing. All criticals (C1 atomic state-file write, C2 concrete enumeration recipe, C3 stderr warning on malformed state) and warnings (W1 relative paths in the file list, W2 drop dead read-order hint, W3 explicittimeout 600, W4 trust-model cross-ref) addressed in the same commit. The subsequentscripts/extraction then removed most of the inline shell entirely, so the W1/C2-level shell plumbing now lives in deterministic helpers instead of SKILL.md prose.🤖 Generated with Claude Code
Co-Authored-By: SageOx
Summary by CodeRabbit
New Features
Documentation