Commit 3714fc3
committed
fix(daemon): make
`od conversation info <conversationId>` always 404ed because:
1. `case 'info'` fetched the unscoped route
`/api/conversations/<id>`, but the daemon only serves
project-scoped routes (`/api/projects/:id/conversations/...`).
2. There was no GET handler for a single conversation — only
PATCH and DELETE — so even with the right scope the request
would have 404ed.
3. The 404 got mapped to `code: 'daemon-not-running'`, sending
users on a wild-goose chase checking daemon sockets when the
daemon was actually fine.
Fix:
- Add a project-scoped GET handler for
`/api/projects/:id/conversations/:cid` that returns the
conversation object.
- Make `case 'info'` use `--project <id> <conversationId>`
(consistent with `od conversation list <projectId>`) and
hit the project-scoped route through `positionalArgs` so a
flag value isn't mistaken for the conversation id.
- On a 404 use `fallbackCode: 'not-found'` instead of the
misleading `'daemon-not-running'`. The daemon answered —
that's literally what a 404 proves.
Regression test `conversation-info-cli.test.ts` pins all three
behaviors: success path hits the scoped route (verifies the
exact request URL seen by a stub HTTP server), 404 path emits
`not-found` and never `daemon-not-running`, and the
missing-`--project` path bails with the new usage line.
Closes #6116.
Co-authored-by: Nicholas-Xiong <2482929840@qq.com>
Signed-off-by: xxiaoxiong <2482929840@qq.com>od conversation info actually work and stop reporting 404 as daemon-not-running (#6116)1 parent 6b90486 commit 3714fc3
3 files changed
Lines changed: 149 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7146 | 7146 | | |
7147 | 7147 | | |
7148 | 7148 | | |
7149 | | - | |
7150 | | - | |
7151 | | - | |
| 7149 | + | |
| 7150 | + | |
| 7151 | + | |
| 7152 | + | |
| 7153 | + | |
| 7154 | + | |
7152 | 7155 | | |
7153 | 7156 | | |
7154 | | - | |
7155 | | - | |
| 7157 | + | |
| 7158 | + | |
| 7159 | + | |
| 7160 | + | |
7156 | 7161 | | |
7157 | 7162 | | |
7158 | 7163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
136 | 147 | | |
137 | 148 | | |
138 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
0 commit comments