Skip to content

Task-plan tracking and progress-message management#1248

Closed
dimonb wants to merge 14 commits intosipeed:mainfrom
dimonb:codex/fix-tasktool-plan-ordering
Closed

Task-plan tracking and progress-message management#1248
dimonb wants to merge 14 commits intosipeed:mainfrom
dimonb:codex/fix-tasktool-plan-ordering

Conversation

@dimonb
Copy link
Copy Markdown
Contributor

@dimonb dimonb commented Mar 8, 2026

📝 Description

This PR introduces task-plan tracking and progress-message management from scratch.

It adds a new tasktool with persisted per-session task state, wires the feature into the agent loop, and adds the channel plumbing needed to post and later update a live execution plan. It also rounds out the feature with config support, Telegram chunk-aware message editing, regression tests, and English documentation.

High-level changes:

  • add session.TaskManager for persisted session-scoped task plans and task updates
  • add tasktool actions for create_plan, update_task, list_plan, and resend_plan
  • add synchronous channel send/edit support so tools can immediately capture message IDs and update progress later
  • handle multi-part Telegram plan messages by tracking and editing all chunk IDs
  • introduce SequentialTool so stateful tools like tasktool can preserve model order within one turn
  • document tasktool runtime behavior and add a short developer note for tool authors

🗣️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 📖 Documentation update
  • ⚡ Code refactoring (no functional changes, no api changes)

🤖 AI Code Generation

  • 🤖 Fully AI-generated (100% AI, 0% Human)
  • 🛠️ Mostly AI-generated (AI draft, Human verified/modified)
  • 👨‍💻 Mostly Human-written (Human lead, AI assisted or none)

🔗 Related Issue

N/A

📚 Technical Context (Skip for Docs)

  • Reference URL: N/A
  • Reasoning: The planning feature needs persistent task state tied to agent sessions, plus synchronous access to platform message IDs so plan messages can be updated later. Because task updates mutate shared session state, the tool execution layer also needs an ordered path for stateful tools within a single LLM turn.

🧪 Test Environment

  • Hardware: Apple Silicon Mac
  • OS: macOS 26.3
  • Model/Provider: Mock providers in Go unit tests
  • Channels: Direct/CLI, Telegram (unit-test coverage)

📸 Evidence (Optional)

Click to view Logs/Screenshots

go test ./pkg/agent ./pkg/tools ./pkg/channels/telegram ./pkg/session

Passed locally.

☑️ Checklist

  • My code/docs follow the style of this project.
  • I have performed a self-review of my own changes.
  • I have updated the documentation accordingly.

dimonb added 12 commits March 7, 2026 23:19
…ontext` in task tool callbacks, and improve task tool and channel manager error handling.
- Check original key for '/' and '\' before sanitizing in session/manager.go
  and session/tasks.go, so traversal-like keys are rejected rather than
  silently normalized by SanitizeFilename (fixes TestSave_RejectsPathTraversal)
- Add "tasktool" case to IsToolEnabled switch so tools.tasktool.enabled: false
  actually disables the tool instead of falling through to default: true
- Add WithToolSessionKey/ToolSessionKey context helpers to pkg/tools/base.go
- Inject opts.SessionKey into ctx in runAgentLoop so tasktool uses the
  same agent-scoped session key as conversation history instead of the
  bare channel:chatID composite (fixes plan cross-agent/scope collision)
- Call Save inside CreatePlan so plans persist after restart even on
  channels that never return a message ID (fixes data loss on non-Telegram)
- Add tasktool section to config/config.example.json and
  docs/tools_configuration.md (P3 documentation gap)
- Add TaskTool entry to DefaultConfig() with enabled:true and the four
  icon defaults (🔘/🟡/🟢/🔴), matching the documented defaults
- Replace dead default:"..." struct tags on TaskToolIconsConfig with the
  correct caarlos0/env v11 format env:"VAR,default=VALUE" so env overrides
  actually work; previously the bare default: tag was silently ignored
…IconsConfig

caarlos0/env/v11 does not support a default= option inside the env tag —
it caused LoadConfig to fail at startup with "tag option not supported".
Defaults are already set correctly in DefaultConfig(), so the option is
simply removed.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 8, 2026

CLA assistant check
All committers have signed the CLA.

@dimonb dimonb closed this Mar 8, 2026
@dimonb dimonb deleted the codex/fix-tasktool-plan-ordering branch March 8, 2026 15:06
@dimonb dimonb restored the codex/fix-tasktool-plan-ordering branch March 9, 2026 07:51
@dimonb dimonb reopened this Mar 9, 2026
@sipeed-bot sipeed-bot bot added type: enhancement New feature or request domain: tool domain: channel go Pull requests that update go code labels Mar 9, 2026
@yinwm
Copy link
Copy Markdown
Collaborator

yinwm commented Mar 11, 2026

Hi @dimonb, thanks for this valuable PR! Task progress tracking is definitely a feature users need.

However, I noticed there's a major Agent Loop refactor being planned: #1316

#1316 will introduce:

  • EventBus - for emitting tool execution events
  • Hook system - for intercepting and observing execution
  • Smart tool grouping - sequential execution for stateful tools

These mechanisms could implement tasktool's functionality more elegantly:

Suggestion: Would you consider waiting for #1316 to be completed before implementing tasktool? This would:

  1. Avoid duplicate work of merging first, then refactoring later
  2. Make tasktool's implementation cleaner by leveraging EventBus + Hook directly
  3. Maintain architectural consistency

Alternatively, if this feature is urgently needed, it could be merged as a temporary solution and refactored together with #1316 later.

Would love to hear your thoughts on this.

@dimonb
Copy link
Copy Markdown
Contributor Author

dimonb commented Mar 11, 2026

@yinwm sounds reasonable

@sipeed-bot
Copy link
Copy Markdown

sipeed-bot bot commented Mar 26, 2026

@dimonb Hi! This PR has had no activity for over 2 weeks, so I'm closing it for now to keep things tidy. If it's still relevant, feel free to reopen it anytime and we'll pick it back up.

@sipeed-bot sipeed-bot bot closed this Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain: channel domain: tool go Pull requests that update go code type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants