Skip to content

Commit f147518

Browse files
Fotios Tsakiridisclaude
andcommitted
Release v2.82.1 - Self-parent Prevention & Assistant Context
- Fix: Self-parent detection in MCP server (parent_sequence validation) - Fix: Self-dependency detection with full rollback (no partial commits) - Improved: Assistant context files with dependency rules documentation - Improved: Clear WRONG vs CORRECT examples for depends_on and parent_sequence Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d09f52c commit f147518

30 files changed

Lines changed: 3430 additions & 69 deletions

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ All notable changes to CodeHero will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [2.82.1] - 2026-01-23
9+
10+
### Fixed
11+
- **Self-parent Prevention** - MCP server now also validates parent_sequence
12+
- Detects if a ticket would be its own parent (e.g., `parent_sequence:1` for first ticket)
13+
- Returns error and rolls back ALL tickets - no partial commits
14+
- Error message: "Skipped self-parent: TICKET cannot be its own parent"
15+
16+
### Improved
17+
- **Assistant Context Files** - Added comprehensive dependency rules documentation
18+
- Clear examples of WRONG vs CORRECT usage for `depends_on` and `parent_sequence`
19+
- Explanation that both use 1-indexed array position
20+
- Updated: assistant-planner.md, assistant-general.md, assistant-progress.md, CLAUDE.md
21+
22+
---
23+
824
## [2.82.0] - 2026-01-23
925

1026
### Added
@@ -21,6 +37,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2137
- "New Key" button to regenerate and revoke old access
2238
- Clear explanation that each project has isolated access
2339

40+
### Fixed
41+
- **Self-dependency Prevention** - MCP server now validates dependencies
42+
- Detects if a ticket would depend on itself (e.g., `depends_on:[1]` for first ticket)
43+
- Returns error and rolls back ALL tickets - no partial commits
44+
- Clear error message guides assistant to fix the logic
45+
- **API Authentication** - `login_required` decorator returns JSON for `/api/` routes
46+
- Previously returned HTML redirect causing "Unexpected token <" errors
47+
- **Upgrade Script** - nginx auth detection now handles both old and no-auth configs
48+
- **MAX_PARALLEL Settings** - Added to upgrade.sh for existing installations
49+
2450
### Changed
2551
- Replaced HTTP Basic Auth with session-based authentication
2652
- Nginx config updated for auth_request validation

CLAUDE_DEV_NOTES.md

Lines changed: 184 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,188 @@ mysql -u claude_user -p claude_knowledge -e "SELECT * FROM tickets ORDER BY id D
299299

300300
---
301301

302-
## Current Features (v2.33.0)
302+
## Ticket Execution Logic (v2.80.11+)
303+
304+
### Execution Order
305+
306+
Tickets are selected for execution based on:
307+
1. **Status:** Must be `open`, `new`, or `pending`
308+
2. **Parent:** If has `parent_ticket_id`, parent must be `done` or `skipped`
309+
3. **Dependencies:** ALL dependencies must be `done` or `skipped`
310+
4. **Sequence Order:** Lower `sequence_order` runs first
311+
5. **Parallel:** Tickets with **same sequence_order** run in parallel (max 5)
312+
6. **Forced Queue:** `is_forced=1` tickets get priority
313+
314+
### Parallel Execution
315+
316+
**Two levels of parallelism:**
317+
318+
| Level | Max Parallel | Scope |
319+
|-------|--------------|-------|
320+
| Projects | 10 | Different projects run simultaneously |
321+
| Tickets | 5 | Same `sequence_order` within a project |
322+
323+
**Per Project - Tickets with same `sequence_order`:**
324+
```
325+
Project A:
326+
sequence_order=1: [Ticket 1, 2, 3] → run in parallel (max 5)
327+
sequence_order=2: [Ticket 4] → waits for 1,2,3 to finish
328+
sequence_order=3: [Ticket 5, 6] → run in parallel after 4
329+
330+
Project B: (runs simultaneously with Project A)
331+
sequence_order=1: [Ticket 7]
332+
sequence_order=2: [Ticket 8, 9]
333+
```
334+
335+
**Note:** `sequence_order` is **per project**, not global.
336+
337+
**Use cases:**
338+
- Independent setup tasks (install deps, create folders)
339+
- Multiple tests that don't conflict
340+
- Parallel feature development in different files
341+
342+
### Key Concepts
343+
344+
| Concept | Purpose | Blocks Execution? |
345+
|---------|---------|-------------------|
346+
| `sequence_order` | Order + parallel grouping | NO - same seq runs parallel |
347+
| `parent_ticket_id` | Context + implicit dependency | **YES** - parent must be done |
348+
| `depends_on` (ticket_dependencies) | Explicit dependency | **YES** - must be done/skipped |
349+
| `deps_include_awaiting` | Controls auto-review behavior | NO - affects review only |
350+
351+
### Parent Tickets (parent_ticket_id)
352+
353+
**BLOCKS execution.** Child ticket waits for parent to be `done` or `skipped`.
354+
355+
- Parent is an **implicit dependency** - no need to add explicit dependency
356+
- Child inherits context from ALL ancestors (recursive)
357+
- Child's summary includes ancestor summaries
358+
359+
```sql
360+
-- Sub-ticket that waits for parent (automatic)
361+
INSERT INTO tickets (parent_ticket_id, ...) VALUES (1, ...);
362+
-- Child will NOT run until parent (ticket 1) is 'done' or 'skipped'
363+
364+
-- Sub-ticket with additional dependencies
365+
INSERT INTO tickets (parent_ticket_id, ...) VALUES (1, ...);
366+
INSERT INTO ticket_dependencies (ticket_id, depends_on_ticket_id) VALUES (child_id, other_ticket_id);
367+
-- Child waits for BOTH parent AND other_ticket
368+
```
369+
370+
### Dependencies (ticket_dependencies table)
371+
372+
**Explicit dependencies** for tickets that need to wait for non-parent tickets.
373+
374+
```sql
375+
-- Ticket 2 depends on Ticket 1 (not a parent-child relationship)
376+
INSERT INTO ticket_dependencies (ticket_id, depends_on_ticket_id) VALUES (2, 1);
377+
```
378+
379+
### deps_include_awaiting (Relaxed vs Strict Mode)
380+
381+
**Does NOT affect execution order.** Only affects auto-review behavior.
382+
383+
| Value | Mode | Auto-Review Behavior |
384+
|-------|------|---------------------|
385+
| `0` | Strict | Waits for user to close `awaiting_input` tickets |
386+
| `1` | Relaxed | Auto-closes `awaiting_input` tickets after delay |
387+
388+
### Auto-Review System
389+
390+
When a ticket completes (`completed` result), it goes to `awaiting_input` status.
391+
392+
**In Relaxed Mode (deps_include_awaiting=1):**
393+
1. Haiku classifies the result (COMPLETED/QUESTION/ERROR)
394+
2. If "COMPLETED" → auto-closes to `done`
395+
3. If "QUESTION/ERROR" → stays `awaiting_input`
396+
4. Delay: `AUTO_REVIEW_DELAY_SECONDS` (default: 10 seconds)
397+
5. Summary NOT generated here (lazy generation when child starts)
398+
399+
**In Strict Mode (deps_include_awaiting=0):**
400+
- No auto-review
401+
- User must manually close tickets
402+
403+
**Manual Close (from web):**
404+
- Just closes the ticket (no summary generation)
405+
406+
### Summary Generation (Lazy - On Demand)
407+
408+
Summaries are generated **only when needed** - when a child ticket starts:
409+
410+
1. Child ticket starts → checks if ancestors have `result_summary`
411+
2. If ancestor has NO summary → Haiku generates it from last 50 messages
412+
3. Summary saved to ancestor's `result_summary`
413+
4. Child receives context with all ancestor summaries
414+
415+
**Haiku Summary Settings:**
416+
- Last 50 messages from conversation
417+
- Each message truncated to 500 chars
418+
- Total context max 15,000 chars
419+
- Output summary max 500 chars
420+
421+
**Context format for child:**
422+
```
423+
=== PARENT TICKET CONTEXT (2 levels) ===
424+
[Root] PROJ-0001 - Setup database
425+
Description: Create MySQL schema...
426+
Result: Created users, products, orders tables with indexes...
427+
428+
[Level 1] PROJ-0002 - Build auth
429+
Description: Implement authentication...
430+
Result: JWT auth with login/logout, password reset via email...
431+
432+
This is a sub-task. Use the parent context to understand the overall goal.
433+
==================================================
434+
```
435+
436+
- Summary stored in `result_summary` field (max 2000 chars)
437+
- Only generated once per ticket (cached)
438+
- Tickets without children never generate summary (saves Haiku calls)
439+
440+
### Execution Flow Example
441+
442+
```
443+
Project with deps_include_awaiting=1 (relaxed):
444+
445+
Ticket 1 (seq=1): Setup → runs first
446+
Ticket 2 (seq=2): depends on 1 → waits for 1 to be 'done'
447+
Ticket 3 (seq=3): no deps → can run after 1 finishes
448+
449+
With sub-tickets (parent = implicit dependency):
450+
Parent (seq=1): Main task → runs first
451+
Child (seq=2, parent_ticket_id=Parent):
452+
→ waits for parent to be 'done' (automatic)
453+
→ gets parent's context and summary
454+
```
455+
456+
### SQL Query (get_next_ticket)
457+
458+
```sql
459+
SELECT * FROM tickets t
460+
WHERE t.project_id = ? AND t.status IN ('open', 'new', 'pending')
461+
AND NOT EXISTS (
462+
-- Skip if has unfinished dependencies
463+
SELECT 1 FROM ticket_dependencies td
464+
JOIN tickets dt ON dt.id = td.depends_on_ticket_id
465+
WHERE td.ticket_id = t.id
466+
AND dt.status NOT IN ('done', 'skipped')
467+
)
468+
AND (
469+
-- Parent must be done/skipped (implicit dependency)
470+
t.parent_ticket_id IS NULL
471+
OR EXISTS (
472+
SELECT 1 FROM tickets pt
473+
WHERE pt.id = t.parent_ticket_id
474+
AND pt.status IN ('done', 'skipped')
475+
)
476+
)
477+
ORDER BY t.is_forced DESC, t.sequence_order ASC, t.id ASC
478+
LIMIT 1
479+
```
480+
481+
---
482+
483+
## Current Features (v2.80.11)
303484

304485
- Project & Ticket Management
305486
- Real-time Chat with Claude
@@ -334,5 +515,5 @@ mysql -u claude_user -p claude_knowledge -e "SELECT * FROM tickets ORDER BY id D
334515

335516
---
336517

337-
*Last Updated: 2026-01-11*
338-
*Current Version: 2.33.0*
518+
*Last Updated: 2026-01-22*
519+
*Current Version: 2.80.10*

INSTALL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
```bash
1414
cd /root
15-
unzip codehero-2.82.0.zip
15+
unzip codehero-2.82.1.zip
1616
cd codehero
1717
```
1818

@@ -129,8 +129,8 @@ sudo systemctl restart codehero-web codehero-daemon
129129
```bash
130130
# Download and extract new version
131131
cd /root
132-
wget https://github.com/fotsakir/codehero/releases/latest/download/codehero-2.82.0.zip
133-
unzip codehero-2.82.0.zip
132+
wget https://github.com/fotsakir/codehero/releases/latest/download/codehero-2.82.1.zip
133+
unzip codehero-2.82.1.zip
134134
cd codehero
135135

136136
# Preview what will change (recommended)

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<p align="center">
1313
<a href="LICENSE"><img src="https://img.shields.io/badge/License-Dual-blue.svg" alt="License"></a>
14-
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-2.82.0-green.svg" alt="Version"></a>
14+
<a href="CHANGELOG.md"><img src="https://img.shields.io/badge/version-2.82.1-green.svg" alt="Version"></a>
1515
<img src="https://img.shields.io/badge/Ubuntu-22.04%20|%2024.04-orange.svg" alt="Ubuntu">
1616
<a href="https://anthropic.com"><img src="https://img.shields.io/badge/Powered%20by-Claude%20AI-blueviolet.svg" alt="Claude AI"></a>
1717
<a href="https://github.com/fotsakir/codehero/stargazers"><img src="https://img.shields.io/github/stars/fotsakir/codehero?style=social" alt="Stars"></a>
@@ -378,8 +378,8 @@ apt-get update && apt-get install -y unzip wget net-tools
378378

379379
# Download and extract
380380
cd /root
381-
wget https://github.com/fotsakir/codehero/releases/latest/download/codehero-2.82.0.zip
382-
unzip codehero-2.82.0.zip
381+
wget https://github.com/fotsakir/codehero/releases/latest/download/codehero-2.82.1.zip
382+
unzip codehero-2.82.1.zip
383383
cd codehero
384384

385385
# Run setup
@@ -405,7 +405,7 @@ The installer automatically sets up:
405405
```bash
406406
# Download new version
407407
cd /root
408-
unzip codehero-2.82.0.zip
408+
unzip codehero-2.82.1.zip
409409
cd codehero
410410

411411
# Preview changes (recommended)

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.82.0
1+
2.82.1

config/assistant-general.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,31 @@ seq=2: [Homepage, About, Contact] → ALL run parallel
6363

6464
**Never ask "do you want parallel?"** - Just design for maximum parallelism!
6565

66+
## ⚠️ DEPENDENCY RULES (CRITICAL!)
67+
68+
`depends_on` uses **1-indexed array position** (NOT sequence_order, NOT ticket ID):
69+
70+
```json
71+
tickets: [
72+
{"title": "Setup DB"}, ← Position 1
73+
{"title": "Install deps"}, ← Position 2
74+
{"title": "Build API", "depends_on": [1, 2]} ← Waits for positions 1 AND 2
75+
]
76+
```
77+
78+
**❌ SELF-DEPENDENCY ERROR - ALL TICKETS REJECTED:**
79+
```json
80+
❌ WRONG: {"title": "Setup", "depends_on": [1]} ← Position 1 IS this ticket!
81+
```
82+
83+
**Quick Rule:** Ticket at position N can ONLY depend on positions < N
84+
85+
**Same applies to `parent_sequence`:**
86+
```json
87+
❌ WRONG: {"title": "Main", "parent_sequence": 1} ← Position 1's parent is 1 = ITSELF!
88+
✅ CORRECT: Position 1 = parent, Position 2+ can have parent_sequence: 1
89+
```
90+
6691
## EXAMPLES OF USING MCP TOOLS:
6792

6893
User: "Show me my projects"

0 commit comments

Comments
 (0)