You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 76856c3
Browse filesBrowse the repository at this point in the historyBrowse files
Name a down capability in the system prompt, and keep its URL clean
A Bot could promise work for one of its own attached MCP servers or skills
before learning that it cannot be reached. The host already knew: the
capability status carries `error` or `needs-approval`. A second prompt
section (order 700) now names each of those in one line, built from
capabilityStatusesView(), and renders to nothing while every capability is
ready, so the identity section and its cached prefix stay byte-stable.
From the security read at 6b401eb: a URL such as
https://alice:s3cr3t-pa55@host/mcp was accepted, the transport error quoted
it verbatim, and that sentence is now printed every turn. The save refuses
userinfo, and a stored error of a capability saved before the refusal has
its userinfo masked before the 300-character cut.
A Bot now learns from its system prompt that one of its own capabilities cannot be used right now, naming the capability and the reason, so it says "GitHub isn't connected (401 bad credentials)" before acting instead of agreeing to the work and failing half a turn later ([#3273](https://github.com/ThinkFlowLab/FlyBot/issues/3273)). Saving a capability URL that carries a username or password is refused, and an older error that quotes such a URL is stored with the userinfo masked, so a credential can never be printed into the Bot's system prompt ([#3273](https://github.com/ThinkFlowLab/FlyBot/issues/3273)).
Copy file name to clipboardExpand all lines: core/client.js
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1912,6 +1912,9 @@ var HOST_ZH = {
1912
1912
'Use a capability name with lowercase letters, digits, and single hyphens; "github" and "composio" are reserved.': "能力名只能用小写字母、数字和单个连字符;「github」和「composio」是保留名。",
1913
1913
"Enter a command for the MCP server.": "请填写 MCP 服务器的命令。",
1914
1914
"Enter a valid HTTP or HTTPS URL.": "请填写有效的 HTTP 或 HTTPS 地址。",
1915
+
// #3273: a URL carrying userinfo is refused instead of stored, so the credential never reaches
1916
+
// a status line and never reaches the system prompt.
1917
+
"Enter the URL without a username or password. Save the credential as a secret and reference it in a header.": "地址里不要写用户名或密码。请把凭据保存为密钥,并在请求头里引用它。",
1915
1918
"A capability cannot change its kind. Delete it and save a new one.": "能力类型不能改。请删掉它,再新建一个。",
1916
1919
"Environment variables must contain text values.": "环境变量里只能填文本值。",
1917
1920
"Headers must contain text values.": "请求头里只能填文本值。"
Copy file name to clipboardExpand all lines: core/src/client/i18n.js
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1872,6 +1872,9 @@ const HOST_ZH = {
1872
1872
'Use a capability name with lowercase letters, digits, and single hyphens; "github" and "composio" are reserved.': '能力名只能用小写字母、数字和单个连字符;「github」和「composio」是保留名。',
1873
1873
'Enter a command for the MCP server.': '请填写 MCP 服务器的命令。',
1874
1874
'Enter a valid HTTP or HTTPS URL.': '请填写有效的 HTTP 或 HTTPS 地址。',
1875
+
// #3273: a URL carrying userinfo is refused instead of stored, so the credential never reaches
1876
+
// a status line and never reaches the system prompt.
1877
+
'Enter the URL without a username or password. Save the credential as a secret and reference it in a header.': '地址里不要写用户名或密码。请把凭据保存为密钥,并在请求头里引用它。',
1875
1878
'A capability cannot change its kind. Delete it and save a new one.': '能力类型不能改。请删掉它,再新建一个。',
1876
1879
'Environment variables must contain text values.': '环境变量里只能填文本值。',
1877
1880
'Headers must contain text values.': '请求头里只能填文本值。',
}catch{thrownewError('Enter a valid HTTP or HTTPS URL.')}
120
+
letparsed
121
+
try{parsed=newURL(url)}catch{thrownewError('Enter a valid HTTP or HTTPS URL.')}
122
+
if(parsed.protocol!=='https:'&&parsed.protocol!=='http:')thrownewError('Enter a valid HTTP or HTTPS URL.')
123
+
if(parsed.username!==''||parsed.password!=='')thrownewError('Enter the URL without a username or password. Save the credential as a secret and reference it in a header.')
assert.equal(status.error,'Request cannot be constructed from a URL that includes credentials: https://host/mcp','the exact stored sentence: the scheme and host stay, the userinfo is gone')
statuses: {worker: {github: {state: 'error',error: '401 bad credentials'}}},
100
+
library: [{name: 'github',kind: 'mcp'}],
101
+
})
102
+
t.after(()=>ctx.dispose())
103
+
consttext=render('worker')
104
+
assert.equal(capabilities('worker').split('\n')[0],'# Capabilities that need attention','the section carries its own title, so the list is not read as a continuation of the identity block')
105
+
assert.equal(capabilities('worker').split('# Capabilities that need attention').length-1,1,'one title, once')
106
+
assert.ok(
107
+
text.split('\n').includes('- github (mcp): 401 bad credentials — tell the user before acting.'),
108
+
`the failed capability and its reason are on one line:\n${text}`,
109
+
)
110
+
assert.equal(text.slice(0,prompt('worker').length),prompt('worker'),'the identity section is untouched')
'- github (mcp): 401 bad credentials — tell the user before acting.',
142
+
'- slack (pack): needs user approval — tell the user before acting.',
143
+
])
144
+
})
145
+
146
+
// Test found by mutation that a healthy render compared only against another render of the same
147
+
// code proves nothing: a trailing space added to the identity text passes both sides. The claim is
148
+
// that the healthy prompt *is* the identity text, so its exact head and its exact last line are
149
+
// pinned here as literals, and the capability section has to contribute the empty string.
150
+
constIDENTITY_LAST_RULE='- When you cannot continue without an answer, pass ask with the one question on that task. On a group card, worked in your own chat, call ask_user for the user, and post one short question in the group only when a person there has to decide. On your own chat\'s other tasks, ask_user. When the answer arrives, pass answer with what they said and update the task. Do not leave the task waiting without that question.'
151
+
constIDENTITY_HEADS={
152
+
main: "# Your identity\nYou are Chief, a Bot on the user's team in FlyBot.",
153
+
worker: "# Your identity\nYou are Dev, a Bot on the user's team in FlyBot.",
154
+
}
155
+
156
+
test('#3273: a healthy Bot renders exactly the prompt it renders today',(t)=>{
assert.equal(healthy.capabilities(id),'','nothing unhealthy renders no section text at all')
166
+
consttext=healthy.render(id)
167
+
assert.ok(text.startsWith(IDENTITY_HEADS[id]),`${id}: the rendered prompt starts on the identity title and the Bot's own line, byte for byte`)
168
+
assert.ok(text.endsWith(IDENTITY_LAST_RULE),`${id}: the rendered prompt ends on the last identity rule — no separator, no blank line, no trailing space`)
169
+
assert.equal(text.trimEnd(),text,`${id}: no trailing whitespace`)
170
+
assert.equal(healthy.render(id),none.render(id),'byte for byte the prompt a Bot with no capabilities gets')
171
+
assert.equal(none.render(id),none.prompt(id),'the rendered prompt is the identity section alone — no extra section, no blank line')
172
+
}
173
+
// A relay session is not a Bot: it never carries capability state.
0 commit comments