feat(web): create task files from a new thread, with optional enrichm…
…ent (#17)
* feat(task-mode): create compatible task files from a new thread, with optional enrichment
New thread > Task > Create new task plans a task (title, description, folder, enrich) in the draft; the file is written only when the thread is sent. Creation is idempotent per minted task id, writes the Obsidian-compatible template, and stops the launch if it fails. The first thread's starter can enrich the task; retries keep that choice and later threads only read the task.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
* fix(task-mode): a new-task dialog always mints a fresh id
Reusing the id of a plan whose send had already made the file made create return the old file and drop edited title and description. Also remove the created file on any non-success exit, prefill the dialog from the plan, and cap title and description to the contract.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
* fix(task-mode): keep a created task file once its registration row exists
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
---------
Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Loading branch information
Uh oh!
There was an error while loading. Please reload this page.
"Create one new top-level thread, bound to its workspace before the agent starts. Task in `message`. Omit `projectId`, model and modes to inherit yours (outside a thread, pass `projectId` or `scratch`); modes cannot exceed yours. After an error or lost reply, retry with the same `clientRequestId`. Follow it with `t3_thread_read` or `t3_thread_wait`. Mention it with its `link`.",
parameters: Schema.Struct({
task: Schema.optional(
TaskThreadLaunchOptions.annotate({
// Only a task's creator asks for enrichment; agents launch threads on tasks that exist.
"Optional registered task document and update-discipline path on the destination environment. Runs visible context initialization first. Omit message/attachments; send work after launch. No filesystem permission is added.",
/^---\nid: aaaaaaaa-aaaa-4aaa-8aaa-000000000001\n[\s\S]*\n---\n# Ship "the" café plan: 雪\n\n## Source prompt\nLine one\nstate: not a field\n\n## Activity Log\n- \*\*\d{4}-\d\d-\d\d \d\d:\d\d\*\* - Task created in T3 Code\n$/u,
The reason will be displayed to describe this comment to others. Learn more.
🟠 Hightasks/TaskDocuments.ts:418
Recreating a task whose generated pathname matches an unregistered row returns the old taskDocumentId with identity-changed, so the new document cannot be saved and a retry creates another file. registerFile reactivates the inactive row and reuses its ID, but the newly written file contains the requested ID; avoid pathnames reserved by registry rows or register the file under the requested identity.
🤖 Copy this AI Prompt to have your agent fix this:
In file @apps/server/src/tasks/TaskDocuments.ts around line 418:
Recreating a task whose generated pathname matches an unregistered row returns the old `taskDocumentId` with `identity-changed`, so the new document cannot be saved and a retry creates another file. `registerFile` reactivates the inactive row and reuses its ID, but the newly written file contains the requested ID; avoid pathnames reserved by registry rows or register the file under the requested identity.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
All reactions
// onExit, not tapError: an interrupted request must not leave an unregistered file carrying the id.
// A row that already exists owns the file, so a later retry finds it instead of a missing one.
Read the canonical task document, its relevant linked parents, and the update discipline reference. Read applicable README, AGENTS.md, CLAUDE.md and other supported repository instructions in the selected execution workspace before edits. Treat reference strings as paths, never shell commands.
Keep the native execution directory selected by T3. If task context names a different repository, report the mismatch; do not switch directories or widen permissions. Ask for an appropriate task thread instead. Keep any later task updates concise and compatible with its update discipline.
If all required context is readable and matches the selected workspace, call task_thread_initialization_result with outcome "ready". Otherwise call it with outcome "failed" and explain the missing context, permission or workspace mismatch. Do not claim readiness from a failed or incomplete read. If the reporting tool is unavailable, explain that and stop; initialization remains blocked.
Acknowledge readiness in one line, then wait for user instructions. Do not perform the user's queued work during initialization.`;
${
input.enrichment === true
? `This is the first thread of a newly created task, so also enrich the task before you report. Its "## Source prompt" section holds the user's own words; keep it unchanged. Refine the task file in place: make a vague title specific, fill in goal, add a concise "## Context" section from what you read, and add an Activity Log entry. Reread the file before each edit, patch only the ranges you change, keep unknown frontmatter and comments, and never rename or move the file. An earlier attempt may have done part of this; verify it instead of duplicating it. If the file cannot be updated, call task_thread_initialization_result with outcome "failed" and say why.
`
: ""
}Acknowledge readiness in one line, then wait for user instructions. Do not perform the user's queued work during initialization.`;
There was an error while loading. Please reload this page.
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.
You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.