An open-source, faster Devin alternative
TypeScript
computer: a web message's Slack echo names the owner, not their member id (#1065)
opencomputer-app[bot]9193e8cad119
diff --git a/computer/src/runner/api/api.test.ts b/computer/src/runner/api/api.test.tsindex 81c7d057..bb299d64 100644--- a/computer/src/runner/api/api.test.ts+++ b/computer/src/runner/api/api.test.ts@@ -106,6 +106,17 @@ describe('SessionApi', () => {expect(plain).toMatchObject({ text: expect.stringContaining('from the web:\n> ship <it>') });});+ it('a message over the wire carries only the member id: quoted under the owner\'s name, or "Someone", never the id', async () => {+ const w = await world();+ const posts = () =>+ w.rec.filter((r) => (r as { slack?: string }).slack === 'chat.postMessage').map((r) => (r as { args: { text: string } }).args.text);+ const wire = (id: string) => ({ actor: { id, name: null, via: 'dashboard' as const, client: null }, member: id });+ result(await w.call('turns.send', { input: 'one' }, wire(OWNER.userId)));+ await w.t.feed(w.T.first(), w.T.done());+ result(await w.call('turns.send', { input: 'two' }, wire('usr_bob')));+ expect(posts()).toEqual(['*Ann* from the web:\n> one', '*Someone* from the web:\n> two']);+ });+it('one idempotency key gives one turn', async () => {const w = await world();const ctx = { ...ANN_CTX, idempotencyKey: 'k-1' };diff --git a/computer/src/runner/api/api.ts b/computer/src/runner/api/api.tsindex c37e71f5..15a0f452 100644--- a/computer/src/runner/api/api.ts+++ b/computer/src/runner/api/api.ts@@ -241,7 +241,9 @@ export class SessionApi implements Writer {if (actor.via === 'slack' || !this.session.thread.slack) return;const { owner } = this.o;if (owner.slackUserId && actor.id === owner.userId && (await this.session.thread.sayAs(owner.slackUserId, echoPlain(text)))) return;- await this.session.thread.say(echoText(text, actor));+ // A message over the wire carries only the member id: the owner's own name is known here; anyone else's is not.+ const name = actor.id === owner.userId ? personName(owner) : actor.name === actor.id ? 'Someone' : actor.name;+ await this.session.thread.say(echoText(text, { ...actor, name }));}private async start(w: Waiting, from: Omit<SentFrom, 'actor' | 'turnId'>): Promise<CallOutcome> {