fix(sessions): remove agent rules spawn path (#159)

This commit is contained in:
Harshit Singh Bhandari 2026-06-09 00:10:28 +05:30 committed by GitHub
parent 7698c24931
commit 5071364f91
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 25 additions and 43 deletions

View File

@ -17,7 +17,6 @@ type spawnOptions struct {
branch string branch string
prompt string prompt string
issue string issue string
rules string
claimPR string claimPR string
noTakeover bool noTakeover bool
} }
@ -25,12 +24,11 @@ type spawnOptions struct {
// spawnRequest mirrors the daemon's SpawnSessionRequest body for // spawnRequest mirrors the daemon's SpawnSessionRequest body for
// POST /api/v1/sessions. The CLI keeps its own copy so it need not import httpd. // POST /api/v1/sessions. The CLI keeps its own copy so it need not import httpd.
type spawnRequest struct { type spawnRequest struct {
ProjectID string `json:"projectId"` ProjectID string `json:"projectId"`
IssueID string `json:"issueId,omitempty"` IssueID string `json:"issueId,omitempty"`
Harness string `json:"harness,omitempty"` Harness string `json:"harness,omitempty"`
Branch string `json:"branch,omitempty"` Branch string `json:"branch,omitempty"`
Prompt string `json:"prompt,omitempty"` Prompt string `json:"prompt,omitempty"`
AgentRules string `json:"agentRules,omitempty"`
} }
type spawnResult struct { type spawnResult struct {
@ -68,12 +66,11 @@ func newSpawnCommand(ctx *commandContext) *cobra.Command {
} }
} }
req := spawnRequest{ req := spawnRequest{
ProjectID: opts.project, ProjectID: opts.project,
IssueID: opts.issue, IssueID: opts.issue,
Harness: opts.harness, Harness: opts.harness,
Branch: opts.branch, Branch: opts.branch,
Prompt: opts.prompt, Prompt: opts.prompt,
AgentRules: opts.rules,
} }
var res spawnResult var res spawnResult
if err := ctx.postJSON(cmd.Context(), "sessions", req, &res); err != nil { if err := ctx.postJSON(cmd.Context(), "sessions", req, &res); err != nil {
@ -127,7 +124,6 @@ func newSpawnCommand(ctx *commandContext) *cobra.Command {
f.StringVar(&opts.branch, "branch", "", "Branch for the session worktree (default: ao/<session-id>)") f.StringVar(&opts.branch, "branch", "", "Branch for the session worktree (default: ao/<session-id>)")
f.StringVar(&opts.prompt, "prompt", "", "Initial prompt for the agent") f.StringVar(&opts.prompt, "prompt", "", "Initial prompt for the agent")
f.StringVar(&opts.issue, "issue", "", "Issue id to associate with the session") f.StringVar(&opts.issue, "issue", "", "Issue id to associate with the session")
f.StringVar(&opts.rules, "rules", "", "Agent rules appended to the prompt")
f.StringVar(&opts.claimPR, "claim-pr", "", "Immediately claim an existing PR for the spawned session") f.StringVar(&opts.claimPR, "claim-pr", "", "Immediately claim an existing PR for the spawned session")
f.BoolVar(&opts.noTakeover, "no-takeover", false, "Refuse if another active session owns the claimed PR (requires --claim-pr)") f.BoolVar(&opts.noTakeover, "no-takeover", false, "Refuse if another active session owns the claimed PR (requires --claim-pr)")
return cmd return cmd

View File

@ -1437,8 +1437,6 @@ components:
type: object type: object
SpawnSessionRequest: SpawnSessionRequest:
properties: properties:
agentRules:
type: string
branch: branch:
type: string type: string
harness: harness:

View File

@ -118,13 +118,12 @@ type ListSessionsResponse struct {
// SpawnSessionRequest is the body of POST /api/v1/sessions. // SpawnSessionRequest is the body of POST /api/v1/sessions.
type SpawnSessionRequest struct { type SpawnSessionRequest struct {
ProjectID domain.ProjectID `json:"projectId"` ProjectID domain.ProjectID `json:"projectId"`
IssueID domain.IssueID `json:"issueId,omitempty"` IssueID domain.IssueID `json:"issueId,omitempty"`
Kind domain.SessionKind `json:"kind,omitempty" enum:"worker,orchestrator"` Kind domain.SessionKind `json:"kind,omitempty" enum:"worker,orchestrator"`
Harness domain.AgentHarness `json:"harness,omitempty" enum:"claude-code,codex,aider,opencode,grok,droid,amp,agy,crush,cursor,qwen,copilot,goose,auggie,continue,devin,cline,kimi,kiro,kilocode,vibe,pi,autohand"` Harness domain.AgentHarness `json:"harness,omitempty" enum:"claude-code,codex,aider,opencode,grok,droid,amp,agy,crush,cursor,qwen,copilot,goose,auggie,continue,devin,cline,kimi,kiro,kilocode,vibe,pi,autohand"`
Branch string `json:"branch,omitempty"` Branch string `json:"branch,omitempty"`
Prompt string `json:"prompt,omitempty" maxLength:"4096"` Prompt string `json:"prompt,omitempty" maxLength:"4096"`
AgentRules string `json:"agentRules,omitempty"`
} }
// SessionResponse is the { session } body shared by session create/get. // SessionResponse is the { session } body shared by session create/get.

View File

@ -112,7 +112,7 @@ func (c *SessionsController) spawn(w http.ResponseWriter, r *http.Request) {
if in.Kind == "" { if in.Kind == "" {
in.Kind = domain.KindWorker in.Kind = domain.KindWorker
} }
sess, err := c.Svc.Spawn(r.Context(), ports.SpawnConfig{ProjectID: in.ProjectID, IssueID: in.IssueID, Kind: in.Kind, Harness: in.Harness, Branch: in.Branch, Prompt: in.Prompt, AgentRules: in.AgentRules}) sess, err := c.Svc.Spawn(r.Context(), ports.SpawnConfig{ProjectID: in.ProjectID, IssueID: in.IssueID, Kind: in.Kind, Harness: in.Harness, Branch: in.Branch, Prompt: in.Prompt})
if err != nil { if err != nil {
envelope.WriteError(w, r, err) envelope.WriteError(w, r, err)
return return

View File

@ -3,13 +3,12 @@ package ports
import "github.com/aoagents/agent-orchestrator/backend/internal/domain" import "github.com/aoagents/agent-orchestrator/backend/internal/domain"
// SpawnConfig is the request to start a new session: which project/issue, which // SpawnConfig is the request to start a new session: which project/issue, which
// agent harness, and the branch/prompt/rules the agent launches with. // agent harness, and the branch/prompt the agent launches with.
type SpawnConfig struct { type SpawnConfig struct {
ProjectID domain.ProjectID ProjectID domain.ProjectID
IssueID domain.IssueID IssueID domain.IssueID
Kind domain.SessionKind Kind domain.SessionKind
Harness domain.AgentHarness Harness domain.AgentHarness
Branch string Branch string
Prompt string Prompt string
AgentRules string
} }

View File

@ -473,17 +473,8 @@ func seedRecord(cfg ports.SpawnConfig, now time.Time) domain.SessionRecord {
} }
} }
// buildPrompt assembles the spawn prompt from the explicit config (the full
// 3-layer assembly lands later).
func buildPrompt(cfg ports.SpawnConfig) string { func buildPrompt(cfg ports.SpawnConfig) string {
switch { return cfg.Prompt
case cfg.AgentRules == "":
return cfg.Prompt
case cfg.Prompt == "":
return cfg.AgentRules
default:
return cfg.Prompt + "\n\n" + cfg.AgentRules
}
} }
func (m *Manager) buildSpawnPrompt(ctx context.Context, cfg ports.SpawnConfig) (string, error) { func (m *Manager) buildSpawnPrompt(ctx context.Context, cfg ports.SpawnConfig) (string, error) {

View File

@ -517,7 +517,6 @@ export interface components {
orchestrator: components["schemas"]["OrchestratorResponse"]; orchestrator: components["schemas"]["OrchestratorResponse"];
}; };
SpawnSessionRequest: { SpawnSessionRequest: {
agentRules?: string;
branch?: string; branch?: string;
/** @enum {string} */ /** @enum {string} */
harness?: "claude-code" | "codex" | "aider" | "opencode" | "grok" | "droid" | "amp" | "agy" | "crush" | "cursor" | "qwen" | "copilot" | "goose" | "auggie" | "continue" | "devin" | "cline" | "kimi" | "kiro" | "kilocode" | "vibe" | "pi" | "autohand"; harness?: "claude-code" | "codex" | "aider" | "opencode" | "grok" | "droid" | "amp" | "agy" | "crush" | "cursor" | "qwen" | "copilot" | "goose" | "auggie" | "continue" | "devin" | "cline" | "kimi" | "kiro" | "kilocode" | "vibe" | "pi" | "autohand";