agency: deep-link glued to card + label adapts to spawn-topic mode#106
Merged
MagMueller merged 1 commit intomainfrom May 8, 2026
Merged
agency: deep-link glued to card + label adapts to spawn-topic mode#106MagMueller merged 1 commit intomainfrom
MagMueller merged 1 commit intomainfrom
Conversation
Two improvements to the spawn-topic flow that survive across many
stacked cards.
1. Default-button labels reflect --spawn-topic
────────────────────────────────────────────────────
Was: "✅ Yes" / "⏭ Skip" / "✏️ Edit" regardless of routing.
Now: "🧵 Yes (new thread)" / "⏭ Skip" / "🧵 Edit (new thread)" when
--spawn-topic is set; the original labels otherwise.
The user can tell from the button alone whether tapping will fork
a topic or run in-place. agency-report picks the variant via
args.spawn_topic at post time.
2. Deep-link to the spawned topic glues to the card
────────────────────────────────────────────────────
Was: after spawn, the bot posted a separate "→ working in X" reply
under the card with a URL-button. That reply got buried as more
cards landed in the topic.
Now: the URL-button row ("🧵 Open thread") is appended to the
card's own inline_keyboard. It scrolls with the card; you can jump
to the worker topic from the card itself even weeks later.
_agency_mark_picked grows append_url_row. It also strips any prior
trailing URL-only rows before re-applying so the deep-link doesn't
accumulate across re-taps.
Multi-tap dedupes the worker thread: tapping Yes twice no longer
creates two topics. The first tap sets worker_topic_id in the DB;
subsequent action/refine taps reuse it and re-dispatch into the
same thread.
The worker-topic resolution moved BEFORE the keyboard mark so we know
new_thread_id when computing the URL-row to glue. The dispatch-then-
deep-link-reply ordering of the previous shape is replaced with
resolve-thread-then-mark-then-dispatch.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MagMueller
added a commit
that referenced
this pull request
May 8, 2026
Magnus's rule: if I'm already deep in one topic (sub-agent posting a
follow-up card inside a worker thread) Yes/Edit should run in-place;
if I'm in a multi-suggestion context (the main agency feed, a fresh
chat, the /agency loop) Yes/Edit should fork a new topic per card.
Encoded as code, not just docs, so the LLM agent doesn't have to
remember:
agency_db.is_worker_topic(thread_id) — True iff the thread was
spawned as worker_topic for some other suggestion. Excludes
in-place bookkeeping (cards whose own tg_thread_id == the
worker_topic_id).
agency-report:
--spawn-topic → force spawn (existing flag, now explicit override)
--no-spawn-topic → force in-place (new flag)
neither → auto-detect via is_worker_topic
The mutually-exclusive group + store_const trick keeps the auto path
distinguishable (args.spawn_topic is None) from explicit on/off.
Default-button labels and the deep-link glue (#106) keep working —
they read args.spawn_topic which is now the resolved value.
Skill + docstring updated to document the auto-default and when to
override.
Co-authored-by: bux <bux@browser-use.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Two UX wins on the spawn-topic flow.
1. Default-button labels reflect routing
Before: `✅ Yes` / `⏭ Skip` / `✏️ Edit` regardless of whether `--spawn-topic` was set. From the button alone you couldn't tell if tapping would run in-place or fork a topic.
After:
`agency-report` picks the variant at post time from `args.spawn_topic`.
2. Deep-link to the spawned topic is glued to the card
Before: when Yes/Edit spawned a fresh forum topic, the bot posted a separate "→ working in X" reply under the card with a `🧵 Open thread` URL-button. That reply got buried as more cards landed in the topic — by the time you scrolled back to the card, the link was several screens away.
After: the URL-button row gets appended to the card's own `inline_keyboard`. It scrolls with the card. You can jump to the worker topic from the card itself, even weeks later.
`_agency_mark_picked` grows an `append_url_row` parameter. It also strips any prior trailing URL-only rows before re-applying so the deep-link doesn't accumulate across re-taps. Re-applied on every tap so the link survives mid-mind-changes.
3. Multi-tap dedupes the worker thread
Tapping Yes twice no longer creates two topics. The first tap sets `worker_topic_id` in agency.db; subsequent action/refine taps reuse it and re-dispatch into the same thread. The URL-row on the card always points at that one worker topic.
Refactor
The worker-topic resolution moved before the keyboard mark in `_handle_agency_callback` so we know `new_thread_id` when computing the URL row to glue. The previous "mark first → spawn → reply with URL" ordering is replaced with "resolve-thread → mark with URL row → dispatch".
The standalone URL-reply block at the bottom of the action/refine handler is dropped — superseded by the on-card row.
Test plan
Summary by cubic
Makes the spawn-topic flow clearer and easier to navigate. Buttons now show if they fork a thread, and the deep-link to that thread stays attached to the card. Also prevents duplicate threads on multi-tap.
New Features
--spawn-topicat post time:✅ Yes/⏭ Skip/✏️ Edit🧵 Yes (new thread)/⏭ Skip/🧵 Edit (new thread)inline_keyboardso the link scrolls with the card.worker_topic_id; no duplicate topics.Refactors
_agency_mark_pickednow acceptsappend_url_rowand cleans trailing URL-only rows to avoid duplicates.Written for commit 7998a64. Summary will update on new commits.