GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(tool): allow human-readable slugs as task_id by rafaelchavesfreitas · Pull Request #32122 · anomalyco/opencode

Conversation

@rafaelchavesfreitas

@rafaelchavesfreitas rafaelchavesfreitas commented Jun 12, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #32118

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The Task tool's task_id parameter now accepts human-readable slugs (e.g. "explore-auth") in addition to opaque ses_ session IDs.

The problem: Task tool outputs IDs like ses_14209ee2affeovRO3QEIAheNCH. These are designed for DB sort order, not for LLM recall. When an LLM needs to resume a subagent, it must reproduce this string exactly across turns — which it routinely fails at, creating new sessions instead and losing all prior context.

How it works: When task_id doesn't start with ses_, it's treated as a slug. The tool derives a deterministic session ID by combining a 4-char hash of the root session ID with the slug: ses_a3f2_explore-auth. It then looks up that ID — if it exists, the session is resumed; if not, a new one is created with that ID. When task_id starts with ses_, the original lookup-by-ID behavior is unchanged.

The slug is scoped to the root session (the top-level session without a parent). A new Session.root() method walks the parentID chain to find it. This means subagents sharing the same root session can reference each other's named tasks — enabling cross-agent collaboration within a conversation. Subagents in different root sessions are isolated.

Changes:

  • session.ts: Added root() method (traverses parentID chain to root session), added optional id parameter to create() / CreateInput / Interface so a session can be created with a specific ID
  • task.ts: Added isSlug() and deriveSlugSessionID() helpers, modified the session lookup/creation flow to detect slugs, derive IDs, and pass them through on creation
  • task.txt: Updated the task tool description that LLMs read, documenting the slug support

How did you verify your code works?

  • bun typecheck passes in packages/opencode
  • Verified that existing ses_... task_id values follow the same code path (the slug branch only activates when task_id doesn't start with ses_)
  • The Session.root() loop uses the same while + let pattern as the existing findMessage method in the same file

Screenshots / recordings

N/A — no UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@rafaelchavesfreitas
feat(tool): allow human-readable slugs as task_id
3429999
The task tool now accepts human-readable slugs (e.g. "explore-auth")
as task_id, making it easy for LLMs to create and resume named task
sessions without carrying opaque ses_ IDs across turns.

If the slug hasn't been used in the current root session, a new session
is created with a derived ID (ses_<hash>_<slug>). If it already exists,
the session is resumed with full context.

Closes anomalyco#32118
This was referenced Jun 13, 2026
📊 AI CLI 工具社区动态日报 2026-06-13 zx0828/big_model_radar#115
Open
📊 AI CLI 工具社区动态日报 2026-06-13 hehongtao88/big_model_radar#21
Open
rafaelchavesfreitas added 2 commits June 14, 2026 08:53
@rafaelchavesfreitas
Merge remote-tracking branch 'opencode/dev' into feature/human-readab…
4aec115
…le-task_id
@rafaelchavesfreitas
Merge remote-tracking branch 'opencode/dev' into feature/human-readab…
ef8f53d
…le-task_id
@rafaelchavesfreitas
Merge remote-tracking branch 'opencode/dev' into feature/human-readab…
86387fa
…le-task_id
@rafaelchavesfreitas
Merge branch 'dev' into feature/human-readable-task_id
85a788f
@iceteaSA iceteaSA mentioned this pull request Jul 2, 2026
feat(opencode): add dispatch controls to the task tool #34947
Closed
3 tasks done
@rafaelchavesfreitas
Merge branch 'dev' into feature/human-readable-task_id
a115c8d
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Jul 13, 2026
@github-actions github-actions Bot added the automated-pr-cleanup label Jul 13, 2026
randomvariable added a commit to randomvariable/opencode that referenced this pull request Aug 3, 2026
@randomvariable @claude
feat(tool): allow human-readable slugs as task_id
dada0f8
Accept a human-readable slug as the task tool's task_id: it is resolved to a
deterministic session ID derived from the root session, so passing the same
slug resumes the named task and a new slug creates one. Full "ses_..." IDs
still resume directly. Adds Session.create({ id }) and Session.root().

Ported from anomalyco#32122 (adapted for the Effect layer).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
randomvariable added a commit to randomvariable/opencode that referenced this pull request Aug 3, 2026
@randomvariable @claude
feat: mcp-search tool for lazy loading mcp
3a619cc
Add an experimental `mcp_lazy` config flag. When enabled, MCP tools are no
longer loaded into the model context automatically; instead a new mcp_search
tool (list/search/describe/call) discovers and invokes MCP tools on demand,
and the prompt loop advertises connected MCP servers in the system prompt.
mcp_search is only registered when the flag is set and MCP is available.

Ported from anomalyco#12520 (adapted for the Effect layer: the server advert is built
inline in the prompt loop rather than via a SystemPrompt service method, and
Config is provided at the SessionTools.resolve call site). The TUI "Lazy"
status badge from the original PR is omitted (its dialog moved packages and
the badge is cosmetic). SDK regeneration also includes the session-create
`id` field from anomalyco#32122.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
randomvariable added a commit to randomvariable/opencode that referenced this pull request Aug 3, 2026
@randomvariable @claude
feat(opencode): interrupt a running subagent — steer / cancel / abort
cd4f0a2
Add an experimental subagent-interrupt capability (behind
OPENCODE_EXPERIMENTAL_SUBAGENT_INTERRUPT): an Interrupt service with
pending/terminal state, task_steer/task_cancel/task_abort tools (gated by a
new `interrupt` permission), a POST /session/:id/interrupt endpoint, and a
turn-boundary consume in the prompt loop that injects an escaped steer/cancel
frame plus a visible transcript marker. Cancel records a terminal reason and
force-breaks after a grace window; abort writes a marker, records the
terminal, and cancels the BackgroundJob immediately. The TUI gains an
esc-with-reason flow, footer button, and distinct interrupt markers.

Ported from anomalyco#32425 (adapted for the Effect layer; merged with the prior
task.ts/registry.ts/prompt.ts changes from anomalyco#29447/anomalyco#32122/anomalyco#12520/anomalyco#32192/anomalyco#19961).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
randomvariable added a commit to randomvariable/opencode that referenced this pull request Aug 3, 2026
@randomvariable @claude
test(opencode): regenerate task parameter snapshot for slug task_id
a650c95
The task tool's task_id description changed in the slug-resume port (anomalyco#32122);
update the JSON Schema wire-shape snapshot to match.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

automated-pr-cleanup

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Allow human-readable slugs as task_id in the Task tool

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@rafaelchavesfreitas
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 01402775 — 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.