Repository navigation
Archive projects and folders instead of deleting them (+1 more) - #71
Conversation
Published from the private repository by oss-sync. - Composer: $ghost, $<name> folders, $opus models, $pin and $snooze - Archive projects and folders instead of deleting them 51 files changed, 1129 insertions(+), 202 deletions(-)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 017dd04306
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (id !== activeId) { | ||
| setDraftPick(null) | ||
| setStartOpts(null) |
There was a problem hiding this comment.
Restore start options when the first send is refused
When a new chat using $pin or $snooze receives a pre-run refusal (for example, a 4xx from /api/chat), takeForSend() restores the draft text through onRefused, but this immediately clears the associated start options. The retry therefore silently loses its pin/snooze semantics, and the optimistic “Sent … Back …” toast may already have told the user otherwise. Preserve these options until the run starts successfully, or restore them alongside the refused draft.
Useful? React with 👍 / 👎.
| } catch (e: any) { | ||
| pushError(`Couldn't make “${d.name}”: ${e?.message || e}`) | ||
| return |
There was a problem hiding this comment.
Put the destination token back after creation fails
If creating a $tax-returns folder/project fails because the bridge rejects the request or is unreachable, pickDestination has already saved the draft with the $… token removed, and this catch only reports the error. The user is left with a modified draft and cannot retry the same creation without retyping the destination; restore the pre-selection text on this failure path.
Useful? React with 👍 / 👎.
| // Put away whole (chat/projects.mjs): its files, memory and chats stay as they are. | ||
| if ((sub === '/archive' || sub === '/restore') && req.method === 'POST') { | ||
| try { | ||
| const project = sub === '/archive' ? await projectStore.archive(id) : await projectStore.restore(id) |
There was a problem hiding this comment.
Reject archived folders when filing new tasks
When a project is archived, its project.json deliberately remains on disk, but the todo services at bridge.mjs:17227 and mcp-gateway.mjs:558 still use mere file existence for folderExists. A stale client or direct API/MCP caller can therefore create or move a task into the archived ID; it is then shown as Personal while retaining a folder that suddenly reappears on restore. Make these validators use the archive-aware active check.
AGENTS.md reference: AGENTS.md:L95-L95
Useful? React with 👍 / 👎.
| if (body.needsReply === false) dismissChatPush(id) | ||
| // A chat moved into a project brings its files with it. | ||
| if (thread.projectId && !thread.projectContextOff && before && before.projectId !== thread.projectId && await projectStore.get(thread.projectId)) { | ||
| if (thread.projectId && !thread.projectContextOff && before && before.projectId !== thread.projectId && await projectStore.active(thread.projectId)) { |
There was a problem hiding this comment.
Validate the project before moving a chat
When a stale client moves a chat to a project archived on another device, writeThread has already persisted body.projectId before this active() check. The condition only skips copying attachments, so the request succeeds while the chat disappears from the lists with an archived project ID and its files were never brought over. Validate the destination before writeThread, or reject and roll back the move.
AGENTS.md reference: AGENTS.md:L95-L95
Useful? React with 👍 / 👎.
| const inUse = (hidden) => (t) => !t.projectId || !hidden.has(t.projectId) | ||
| const listThreads = async () => { | ||
| const hidden = await archivedProjectIds() | ||
| return (await taskDone.decorate((await threadStore.list()).filter(inUse(hidden)))).map(signThread) |
There was a problem hiding this comment.
Hide archived chats from the agent thread list
This filtering only covers the dashboard thread endpoints; totem_threads_list at bridge.mjs:13547 still passes active projects together with every row from threadStore.list() to listOtherThreads. With no project filter, chats from an archived project are therefore returned to agents and represented as Home with a null project ID, exposing content the owner put away. Apply the same archived-ID filter to the agent listing.
AGENTS.md reference: AGENTS.md:L95-L95
Useful? React with 👍 / 👎.
| if ((sub === '/archive' || sub === '/restore') && req.method === 'POST') { | ||
| try { | ||
| const project = sub === '/archive' ? await projectStore.archive(id) : await projectStore.restore(id) |
There was a problem hiding this comment.
Keep DELETE as an archive alias for loaded clients
After the bridge deploys, an already-open web bundle and older installed native builds still call DELETE /api/chat/projects/:id, but this handler now only accepts POST .../archive, so those clients fall through to a 405 and their project removal action stops working until they update. Preserve the old DELETE route as an archive-compatible alias, including the response shape old clients expect.
AGENTS.md reference: AGENTS.md:L431-L431
Useful? React with 👍 / 👎.
Published from the private repository by oss-sync.
51 files changed, 1129 insertions(+), 202 deletions(-)