Tests unit tests for agent sdk lifecycle (pr #174) #425
Open
clintjeff2 wants to merge 2 commits into
Open
Conversation
…ifecycle Add Agent SDK lifecycle tests and align runtime states
|
Contributor
Author
|
@leocagli, review and merge. |
Contributor
Author
|
@leocagli, please review and merge. |
1 similar comment
Contributor
Author
|
@leocagli, please review and merge. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Motivation
Description
lib/agent-runtime/__tests__/agent.test.tscoveringstart(),stop(),restart(),executeTask()behavior, heartbeat timing using fake timers, and the/api/agents/[id]/task404 case.Agent.start()to set status torunningandAgent.stop()to set status tostopped, and make tasks return the agent torunningafter completion.executeTask()throw when invoked on astopped(oroffline) agent.AgentStatusunion to includerunningandstopped, and update the valid-status lists inlib/agents/agent-health-store.tsandlib/agent-registry.ts.app/api/agents/[id]/task/route.tsto return404 { ok: false, error: "agent_not_found" }for unknown non-registry agent IDs while preserving runtime creation for generatedbot-<n>ids.Testing
npm test -- lib/agent-runtime/__tests__/agent.test.tsand it passed (7 tests).npm test -- lib/agent-runtime/__tests__/agent.test.ts __tests__/api/agents/task-rate-limit.test.tsand both test files passed (8 tests total).tsc --noEmitsurfaced unrelated repo issues (missing optional dev dependencies likelru-cacheand@wagmi/connectors) and existing lint failures, which are outside the scope of this change.Closes #176