Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions voltage/images/buzz-agent/test-profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,25 @@ def run(*args, **kwargs):
+ ('exit 1\n' if mode == 'no-depot' else '')
+ 'case "$3" in */organization) printf fixture-org;; */credential) printf synthetic-profile-depot;; *) exit 1;; esac\n')
(tools/'op').chmod(0o700)
env['PATH'] = str(tools)+':'+env['PATH']
def rotate(models):
# The Codex setup gate requires the image's exact PATH, so its modes keep it.
if mode not in ('manual-gate', 'gate-api-key'):
env['PATH'] = str(tools)+':'+env['PATH']
def rotate(models, via_profile=None):
stored = json.loads(run('aws', 'secretsmanager', 'get-secret-value', '--secret-id', env['BUZZ_DEVELOPER_PROFILE_ARN']))
profile = json.loads(stored['SecretString'])
profile['models'] = models
if via_profile is not None:
profile['via']['profile'] = via_profile
path = Path('/tmp/rotated-profile.json')
path.write_text(json.dumps(profile))
path.chmod(0o600)
return json.loads(run('aws', 'secretsmanager', 'put-secret-value', '--secret-id', stored['ARN'], '--secret-string', 'file://'+str(path)))
if mode in ('manual-gate', 'gate-api-key'):
# A subscription token may share the profile with the Codex gate; billed API keys may not.
updated = rotate({'claude_oauth_token':'synthetic-profile-claude-oauth'}) if mode == 'manual-gate' else None
# Without the fake op on PATH, a depot service would make the bootstrap call the image's op.
no_depot = '[providers.fixture]\ntype="fixture"\n[services.fixture]\nprovider="fixture"\n'
updated = (rotate({'claude_oauth_token':'synthetic-profile-claude-oauth'}, no_depot)
if mode == 'manual-gate' else None)
env.update(BUZZ_SETUP_MODE='codex-device-v1', BUZZ_SETUP_AGENT_PUBKEY='c'*64,
BUZZ_SETUP_POD_UID='11111111-2222-3333-4444-555555555555', BUZZ_SETUP_IMAGE_DIGEST='sha256:'+'d'*64,
BUZZ_SETUP_NONCE='e'*32, BUZZ_SETUP_DEADLINE=str(int(time.time())+120),
Expand Down
Loading