Repository navigation
feat(agents2): show agents working: ππ¬ reactions, local typing, Codex settles #860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+482
β13
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| // STOPGAP(agent-local-typing): delete with local-typing.ts. | ||
| import { afterEach, expect, it, vi } from "vitest"; | ||
| import type { RelayEvent } from "../relay/events"; | ||
| import type { RelaySession } from "../relay/session"; | ||
| import { typeLocally } from "./local-typing"; | ||
|
|
||
| const agent = "a".repeat(64); | ||
| const root = "b".repeat(64); | ||
| const mention = { | ||
| id: "c".repeat(64), | ||
| pubkey: "d".repeat(64), | ||
| kind: 9, | ||
| created_at: 1, | ||
| content: "@Agent hi", | ||
| tags: [ | ||
| ["h", "channel"], | ||
| ["e", root, "", "reply"], | ||
| ], | ||
| } as unknown as RelayEvent; | ||
|
|
||
| afterEach(() => vi.useRealTimers()); | ||
|
|
||
| it("pulses in the mention's thread every three seconds until stopped", () => { | ||
| vi.useFakeTimers(); | ||
| vi.setSystemTime(10_000); | ||
| const local = vi.fn(); | ||
| const stop = typeLocally( | ||
| () => ({ typing: { local } }) as unknown as RelaySession, | ||
| agent, | ||
| mention, | ||
| "channel", | ||
| ); | ||
| expect(local).toHaveBeenCalledExactlyOnceWith({ | ||
| id: "", | ||
| pubkey: agent, | ||
| kind: 20002, | ||
| created_at: 10, | ||
| content: "", | ||
| tags: [ | ||
| ["h", "channel"], | ||
| ["e", root, "", "root"], | ||
| ["e", mention.id, "", "reply"], | ||
| ], | ||
| }); | ||
| vi.advanceTimersByTime(3_000); | ||
| expect(local).toHaveBeenCalledTimes(2); | ||
| expect(local.mock.lastCall?.[0].created_at).toBe(13); | ||
| stop(); | ||
| // Stopping ends it at once, then nothing more is sent. | ||
| expect(local).toHaveBeenCalledTimes(3); | ||
| expect(local.mock.lastCall?.[0]).toMatchObject({ | ||
| kind: 9, | ||
| tags: local.mock.calls[0]?.[0].tags, | ||
| }); | ||
| vi.advanceTimersByTime(9_000); | ||
| expect(local).toHaveBeenCalledTimes(3); | ||
| }); | ||
|
|
||
| it("skips pulses while the community is not ready, and stops if one throws", () => { | ||
| vi.useFakeTimers(); | ||
| const warn = vi.spyOn(console, "warn").mockImplementation(() => {}); | ||
| let session: RelaySession | undefined; | ||
| const local = vi.fn(() => { | ||
| throw new Error("closed"); | ||
| }); | ||
| typeLocally(() => session, agent, mention, "channel"); | ||
| session = { typing: { local } } as unknown as RelaySession; | ||
| vi.advanceTimersByTime(3_000); | ||
| expect(local).toHaveBeenCalledOnce(); | ||
| vi.advanceTimersByTime(9_000); | ||
| expect(local).toHaveBeenCalledOnce(); | ||
| expect(warn).toHaveBeenCalledOnce(); | ||
| warn.mockRestore(); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] Release a rejected follow-upβs working hold
When
turn/steer(or the preceding history read) fails, the catch above posts βSteering was not acceptedβ but resolvesacceptedwithout adding this request toactive.requests. Itsrepliedpromise can therefore never resolve, while this fallback waits for the previous turnβstail. A rejected mention keeps its ππ¬ reactions until that unrelated work ends; with channel-scoped sessions, a follow-up in another thread also keeps that thread falsely typing after the rejection. Settle this requestβs hold on the handled rejection, retaining the turn-tail fallback only for accepted steering or a replacement turn. Add coverage with the original turn held open while steering fails, asserting the rejected hold settles without ending the original work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π€ Reply from Matt Toohey's AI agent: fixed in #919 β the steering catch path now calls
request.answered()right after posting "Steering was not accepted", so the rejected mention's hold settles at the rejection while thesteered.tailfallback stays limited to accepted steering or a replacement turn. The PR includes a regression test with the original turn held open whileturn/steerfails, plus a before/after video of the hold release.