Skip to content

feat: Task ID semantics and lifecycle integrity (#3404, #3405)#3409

Open
garnetlyx wants to merge 1 commit into
code-yeongyu:devfrom
garnetlyx:feat/task-id-semantics-and-lifecycle
Open

feat: Task ID semantics and lifecycle integrity (#3404, #3405)#3409
garnetlyx wants to merge 1 commit into
code-yeongyu:devfrom
garnetlyx:feat/task-id-semantics-and-lifecycle

Conversation

@garnetlyx

@garnetlyx garnetlyx commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements GitHub issues #3404 (Task ID semantics) and #3405 (Task lifecycle integrity).

Changes

#3404: Task ID Semantics

  1. New utility (src/shared/id-types.ts): Added detectIdType() to identify ID types (background/task/session/unknown) and formatIdTypeError() for type-aware error messages.
  2. Type-aware errors (background_output): Now distinguishes session vs task vs background IDs and suggests the correct tool.
  3. Consistent metadata: Updated all 4 tool surfaces (delegate-task, call-omo-agent, sync-task, background-task) to use unified <task_metadata> format.

#3405: Task Lifecycle Integrity

  1. BlockedBy guard (task-update): Prevents marking a task completed if it has unresolved blockedBy dependencies.
  2. Near-duplicate detection (task-create): Warns (doesn't block) when creating a task with the same subject in the same session.

Verification

  • 478 tests pass, 0 fail
  • 47 files across 4 test suites
  • All new behaviors have test coverage
  • No breaking changes to existing tests

Summary by cubic

Adds type-aware Task ID handling and enforces dependency rules to prevent ID mix-ups and premature completion. Implements #3404 (Task ID semantics) and #3405 (Task lifecycle integrity).

  • New Features

    • Shared utils: detectIdType() and formatIdTypeError() classify IDs (bg_, T-, ses_/ses-) and return helpful hints.
    • background_output: type-aware errors; suggests session_read for ses_*/ses-* and task_update/task_get for T-...; generic not found for bg_.../unknown.
    • Unified <task_metadata>: emitted only when session_id is resolved; includes session_id and background_task_id. call-omo-agent and delegate-task updated; sync-task adds task_id for foreground tasks.
    • task_update: blocks completed if any blockedBy tasks are not completed or deleted; guard applies even when adding blockers in the same request; invalid IDs count as unresolved.
    • task_create: warns on near-duplicate subjects within the same session (task still created).
  • Migration

    • If you parse <task_metadata>, read background_task_id for background jobs; the block may be omitted until session_id is known. Do not rely on task_id in that block.

Written for commit dddfc6c. Summary will update on new commits.

@github-actions

github-actions Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. Thank you! ✅
Posted by the CLA Assistant Lite bot.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 issues found across 16 files

Confidence score: 2/5

  • I’m scoring this as high risk because there are two high-severity, high-confidence issues (7/10, confidence 9/10) with concrete user and security impact in src/tools/task/task-update.ts.
  • src/tools/task/task-update.ts uses untrusted blockedBy values in join(...) before strict ID validation, which can allow path traversal reads outside the task directory and should be treated as merge-blocking until fixed.
  • src/tools/task/task-update.ts can incorrectly allow status="completed" when addBlockedBy is included in the same update, since blocker checks run before merging new blockers; src/shared/id-types.ts also misses hyphenated session IDs like ses-main, causing incorrect not-found handling.
  • Pay close attention to src/tools/task/task-update.ts, src/shared/id-types.ts - path traversal/input validation and completion-guard ordering are the main risks, plus session ID format parsing.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/tools/task/task-update.ts">

<violation number="1" location="src/tools/task/task-update.ts:107">
P1: Completion can be bypassed when `status="completed"` is combined with `addBlockedBy` in the same update, because the guard checks blockers before the new ones are merged.</violation>

<violation number="2" location="src/tools/task/task-update.ts:111">
P1: Validate `blockedBy` IDs before building file paths; the new guard currently uses untrusted strings in `join(...)`, enabling path traversal reads outside the task directory.</violation>
</file>

<file name="src/shared/id-types.ts">

<violation number="1" location="src/shared/id-types.ts:6">
P2: Recognize the hyphenated session IDs used elsewhere in the repo; `ses-main` and similar values currently fall through to the generic not-found message.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread src/tools/task/task-update.ts Outdated
Comment thread src/tools/task/task-update.ts
Comment thread src/shared/id-types.ts Outdated
export function detectIdType(id: string): IdType {
if (id.startsWith("bg_")) return "background"
if (id.startsWith("T-")) return "task"
if (id.startsWith("ses_")) return "session"

@cubic-dev-ai cubic-dev-ai Bot Apr 14, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Recognize the hyphenated session IDs used elsewhere in the repo; ses-main and similar values currently fall through to the generic not-found message.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/shared/id-types.ts, line 6:

<comment>Recognize the hyphenated session IDs used elsewhere in the repo; `ses-main` and similar values currently fall through to the generic not-found message.</comment>

<file context>
@@ -0,0 +1,22 @@
+export function detectIdType(id: string): IdType {
+  if (id.startsWith("bg_")) return "background"
+  if (id.startsWith("T-")) return "task"
+  if (id.startsWith("ses_")) return "session"
+  return "unknown"
+}
</file context>
Fix with Cubic

@garnetlyx garnetlyx force-pushed the feat/task-id-semantics-and-lifecycle branch 2 times, most recently from 9cbc920 to 71a3f97 Compare April 14, 2026 02:21
@garnetlyx garnetlyx force-pushed the feat/task-id-semantics-and-lifecycle branch from 71a3f97 to dddfc6c Compare April 14, 2026 02:22
@garnetlyx

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Apr 14, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 19, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 19, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 19, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 19, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 19, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 20, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 20, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 20, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 20, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 21, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 22, 2026
github-actions Bot added a commit to Vacbo/oh-my-opencode that referenced this pull request Apr 22, 2026
@code-yeongyu

Copy link
Copy Markdown
Owner

[sisyphus-bot]

PR sweep first-pass triage on dev.

  • Author: garnetlyx
  • Title: feat: Task ID semantics and lifecycle integrity (#3404, #3405)
  • Closing issues: none detected
  • Review decision: none yet
  • Mergeable state: CONFLICTING (rebase needed)
  • CI status: green / no failing checks

Needs rebase + review. Please rebase onto current dev first; then a review can land cleanly.

Assigning code-yeongyu so the maintainer can prioritize a focused review of this PR. If the linked issue above has been triaged, the verdict there is the authoritative direction for this change.

@code-yeongyu code-yeongyu self-assigned this May 16, 2026
@code-yeongyu

Copy link
Copy Markdown
Owner

[sisyphus-bot] Hi garnetlyx. 🙏 Thanks for the Task ID semantics and lifecycle integrity work for #3404 / #3408.

Picking this back up from the 5/16 triage. The PR is medium-large (644/18 across 14 files) and shows CONFLICTING against current dev. The task-lifecycle layer has been touched substantially (see in-flight #2293 by guazi04 which targets a related concern around BackgroundManager terminal-state lifecycle).

Could you rebase against current dev, and clarify in the description how this PR composes with #2293 if both are still active? The two PRs both touch task-lifecycle invariants from different angles. Once it's clear and the rebase is clean, I'll loop a maintainer in for the focused review. The 14-file scope is large enough that a maintainer eye is the right tie-breaker.

@code-yeongyu code-yeongyu force-pushed the dev branch 2 times, most recently from eb25d29 to 2bfad49 Compare May 23, 2026 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants