fix: session start timing and MR type issues
- Add 200ms delay after NewSession before sending keys to fix race condition where shell is not ready (mayor.go, crew.go) - Use merge-request type instead of task for gt mq submit (mq.go) Fixes gt-tulx 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -480,7 +480,8 @@ func runCrewAt(cmd *cobra.Command, args []string) error {
|
||||
t.SetEnvironment(sessionID, "GT_CREW", name)
|
||||
|
||||
// Start claude with skip permissions (crew workers are trusted like Mayor)
|
||||
if err := t.SendKeys(sessionID, "claude --dangerously-skip-permissions"); err != nil {
|
||||
// Use SendKeysDelayed to allow shell initialization after NewSession
|
||||
if err := t.SendKeysDelayed(sessionID, "claude --dangerously-skip-permissions", 200); err != nil {
|
||||
return fmt.Errorf("starting claude: %w", err)
|
||||
}
|
||||
|
||||
@@ -701,7 +702,8 @@ func runCrewRefresh(cmd *cobra.Command, args []string) error {
|
||||
t.SetEnvironment(sessionID, "GT_CREW", name)
|
||||
|
||||
// Start claude
|
||||
if err := t.SendKeys(sessionID, "claude"); err != nil {
|
||||
// Use SendKeysDelayed to allow shell initialization after NewSession
|
||||
if err := t.SendKeysDelayed(sessionID, "claude", 200); err != nil {
|
||||
return fmt.Errorf("starting claude: %w", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -124,8 +124,9 @@ func startMayorSession(t *tmux.Tmux) error {
|
||||
|
||||
// Launch Claude in a respawn loop - session survives restarts
|
||||
// The startup hook handles 'gt prime' automatically
|
||||
// Use SendKeysDelayed to allow shell initialization after NewSession
|
||||
loopCmd := `while true; do echo "🏛️ Starting Mayor session..."; claude --dangerously-skip-permissions; echo ""; echo "Mayor exited. Restarting in 2s... (Ctrl-C to stop)"; sleep 2; done`
|
||||
if err := t.SendKeys(MayorSessionName, loopCmd); err != nil {
|
||||
if err := t.SendKeysDelayed(MayorSessionName, loopCmd, 200); err != nil {
|
||||
return fmt.Errorf("sending command: %w", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -337,15 +337,9 @@ func runMqSubmit(cmd *cobra.Command, args []string) error {
|
||||
description := beads.FormatMRFields(mrFields)
|
||||
|
||||
// Create the merge-request issue
|
||||
// Note: beads CLI requires type to be one of: task, bug, feature, epic
|
||||
// Since merge-request is not a built-in type, we'll use a convention:
|
||||
// Create as task with special title prefix and description fields.
|
||||
// The "type" field in the description marks it as a merge-request.
|
||||
description = "type: merge-request\n" + description
|
||||
|
||||
createOpts := beads.CreateOptions{
|
||||
Title: title,
|
||||
Type: "task", // Use task type, mark as MR in description
|
||||
Type: "merge-request",
|
||||
Priority: priority,
|
||||
Description: description,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user