Skip to content

🀯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

πŸ”¨ chore(heteroContext): clarify sandbox TTL and add public-repo fork push guide (#14761)

LiJian3e43683132d1
diff --git a/src/server/services/heterogeneousAgent/cloudHeteroContext.ts b/src/server/services/heterogeneousAgent/cloudHeteroContext.ts
index 2b21141caa7..46c0a584288 100644
--- a/src/server/services/heterogeneousAgent/cloudHeteroContext.ts
+++ b/src/server/services/heterogeneousAgent/cloudHeteroContext.ts
@@ -34,7 +34,7 @@ export function buildCloudHeteroContext(params: {
'You are running inside a LobeHub cloud sandbox. Your working directory is `/workspace`.',
'',
'## Sandbox Persistence β€” CRITICAL',
- 'This sandbox is **ephemeral**: it will be wiped after a period of inactivity.',
+ 'This sandbox is **ephemeral**: it will be destroyed after ~1 hour of inactivity.',
'**Any file changes that are not pushed to a remote will be permanently lost.**',
'',
'Rules you MUST follow for every code change:',
@@ -46,6 +46,34 @@ export function buildCloudHeteroContext(params: {
'3. **Never rely on local-only state** β€” treat every file in `/workspace` as temporary.',
' The source of truth is the remote GitHub repository.',
'',
+ '## Pushing to GitHub β€” Public vs Private Repos',
+ '',
+ 'Before pushing, check whether the repo is public or private:',
+ '```bash',
+ 'gh repo view <owner>/<repo> --json isPrivate --jq .isPrivate',
+ '```',
+ '',
+ '**Private repo** β€” push directly to the origin remote:',
+ '```bash',
+ 'git push origin <branch>',
+ '```',
+ '',
+ '**Public repo** β€” you likely do not have write access. Fork first, then push:',
+ '```bash',
+ '# 1. Fork the repo to your account (idempotent β€” safe to run even if fork exists)',
+ 'gh repo fork <owner>/<repo> --clone=false',
+ '# 2. Add the fork as a remote (idempotent β€” safe to re-run if remote already exists)',
+ 'GITHUB_USER=$(gh api user --jq .login)',
+ 'git remote set-url fork https://github.com/$GITHUB_USER/<repo>.git 2>/dev/null || git remote add fork https://github.com/$GITHUB_USER/<repo>.git',
+ '# 3. Push to the fork',
+ 'git push fork <branch>',
+ '# 4. Open a PR from the fork to the upstream repo',
+ 'gh pr create --repo <owner>/<repo> --head $GITHUB_USER:<branch> --title "..." --body "..."',
+ '```',
+ '',
+ 'If you are unsure whether you have push access, attempt `git push origin <branch>` first.',
+ 'If it fails with a 403 / permission denied error, fall back to the fork workflow above.',
+ '',
'If the user asks you to make code changes, the task is NOT complete until those changes',
'are visible on GitHub (pushed to a branch or merged via PR).',
];