Add automatic Thread naming source flow#263
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces automatic naming for non-main chat Threads by recording name provenance in chat_channel_names, inserting an initial name from the first user message, then attempting a single generated title after a successful assistant reply. It also increases the default agent-loop tool-call budget and adds an evidence harness to validate the end-to-end flow.
Changes:
- Add
source+generated_name_attempted_attochat_channel_names, plus service helpers to insert/claim/complete auto thread names. - Implement the auto-naming flow in
/api/chat/respond(insert exact name early; generate/complete one title after successful completion). - Raise default agent-loop
maxToolCallsfrom 10 to 50 and add an evidence case harness to validate behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/evidence/thread_auto_name_source/thread_auto_name_flow.mjs | New evidence flow script that drives /api/chat/respond and validates naming via DB checkpoints. |
| tools/evidence/thread_auto_name_source/run.sh | Harness runner that loads .env.local, optionally migrates/starts backend, and executes the evidence flow. |
| tools/evidence/thread_auto_name_source/AGENTS.md | Evidence-case documentation describing requirements, checkpoints, and how to run the harness. |
| docs/plans/2026-05-21-19-57-CST-thread-auto-name-source.md | Plan doc for thread auto-name source tracking and rollout steps. |
| docs/plans/2026-05-21-16-43-CST-agent-loop-limit-empty-final.md | Updates plan to reflect increased default tool-call budget. |
| docs/code_maps/logic_map.yaml | Adds migration reference and documents new auto-thread naming constraints + new tool-call budget. |
| docs/code_maps/feature_map.yaml | Documents the new thread auto-naming behavior and updated agent-loop budget. |
| apps/node_backend/src/services/chatChannelNameService.ts | Adds source/attempt fields and new helpers for the exact/claim/complete auto-naming workflow. |
| apps/node_backend/src/routes/chat.ts | Implements auto thread naming during async respond flow; increases default tool-call budget and request max. |
| apps/node_backend/src/routes/chat.test.ts | Updates tests for new tool-call default and adds coverage for the thread auto-naming flow. |
| apps/node_backend/src/db/migrations/020_chat_channel_name_source.sql | Adds source and generated_name_attempted_at columns to chat_channel_names. |
Comments suppressed due to low confidence (1)
tools/evidence/thread_auto_name_source/AGENTS.md:99
- AGENTS.md says the generatedNameVisible checkpoint verifies that “/api/chat/channel-names shows first_message_generated”, but the harness actually polls the database (chat_channel_names) directly and does not call /api/chat/channel-names. Update the checkpoint description to match what the script does so readers know where to look when debugging failures.
## Checkpoints
- `authMe`: test token resolves to the expected fixture user.
- `backendReady`: local backend responds on `/api/health`.
- `baselineNoName`: the generated fixture Thread has no name row before the flow.
- `firstRespondAccepted`: `/api/chat/respond` accepts the first message.
- `generatedNameVisible`: `/api/chat/channel-names` shows `first_message_generated`.
- `secondRespondAccepted`: a second message is accepted in the same Thread.
- `generationRunsOnce`: source/name/attempt timestamp do not change after the second message.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+48
to
+60
| required_vars=( | ||
| BRICKS_TEST_TOKEN | ||
| FIXTURE_USER_ID | ||
| JWT_SECRET | ||
| BRICKS_API_BASE_URL | ||
| ) | ||
|
|
||
| for name in "${required_vars[@]}"; do | ||
| if [[ -z "${!name:-}" ]]; then | ||
| echo "Missing required env var: $name" >&2 | ||
| exit 1 | ||
| fi | ||
| done |
Comment on lines
+18
to
+24
| Before a respond request, the case-specific `channelId + threadId` must have no | ||
| name row in `/api/chat/channel-names`. | ||
|
|
||
| ## Fixed Behavior To Prove | ||
|
|
||
| After the first respond request completes, using API for the user action and DB | ||
| checks for low-request evidence: |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.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.
Summary
Validation
Evidence