Refactor task dependency graph to single-source (blockedBy only)#127
Open
JIA-ZI-LONG wants to merge 1 commit intoshareAI-lab:mainfrom
Open
Refactor task dependency graph to single-source (blockedBy only)#127JIA-ZI-LONG wants to merge 1 commit intoshareAI-lab:mainfrom
JIA-ZI-LONG wants to merge 1 commit intoshareAI-lab:mainfrom
Conversation
Background:
The TaskManager in s07_task_system.py maintained both `blockedBy` (incoming edges)
and `blocks` (outgoing edges) for each node. The design intended that calling
update() once with both `add_blocked_by` and `add_blocks` would update edges
bidirectionally. However, this design has two problems:
1. LLM never actually uses `add_blocks`:
Debugging showed that whether creating task chains (3 creates followed by
updates to connect) or inserting new nodes (A→B→C becoming A→B→D→C), the
LLM always calls update() separately for each node, only passing
`add_blocked_by`. The `add_blocks` parameter was never used - it's dead code.
2. Even if LLM followed the design, the graph would be incomplete:
When handling `add_blocks`, update() syncs to the next node's `blockedBy`,
but never updates the previous node's `blocks`. This means edge records
are unidirectional and missing, making `blocks` useless for understanding
the graph structure.
Conclusion: The `blocks` field is neither used by LLM nor can it stay consistent.
It should be removed. Execution scheduling only needs `blockedBy` (the existing
_clear_dependency also never reads `blocks`). Added `remove_blocked_by` to
support edge removal when inserting nodes.
Changes:
- Remove `blocks` field from task creation
- Remove `add_blocks` parameter from update() and its handling logic
- Add `remove_blocked_by` parameter to support edge removal during graph rewrites
- Update tool handlers and JSON schema accordingly
- Update documentation (en/ja/zh) to reflect the changes
New usage example (inserting D between B→C):
TASKS.create("D")
TASKS.update(D_id, add_blocked_by=[B_id])
TASKS.update(C_id, add_blocked_by=[D_id], remove_blocked_by=[B_id])
|
@JIA-ZI-LONG is attempting to deploy a commit to the crazyboym's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
The
TaskManagerins07_task_system.pymaintained bothblockedBy(incoming edges) andblocks(outgoing edges) for each node. The design intended that callingupdate()once with bothadd_blocked_byandadd_blockswould update edges bidirectionally.However, this design has two problems:
1. LLM never actually uses
add_blocksDebugging showed that whether creating task chains (3 creates followed by updates to connect) or inserting new nodes (A→B→C becoming A→B→D→C), the LLM always calls
update()separately for each node, only passingadd_blocked_by. Theadd_blocksparameter was never used - it's dead code.2. Even if LLM followed the design, the graph would be incomplete
When handling
add_blocks,update()syncs to the next node'sblockedBy, but never updates the previous node'sblocks. This means edge records are unidirectional and missing, makingblocksuseless for understanding the graph structure.Conclusion
The
blocksfield is neither used by LLM nor can it stay consistent. It should be removed. Execution scheduling only needsblockedBy(the existing_clear_dependencyalso never readsblocks). Addedremove_blocked_byto support edge removal when inserting nodes.Changes
blocksfield from task creationadd_blocksparameter fromupdate()and its handling logicremove_blocked_byparameter to support edge removal during graph rewritesNew Usage Example
Inserting D between B→C:
Test Results
Test 1: Create task chain with dependencies
Test 2: Insert node between existing tasks
✅ LLM correctly uses
add_blocked_byandremove_blocked_byto rewire the dependency graph when inserting nodes.Test Plan
python agents/s07_task_system.pyand verify the agent can still create and manage tasksadd_blocked_byremove_blocked_byfor node insertion scenarios