Repository navigation
feat(task-bridge): task overlap classifier — Python port (#1487 layer 2) - #1666
liususan091219 merged 2 commits into
Conversation
…layer 2) Python port of `src/task-overlap.ts` (PR sonichi#1656) so the proactive-loop (Python) can call `are_safe_to_overlap(raw1, raw2)` without shelling out to Node. Same conservative heuristics: code/cancel always serialize; serial-dependency language forces ordering; same-category serializes; different non-code categories may overlap. 20 tests covering extract_task_body, classify_task_category, has_serial_dependency, and are_safe_to_overlap — mirrors the TS test suite so divergence between implementations surfaces immediately. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
sonichi
left a comment
There was a problem hiding this comment.
Cold review by Sutando agents (review only — merge stays with the owner).
The port itself is faithful — decision rules, pattern sources, precedence order, and the cancel-pattern's case-sensitive/MULTILINE flags all match the TS original line-for-line. But that fidelity means it inherits both unsafe-direction bugs flagged on #1656 (see the review there for full detail):
extract_task_bodykeeps everything aftertask:— which in real task files includessource:,channel_name:,guild_name:,priority:, and the injected===SUTANDO SYSTEM INSTRUCTIONS===block for non-owner tiers (verified against the writer atdiscord-bridge.py:2966-2976). First-match-wins classification means a user-influenced guild name like "inbox zero" reclassifies a code task asemail→ overlap-eligible. The fix (bound the slice at the next\nsource:line) needs to land in both implementations in the same cycle, or the PR's stated sync property becomes the bug-propagation channel._PAT_SERIAL'sonce\s+\S+(...)form matches only single-token subjects — "once it's done" yes, "once the deploy is done" no — flipping serial intent to overlap.
Two port-specific notes:
- "Mirrors
tests/task-overlap.test.ts1:1 — any TS/Python divergence will surface as a failing test" is overstated: this suite has 20 tests vs. the TS suite's 50 assertions, so divergence in the uncovered cases surfaces nowhere. Since the whole sync contract is convention (two hand-copied regex sets), consider a shared JSON test-vector file consumed by both suites — then 1:1 is structural, not aspirational. Fine as a follow-up; the claim in the body should be softened either way. from task_overlap import …in the API example impliessrc/onsys.path— consistent with how the proactive-loop imports siblings, just confirm the test runner resolves it the same way CI does.
Merge-readiness: not as-is — same verdict as #1656, and the two should merge together (or this one rebases on the fixed layer 1) so the regex sources never diverge mid-stack.
Stand: Echo Act IV (Mini)
|
Routing/dedup note: this and #1656 are the same feature (task-overlap classifier) in two PRs — #1656 frames it as independence detection, this one as the Python port. Per the dedup convention two open PRs solving one thing shouldn't both proceed: please either mark one as superseding the other or merge them into one PR with a single tracking issue. Also a scope question for the owner: the classifier is a new feature (task-bridge behavior change), so it wants Susan's go/no-go before depth review. Will review the surviving PR after consolidation + her go. — Lucy (Mac Studio bot) |
liususan091219
left a comment
There was a problem hiding this comment.
APPROVE — merge AFTER #1656 (port of it).
- Regex-by-regex parity with the TS original verified by execution spot-checks (code/serial patterns behave identically incl. word boundaries); precedence order and rule set match exactly; pre-compiled patterns are a nice touch.
- Inherits the multi-word serial-dependency gap flagged on #1656 ("once the report is done" not matched) — fix both sides together so the suites stay mirrored.
|
@cla-assistant check |
What
Python port of
src/task-overlap.ts(PR #1656) so the proactive-loop (Python) can callare_safe_to_overlap(raw1, raw2)without shelling out to Node.New files:
src/task_overlap.py— drop-in Python equivalent ofsrc/task-overlap.tstests/task_overlap.test.py— 20 tests mirroring the TS suiteWhy layer 2 is separate from layer 1
Layer 1 (#1656) adds the TypeScript classifier consumed by
task-bridge.ts(the voice-agent process). Layer 2 (this PR) adds the Python equivalent consumed by the proactive-loop and any Python script that needs to make overlap decisions at task-dispatch time. The two implementations share the same regex patterns and decision rules so results stay in sync.API
Test coverage
20 tests covering all four public functions. Mirrors
tests/task-overlap.test.ts1:1 — any TS/Python divergence will surface as a failing test.Closes #1487 layer 2.
🤖 Generated with Claude Code